Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
2ce7824e
Commit
2ce7824e
authored
Apr 22, 2005
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
c0248b21
e6142c47
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
750 additions
and
959 deletions
+750
-959
ndb/include/kernel/signaldata/BackupImpl.hpp
ndb/include/kernel/signaldata/BackupImpl.hpp
+7
-5
ndb/include/kernel/signaldata/BackupSignalData.hpp
ndb/include/kernel/signaldata/BackupSignalData.hpp
+3
-0
ndb/src/common/debugger/signaldata/BackupImpl.cpp
ndb/src/common/debugger/signaldata/BackupImpl.cpp
+2
-4
ndb/src/kernel/blocks/backup/Backup.cpp
ndb/src/kernel/blocks/backup/Backup.cpp
+616
-876
ndb/src/kernel/blocks/backup/Backup.hpp
ndb/src/kernel/blocks/backup/Backup.hpp
+15
-21
ndb/src/kernel/blocks/backup/Backup.txt
ndb/src/kernel/blocks/backup/Backup.txt
+25
-0
ndb/src/kernel/blocks/backup/BackupInit.cpp
ndb/src/kernel/blocks/backup/BackupInit.cpp
+1
-1
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
+1
-0
ndb/src/mgmapi/mgmapi.cpp
ndb/src/mgmapi/mgmapi.cpp
+2
-2
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+11
-18
ndb/src/mgmsrv/MgmtSrvr.hpp
ndb/src/mgmsrv/MgmtSrvr.hpp
+3
-1
ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp
ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp
+4
-2
ndb/src/ndbapi/ndberror.c
ndb/src/ndbapi/ndberror.c
+3
-2
ndb/test/ndbapi/testBackup.cpp
ndb/test/ndbapi/testBackup.cpp
+7
-7
ndb/test/run-test/daily-basic-tests.txt
ndb/test/run-test/daily-basic-tests.txt
+24
-0
ndb/test/src/NdbBackup.cpp
ndb/test/src/NdbBackup.cpp
+26
-20
No files found.
ndb/include/kernel/signaldata/BackupImpl.hpp
View file @
2ce7824e
...
@@ -75,7 +75,7 @@ class DefineBackupRef {
...
@@ -75,7 +75,7 @@ class DefineBackupRef {
friend
bool
printDEFINE_BACKUP_REF
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
friend
bool
printDEFINE_BACKUP_REF
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
public:
public:
STATIC_CONST
(
SignalLength
=
3
);
STATIC_CONST
(
SignalLength
=
4
);
enum
ErrorCode
{
enum
ErrorCode
{
Undefined
=
1340
,
Undefined
=
1340
,
...
@@ -92,6 +92,7 @@ private:
...
@@ -92,6 +92,7 @@ private:
Uint32
backupId
;
Uint32
backupId
;
Uint32
backupPtr
;
Uint32
backupPtr
;
Uint32
errorCode
;
Uint32
errorCode
;
Uint32
nodeId
;
};
};
class
DefineBackupConf
{
class
DefineBackupConf
{
...
@@ -158,7 +159,7 @@ class StartBackupRef {
...
@@ -158,7 +159,7 @@ class StartBackupRef {
friend
bool
printSTART_BACKUP_REF
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
friend
bool
printSTART_BACKUP_REF
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
public:
public:
STATIC_CONST
(
SignalLength
=
4
);
STATIC_CONST
(
SignalLength
=
5
);
enum
ErrorCode
{
enum
ErrorCode
{
FailedToAllocateTriggerRecord
=
1
FailedToAllocateTriggerRecord
=
1
...
@@ -168,6 +169,7 @@ private:
...
@@ -168,6 +169,7 @@ private:
Uint32
backupPtr
;
Uint32
backupPtr
;
Uint32
signalNo
;
Uint32
signalNo
;
Uint32
errorCode
;
Uint32
errorCode
;
Uint32
nodeId
;
};
};
class
StartBackupConf
{
class
StartBackupConf
{
...
@@ -232,9 +234,8 @@ public:
...
@@ -232,9 +234,8 @@ public:
private:
private:
Uint32
backupId
;
Uint32
backupId
;
Uint32
backupPtr
;
Uint32
backupPtr
;
Uint32
tableId
;
Uint32
fragmentNo
;
Uint32
errorCode
;
Uint32
errorCode
;
Uint32
nodeId
;
};
};
class
BackupFragmentConf
{
class
BackupFragmentConf
{
...
@@ -296,12 +297,13 @@ class StopBackupRef {
...
@@ -296,12 +297,13 @@ class StopBackupRef {
friend
bool
printSTOP_BACKUP_REF
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
friend
bool
printSTOP_BACKUP_REF
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
public:
public:
STATIC_CONST
(
SignalLength
=
3
);
STATIC_CONST
(
SignalLength
=
4
);
private:
private:
Uint32
backupId
;
Uint32
backupId
;
Uint32
backupPtr
;
Uint32
backupPtr
;
Uint32
errorCode
;
Uint32
errorCode
;
Uint32
nodeId
;
};
};
class
StopBackupConf
{
class
StopBackupConf
{
...
...
ndb/include/kernel/signaldata/BackupSignalData.hpp
View file @
2ce7824e
...
@@ -240,6 +240,9 @@ public:
...
@@ -240,6 +240,9 @@ public:
FileOrScanError
=
1325
,
// slave -> coordinator
FileOrScanError
=
1325
,
// slave -> coordinator
BackupFailureDueToNodeFail
=
1326
,
// slave -> slave
BackupFailureDueToNodeFail
=
1326
,
// slave -> slave
OkToClean
=
1327
// master -> slave
OkToClean
=
1327
// master -> slave
,
AbortScan
=
1328
,
IncompatibleVersions
=
1329
};
};
private:
private:
Uint32
requestType
;
Uint32
requestType
;
...
...
ndb/src/common/debugger/signaldata/BackupImpl.cpp
View file @
2ce7824e
...
@@ -90,10 +90,8 @@ printBACKUP_FRAGMENT_REQ(FILE * out, const Uint32 * data, Uint32 l, Uint16 bno){
...
@@ -90,10 +90,8 @@ printBACKUP_FRAGMENT_REQ(FILE * out, const Uint32 * data, Uint32 l, Uint16 bno){
bool
bool
printBACKUP_FRAGMENT_REF
(
FILE
*
out
,
const
Uint32
*
data
,
Uint32
l
,
Uint16
bno
){
printBACKUP_FRAGMENT_REF
(
FILE
*
out
,
const
Uint32
*
data
,
Uint32
l
,
Uint16
bno
){
BackupFragmentRef
*
sig
=
(
BackupFragmentRef
*
)
data
;
BackupFragmentRef
*
sig
=
(
BackupFragmentRef
*
)
data
;
fprintf
(
out
,
" backupPtr: %d backupId: %d
\n
"
,
fprintf
(
out
,
" backupPtr: %d backupId: %d nodeId: %d errorCode: %d
\n
"
,
sig
->
backupPtr
,
sig
->
backupId
);
sig
->
backupPtr
,
sig
->
backupId
,
sig
->
nodeId
,
sig
->
errorCode
);
fprintf
(
out
,
" tableId: %d fragmentNo: %d errorCode: %d
\n
"
,
sig
->
tableId
,
sig
->
fragmentNo
,
sig
->
errorCode
);
return
true
;
return
true
;
}
}
...
...
ndb/src/kernel/blocks/backup/Backup.cpp
View file @
2ce7824e
...
@@ -67,31 +67,6 @@ static const Uint32 BACKUP_SEQUENCE = 0x1F000000;
...
@@ -67,31 +67,6 @@ static const Uint32 BACKUP_SEQUENCE = 0x1F000000;
//#define DEBUG_ABORT
//#define DEBUG_ABORT
//---------------------------------------------------------
// Ignore this since a completed abort could have preceded
// this message.
//---------------------------------------------------------
#define slaveAbortCheck() \
if ((ptr.p->backupId != backupId) || \
(ptr.p->slaveState.getState() == ABORTING)) { \
jam(); \
return; \
}
#define masterAbortCheck() \
if ((ptr.p->backupId != backupId) || \
(ptr.p->masterData.state.getState() == ABORTING)) { \
jam(); \
return; \
}
#define defineSlaveAbortCheck() \
if (ptr.p->slaveState.getState() == ABORTING) { \
jam(); \
closeFiles(signal, ptr); \
return; \
}
static
Uint32
g_TypeOfStart
=
NodeState
::
ST_ILLEGAL_TYPE
;
static
Uint32
g_TypeOfStart
=
NodeState
::
ST_ILLEGAL_TYPE
;
void
void
...
@@ -221,12 +196,7 @@ Backup::execCONTINUEB(Signal* signal)
...
@@ -221,12 +196,7 @@ Backup::execCONTINUEB(Signal* signal)
jam
();
jam
();
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
Tdata1
);
c_backupPool
.
getPtr
(
ptr
,
Tdata1
);
if
(
ptr
.
p
->
slaveState
.
getState
()
==
ABORTING
)
{
jam
();
closeFiles
(
signal
,
ptr
);
return
;
}
//if
BackupFilePtr
filePtr
;
BackupFilePtr
filePtr
;
ptr
.
p
->
files
.
getPtr
(
filePtr
,
ptr
.
p
->
ctlFilePtr
);
ptr
.
p
->
files
.
getPtr
(
filePtr
,
ptr
.
p
->
ctlFilePtr
);
FsBuffer
&
buf
=
filePtr
.
p
->
operation
.
dataBuffer
;
FsBuffer
&
buf
=
filePtr
.
p
->
operation
.
dataBuffer
;
...
@@ -324,13 +294,7 @@ Backup::execDUMP_STATE_ORD(Signal* signal)
...
@@ -324,13 +294,7 @@ Backup::execDUMP_STATE_ORD(Signal* signal)
for
(
c_backups
.
first
(
ptr
);
ptr
.
i
!=
RNIL
;
c_backups
.
next
(
ptr
)){
for
(
c_backups
.
first
(
ptr
);
ptr
.
i
!=
RNIL
;
c_backups
.
next
(
ptr
)){
infoEvent
(
"BackupRecord %d: BackupId: %d MasterRef: %x ClientRef: %x"
,
infoEvent
(
"BackupRecord %d: BackupId: %d MasterRef: %x ClientRef: %x"
,
ptr
.
i
,
ptr
.
p
->
backupId
,
ptr
.
p
->
masterRef
,
ptr
.
p
->
clientRef
);
ptr
.
i
,
ptr
.
p
->
backupId
,
ptr
.
p
->
masterRef
,
ptr
.
p
->
clientRef
);
if
(
ptr
.
p
->
masterRef
==
reference
()){
infoEvent
(
" State: %d"
,
ptr
.
p
->
slaveState
.
getState
());
infoEvent
(
" MasterState: %d State: %d"
,
ptr
.
p
->
masterData
.
state
.
getState
(),
ptr
.
p
->
slaveState
.
getState
());
}
else
{
infoEvent
(
" State: %d"
,
ptr
.
p
->
slaveState
.
getState
());
}
BackupFilePtr
filePtr
;
BackupFilePtr
filePtr
;
for
(
ptr
.
p
->
files
.
first
(
filePtr
);
filePtr
.
i
!=
RNIL
;
for
(
ptr
.
p
->
files
.
first
(
filePtr
);
filePtr
.
i
!=
RNIL
;
ptr
.
p
->
files
.
next
(
filePtr
)){
ptr
.
p
->
files
.
next
(
filePtr
)){
...
@@ -338,7 +302,7 @@ Backup::execDUMP_STATE_ORD(Signal* signal)
...
@@ -338,7 +302,7 @@ Backup::execDUMP_STATE_ORD(Signal* signal)
infoEvent
(
" file %d: type: %d open: %d running: %d done: %d scan: %d"
,
infoEvent
(
" file %d: type: %d open: %d running: %d done: %d scan: %d"
,
filePtr
.
i
,
filePtr
.
p
->
fileType
,
filePtr
.
p
->
fileOpened
,
filePtr
.
i
,
filePtr
.
p
->
fileType
,
filePtr
.
p
->
fileOpened
,
filePtr
.
p
->
fileRunning
,
filePtr
.
p
->
fileRunning
,
filePtr
.
p
->
file
Done
,
filePtr
.
p
->
scanRunning
);
filePtr
.
p
->
file
Closing
,
filePtr
.
p
->
scanRunning
);
}
}
}
}
}
}
...
@@ -356,6 +320,17 @@ Backup::execDUMP_STATE_ORD(Signal* signal)
...
@@ -356,6 +320,17 @@ Backup::execDUMP_STATE_ORD(Signal* signal)
infoEvent
(
"PagePool: %d"
,
infoEvent
(
"PagePool: %d"
,
c_pagePool
.
getSize
());
c_pagePool
.
getSize
());
if
(
signal
->
getLength
()
==
2
&&
signal
->
theData
[
1
]
==
2424
)
{
ndbrequire
(
c_tablePool
.
getSize
()
==
c_tablePool
.
getNoOfFree
());
ndbrequire
(
c_attributePool
.
getSize
()
==
c_attributePool
.
getNoOfFree
());
ndbrequire
(
c_backupPool
.
getSize
()
==
c_backupPool
.
getNoOfFree
());
ndbrequire
(
c_backupFilePool
.
getSize
()
==
c_backupFilePool
.
getNoOfFree
());
ndbrequire
(
c_pagePool
.
getSize
()
==
c_pagePool
.
getNoOfFree
());
ndbrequire
(
c_fragmentPool
.
getSize
()
==
c_fragmentPool
.
getNoOfFree
());
ndbrequire
(
c_triggerPool
.
getSize
()
==
c_triggerPool
.
getNoOfFree
());
}
}
}
}
}
...
@@ -511,27 +486,6 @@ const char* triggerNameFormat[] = {
...
@@ -511,27 +486,6 @@ const char* triggerNameFormat[] = {
"NDB$BACKUP_%d_%d_DELETE"
"NDB$BACKUP_%d_%d_DELETE"
};
};
const
Backup
::
State
Backup
::
validMasterTransitions
[]
=
{
INITIAL
,
DEFINING
,
DEFINING
,
DEFINED
,
DEFINED
,
STARTED
,
STARTED
,
SCANNING
,
SCANNING
,
STOPPING
,
STOPPING
,
INITIAL
,
DEFINING
,
ABORTING
,
DEFINED
,
ABORTING
,
STARTED
,
ABORTING
,
SCANNING
,
ABORTING
,
STOPPING
,
ABORTING
,
ABORTING
,
ABORTING
,
DEFINING
,
INITIAL
,
ABORTING
,
INITIAL
,
INITIAL
,
INITIAL
};
const
Backup
::
State
const
Backup
::
State
Backup
::
validSlaveTransitions
[]
=
{
Backup
::
validSlaveTransitions
[]
=
{
INITIAL
,
DEFINING
,
INITIAL
,
DEFINING
,
...
@@ -561,10 +515,6 @@ const Uint32
...
@@ -561,10 +515,6 @@ const Uint32
Backup
::
validSlaveTransitionsCount
=
Backup
::
validSlaveTransitionsCount
=
sizeof
(
Backup
::
validSlaveTransitions
)
/
sizeof
(
Backup
::
State
);
sizeof
(
Backup
::
validSlaveTransitions
)
/
sizeof
(
Backup
::
State
);
const
Uint32
Backup
::
validMasterTransitionsCount
=
sizeof
(
Backup
::
validMasterTransitions
)
/
sizeof
(
Backup
::
State
);
void
void
Backup
::
CompoundState
::
setState
(
State
newState
){
Backup
::
CompoundState
::
setState
(
State
newState
){
bool
found
=
false
;
bool
found
=
false
;
...
@@ -578,7 +528,8 @@ Backup::CompoundState::setState(State newState){
...
@@ -578,7 +528,8 @@ Backup::CompoundState::setState(State newState){
break
;
break
;
}
}
}
}
ndbrequire
(
found
);
//ndbrequire(found);
if
(
newState
==
INITIAL
)
if
(
newState
==
INITIAL
)
abortState
=
INITIAL
;
abortState
=
INITIAL
;
...
@@ -647,8 +598,7 @@ Backup::execNODE_FAILREP(Signal* signal)
...
@@ -647,8 +598,7 @@ Backup::execNODE_FAILREP(Signal* signal)
Uint32
theFailedNodes
[
NodeBitmask
::
Size
];
Uint32
theFailedNodes
[
NodeBitmask
::
Size
];
for
(
Uint32
i
=
0
;
i
<
NodeBitmask
::
Size
;
i
++
)
for
(
Uint32
i
=
0
;
i
<
NodeBitmask
::
Size
;
i
++
)
theFailedNodes
[
i
]
=
rep
->
theNodes
[
i
];
theFailedNodes
[
i
]
=
rep
->
theNodes
[
i
];
// NodeId old_master_node_id = getMasterNodeId();
c_masterNodeId
=
new_master_node_id
;
c_masterNodeId
=
new_master_node_id
;
NodePtr
nodePtr
;
NodePtr
nodePtr
;
...
@@ -686,15 +636,24 @@ Backup::execNODE_FAILREP(Signal* signal)
...
@@ -686,15 +636,24 @@ Backup::execNODE_FAILREP(Signal* signal)
}
}
bool
bool
Backup
::
verifyNodesAlive
(
const
NdbNodeBitmask
&
aNodeBitMask
)
Backup
::
verifyNodesAlive
(
BackupRecordPtr
ptr
,
const
NdbNodeBitmask
&
aNodeBitMask
)
{
{
Uint32
version
=
getNodeInfo
(
getOwnNodeId
()).
m_version
;
for
(
Uint32
i
=
0
;
i
<
MAX_NDB_NODES
;
i
++
)
{
for
(
Uint32
i
=
0
;
i
<
MAX_NDB_NODES
;
i
++
)
{
jam
();
jam
();
if
(
aNodeBitMask
.
get
(
i
))
{
if
(
aNodeBitMask
.
get
(
i
))
{
if
(
!
c_aliveNodes
.
get
(
i
)){
if
(
!
c_aliveNodes
.
get
(
i
)){
jam
();
jam
();
ptr
.
p
->
setErrorCode
(
AbortBackupOrd
::
BackupFailureDueToNodeFail
);
return
false
;
return
false
;
}
//if
}
//if
if
(
getNodeInfo
(
i
).
m_version
!=
version
)
{
jam
();
ptr
.
p
->
setErrorCode
(
AbortBackupOrd
::
IncompatibleVersions
);
return
false
;
}
}
//if
}
//if
}
//for
}
//for
return
true
;
return
true
;
...
@@ -709,6 +668,10 @@ Backup::checkNodeFail(Signal* signal,
...
@@ -709,6 +668,10 @@ Backup::checkNodeFail(Signal* signal,
ndbrequire
(
ptr
.
p
->
nodes
.
get
(
newCoord
));
/* just to make sure newCoord
ndbrequire
(
ptr
.
p
->
nodes
.
get
(
newCoord
));
/* just to make sure newCoord
* is part of the backup
* is part of the backup
*/
*/
NdbNodeBitmask
mask
;
mask
.
assign
(
2
,
theFailedNodes
);
/* Update ptr.p->nodes to be up to date with current alive nodes
/* Update ptr.p->nodes to be up to date with current alive nodes
*/
*/
NodePtr
nodePtr
;
NodePtr
nodePtr
;
...
@@ -730,26 +693,42 @@ Backup::checkNodeFail(Signal* signal,
...
@@ -730,26 +693,42 @@ Backup::checkNodeFail(Signal* signal,
return
;
// failed node is not part of backup process, safe to continue
return
;
// failed node is not part of backup process, safe to continue
}
}
bool
doMasterTakeover
=
false
;
if
(
mask
.
get
(
refToNode
(
ptr
.
p
->
masterRef
)))
if
(
NodeBitmask
::
get
(
theFailedNodes
,
refToNode
(
ptr
.
p
->
masterRef
))){
{
jam
();
/**
doMasterTakeover
=
true
;
* Master died...abort
};
*/
ptr
.
p
->
masterRef
=
reference
();
if
(
newCoord
==
getOwnNodeId
()){
ptr
.
p
->
nodes
.
clear
();
jam
();
ptr
.
p
->
nodes
.
set
(
getOwnNodeId
());
if
(
doMasterTakeover
)
{
ptr
.
p
->
setErrorCode
(
AbortBackupOrd
::
BackupFailureDueToNodeFail
);
/**
switch
(
ptr
.
p
->
m_gsn
){
* I'm new master
case
GSN_DEFINE_BACKUP_REQ
:
*/
case
GSN_START_BACKUP_REQ
:
CRASH_INSERTION
((
10002
));
case
GSN_BACKUP_FRAGMENT_REQ
:
#ifdef DEBUG_ABORT
case
GSN_STOP_BACKUP_REQ
:
ndbout_c
(
"**** Master Takeover: Node failed: Master id = %u"
,
// I'm currently processing...reply to self and abort...
refToNode
(
ptr
.
p
->
masterRef
));
ptr
.
p
->
masterData
.
gsn
=
ptr
.
p
->
m_gsn
;
#endif
ptr
.
p
->
masterData
.
sendCounter
=
ptr
.
p
->
nodes
;
masterTakeOver
(
signal
,
ptr
);
return
;
return
;
}
//if
case
GSN_DEFINE_BACKUP_REF
:
case
GSN_DEFINE_BACKUP_CONF
:
case
GSN_START_BACKUP_REF
:
case
GSN_START_BACKUP_CONF
:
case
GSN_BACKUP_FRAGMENT_REF
:
case
GSN_BACKUP_FRAGMENT_CONF
:
case
GSN_STOP_BACKUP_REF
:
case
GSN_STOP_BACKUP_CONF
:
ptr
.
p
->
masterData
.
gsn
=
GSN_DEFINE_BACKUP_REQ
;
masterAbort
(
signal
,
ptr
);
return
;
case
GSN_ABORT_BACKUP_ORD
:
// Already aborting
return
;
}
}
else
if
(
newCoord
==
getOwnNodeId
())
{
/**
/**
* I'm master for this backup
* I'm master for this backup
*/
*/
...
@@ -759,61 +738,81 @@ Backup::checkNodeFail(Signal* signal,
...
@@ -759,61 +738,81 @@ Backup::checkNodeFail(Signal* signal,
ndbout_c
(
"**** Master: Node failed: Master id = %u"
,
ndbout_c
(
"**** Master: Node failed: Master id = %u"
,
refToNode
(
ptr
.
p
->
masterRef
));
refToNode
(
ptr
.
p
->
masterRef
));
#endif
#endif
masterAbort
(
signal
,
ptr
,
false
);
return
;
}
//if
/**
Uint32
gsn
,
len
,
pos
;
* If there's a new master, (it's not me)
ptr
.
p
->
nodes
.
bitANDC
(
mask
);
* but remember who it is
switch
(
ptr
.
p
->
masterData
.
gsn
){
*/
case
GSN_DEFINE_BACKUP_REQ
:
ptr
.
p
->
masterRef
=
calcBackupBlockRef
(
newCoord
);
{
DefineBackupRef
*
ref
=
(
DefineBackupRef
*
)
signal
->
getDataPtr
();
ref
->
backupPtr
=
ptr
.
i
;
ref
->
backupId
=
ptr
.
p
->
backupId
;
ref
->
errorCode
=
AbortBackupOrd
::
BackupFailureDueToNodeFail
;
gsn
=
GSN_DEFINE_BACKUP_REF
;
len
=
DefineBackupRef
::
SignalLength
;
pos
=
&
ref
->
nodeId
-
signal
->
getDataPtr
();
break
;
}
case
GSN_START_BACKUP_REQ
:
{
StartBackupRef
*
ref
=
(
StartBackupRef
*
)
signal
->
getDataPtr
();
ref
->
backupPtr
=
ptr
.
i
;
ref
->
backupId
=
ptr
.
p
->
backupId
;
ref
->
errorCode
=
AbortBackupOrd
::
BackupFailureDueToNodeFail
;
ref
->
signalNo
=
ptr
.
p
->
masterData
.
startBackup
.
signalNo
;
gsn
=
GSN_START_BACKUP_REF
;
len
=
StartBackupRef
::
SignalLength
;
pos
=
&
ref
->
nodeId
-
signal
->
getDataPtr
();
break
;
}
case
GSN_BACKUP_FRAGMENT_REQ
:
{
BackupFragmentRef
*
ref
=
(
BackupFragmentRef
*
)
signal
->
getDataPtr
();
ref
->
backupPtr
=
ptr
.
i
;
ref
->
backupId
=
ptr
.
p
->
backupId
;
ref
->
errorCode
=
AbortBackupOrd
::
BackupFailureDueToNodeFail
;
gsn
=
GSN_BACKUP_FRAGMENT_REF
;
len
=
BackupFragmentRef
::
SignalLength
;
pos
=
&
ref
->
nodeId
-
signal
->
getDataPtr
();
break
;
}
case
GSN_STOP_BACKUP_REQ
:
{
StopBackupRef
*
ref
=
(
StopBackupRef
*
)
signal
->
getDataPtr
();
ref
->
backupPtr
=
ptr
.
i
;
ref
->
backupId
=
ptr
.
p
->
backupId
;
ref
->
errorCode
=
AbortBackupOrd
::
BackupFailureDueToNodeFail
;
gsn
=
GSN_STOP_BACKUP_REF
;
len
=
StopBackupRef
::
SignalLength
;
pos
=
&
ref
->
nodeId
-
signal
->
getDataPtr
();
break
;
}
case
GSN_CREATE_TRIG_REQ
:
case
GSN_ALTER_TRIG_REQ
:
case
GSN_WAIT_GCP_REQ
:
case
GSN_UTIL_SEQUENCE_REQ
:
case
GSN_UTIL_LOCK_REQ
:
case
GSN_DROP_TRIG_REQ
:
return
;
}
for
(
Uint32
i
=
0
;
(
i
=
mask
.
find
(
i
+
1
))
!=
NdbNodeBitmask
::
NotFound
;
)
{
signal
->
theData
[
pos
]
=
i
;
sendSignal
(
reference
(),
gsn
,
signal
,
len
,
JBB
);
#ifdef DEBUG_ABORT
#ifdef DEBUG_ABORT
ndbout_c
(
"**** Slave: Node failed: Master id = %u"
,
ndbout_c
(
"sending %d to self from %d"
,
gsn
,
i
);
refToNode
(
ptr
.
p
->
masterRef
));
#endif
#endif
}
return
;
}
//if
/**
/**
* I abort myself as slave if not master
* I abort myself as slave if not master
*/
*/
CRASH_INSERTION
((
10021
));
CRASH_INSERTION
((
10021
));
// slaveAbort(signal, ptr);
}
}
void
Backup
::
masterTakeOver
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
{
ptr
.
p
->
masterRef
=
reference
();
ptr
.
p
->
masterData
.
gsn
=
MAX_GSN
+
1
;
switch
(
ptr
.
p
->
slaveState
.
getState
()){
case
INITIAL
:
jam
();
ptr
.
p
->
masterData
.
state
.
forceState
(
INITIAL
);
break
;
case
ABORTING
:
jam
();
case
DEFINING
:
jam
();
case
DEFINED
:
jam
();
case
STARTED
:
jam
();
case
SCANNING
:
jam
();
ptr
.
p
->
masterData
.
state
.
forceState
(
STARTED
);
break
;
case
STOPPING
:
jam
();
case
CLEANING
:
jam
();
ptr
.
p
->
masterData
.
state
.
forceState
(
STOPPING
);
break
;
default:
ndbrequire
(
false
);
}
masterAbort
(
signal
,
ptr
,
false
);
}
void
void
Backup
::
execINCL_NODEREQ
(
Signal
*
signal
)
Backup
::
execINCL_NODEREQ
(
Signal
*
signal
)
{
{
...
@@ -895,8 +894,8 @@ Backup::execBACKUP_REQ(Signal* signal)
...
@@ -895,8 +894,8 @@ Backup::execBACKUP_REQ(Signal* signal)
ndbrequire
(
ptr
.
p
->
pages
.
empty
());
ndbrequire
(
ptr
.
p
->
pages
.
empty
());
ndbrequire
(
ptr
.
p
->
tables
.
isEmpty
());
ndbrequire
(
ptr
.
p
->
tables
.
isEmpty
());
ptr
.
p
->
m
asterData
.
state
.
forceState
(
INITIAL
)
;
ptr
.
p
->
m
_gsn
=
0
;
ptr
.
p
->
masterData
.
state
.
setState
(
DEFINING
)
;
ptr
.
p
->
errorCode
=
0
;
ptr
.
p
->
clientRef
=
senderRef
;
ptr
.
p
->
clientRef
=
senderRef
;
ptr
.
p
->
clientData
=
senderData
;
ptr
.
p
->
clientData
=
senderData
;
ptr
.
p
->
masterRef
=
reference
();
ptr
.
p
->
masterRef
=
reference
();
...
@@ -905,6 +904,7 @@ Backup::execBACKUP_REQ(Signal* signal)
...
@@ -905,6 +904,7 @@ Backup::execBACKUP_REQ(Signal* signal)
ptr
.
p
->
backupKey
[
0
]
=
0
;
ptr
.
p
->
backupKey
[
0
]
=
0
;
ptr
.
p
->
backupKey
[
1
]
=
0
;
ptr
.
p
->
backupKey
[
1
]
=
0
;
ptr
.
p
->
backupDataLen
=
0
;
ptr
.
p
->
backupDataLen
=
0
;
ptr
.
p
->
masterData
.
errorCode
=
0
;
ptr
.
p
->
masterData
.
dropTrig
.
tableId
=
RNIL
;
ptr
.
p
->
masterData
.
dropTrig
.
tableId
=
RNIL
;
ptr
.
p
->
masterData
.
alterTrig
.
tableId
=
RNIL
;
ptr
.
p
->
masterData
.
alterTrig
.
tableId
=
RNIL
;
...
@@ -928,7 +928,6 @@ Backup::execUTIL_SEQUENCE_REF(Signal* signal)
...
@@ -928,7 +928,6 @@ Backup::execUTIL_SEQUENCE_REF(Signal* signal)
ndbrequire
(
ptr
.
i
==
RNIL
);
ndbrequire
(
ptr
.
i
==
RNIL
);
c_backupPool
.
getPtr
(
ptr
);
c_backupPool
.
getPtr
(
ptr
);
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_SEQUENCE_REQ
);
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_SEQUENCE_REQ
);
ptr
.
p
->
masterData
.
gsn
=
0
;
sendBackupRef
(
signal
,
ptr
,
BackupRef
::
SequenceFailure
);
sendBackupRef
(
signal
,
ptr
,
BackupRef
::
SequenceFailure
);
}
//execUTIL_SEQUENCE_REF()
}
//execUTIL_SEQUENCE_REF()
...
@@ -938,8 +937,7 @@ Backup::sendBackupRef(Signal* signal, BackupRecordPtr ptr, Uint32 errorCode)
...
@@ -938,8 +937,7 @@ Backup::sendBackupRef(Signal* signal, BackupRecordPtr ptr, Uint32 errorCode)
{
{
jam
();
jam
();
sendBackupRef
(
ptr
.
p
->
clientRef
,
signal
,
ptr
.
p
->
clientData
,
errorCode
);
sendBackupRef
(
ptr
.
p
->
clientRef
,
signal
,
ptr
.
p
->
clientData
,
errorCode
);
// ptr.p->masterData.state.setState(INITIAL);
cleanup
(
signal
,
ptr
);
cleanupSlaveResources
(
ptr
);
}
}
void
void
...
@@ -968,7 +966,8 @@ Backup::execUTIL_SEQUENCE_CONF(Signal* signal)
...
@@ -968,7 +966,8 @@ Backup::execUTIL_SEQUENCE_CONF(Signal* signal)
UtilSequenceConf
*
conf
=
(
UtilSequenceConf
*
)
signal
->
getDataPtr
();
UtilSequenceConf
*
conf
=
(
UtilSequenceConf
*
)
signal
->
getDataPtr
();
if
(
conf
->
requestType
==
UtilSequenceReq
::
Create
)
{
if
(
conf
->
requestType
==
UtilSequenceReq
::
Create
)
{
jam
();
jam
();
sendSTTORRY
(
signal
);
// At startup in NDB
sendSTTORRY
(
signal
);
// At startup in NDB
return
;
return
;
...
@@ -979,18 +978,20 @@ Backup::execUTIL_SEQUENCE_CONF(Signal* signal)
...
@@ -979,18 +978,20 @@ Backup::execUTIL_SEQUENCE_CONF(Signal* signal)
c_backupPool
.
getPtr
(
ptr
);
c_backupPool
.
getPtr
(
ptr
);
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_SEQUENCE_REQ
);
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_SEQUENCE_REQ
);
ptr
.
p
->
masterData
.
gsn
=
0
;
if
(
ptr
.
p
->
masterData
.
state
.
getState
()
==
ABORTING
)
{
if
(
ptr
.
p
->
checkError
())
{
jam
();
jam
();
sendBackupRef
(
signal
,
ptr
,
ptr
.
p
->
errorCode
);
sendBackupRef
(
signal
,
ptr
,
ptr
.
p
->
errorCode
);
return
;
return
;
}
//if
}
//if
if
(
ERROR_INSERTED
(
10023
))
{
ptr
.
p
->
masterData
.
state
.
setState
(
ABORTING
);
if
(
ERROR_INSERTED
(
10023
))
{
sendBackupRef
(
signal
,
ptr
,
323
);
sendBackupRef
(
signal
,
ptr
,
323
);
return
;
return
;
}
//if
}
//if
ndbrequire
(
ptr
.
p
->
masterData
.
state
.
getState
()
==
DEFINING
);
{
{
Uint64
backupId
;
Uint64
backupId
;
...
@@ -1018,7 +1019,6 @@ Backup::defineBackupMutex_locked(Signal* signal, Uint32 ptrI, Uint32 retVal){
...
@@ -1018,7 +1019,6 @@ Backup::defineBackupMutex_locked(Signal* signal, Uint32 ptrI, Uint32 retVal){
c_backupPool
.
getPtr
(
ptr
);
c_backupPool
.
getPtr
(
ptr
);
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_LOCK_REQ
);
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_LOCK_REQ
);
ptr
.
p
->
masterData
.
gsn
=
0
;
ptr
.
p
->
masterData
.
gsn
=
GSN_UTIL_LOCK_REQ
;
ptr
.
p
->
masterData
.
gsn
=
GSN_UTIL_LOCK_REQ
;
Mutex
mutex
(
signal
,
c_mutexMgr
,
ptr
.
p
->
masterData
.
m_dictCommitTableMutex
);
Mutex
mutex
(
signal
,
c_mutexMgr
,
ptr
.
p
->
masterData
.
m_dictCommitTableMutex
);
...
@@ -1040,14 +1040,13 @@ Backup::dictCommitTableMutex_locked(Signal* signal, Uint32 ptrI,Uint32 retVal)
...
@@ -1040,14 +1040,13 @@ Backup::dictCommitTableMutex_locked(Signal* signal, Uint32 ptrI,Uint32 retVal)
c_backupPool
.
getPtr
(
ptr
);
c_backupPool
.
getPtr
(
ptr
);
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_LOCK_REQ
);
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_LOCK_REQ
);
ptr
.
p
->
masterData
.
gsn
=
0
;
if
(
ERROR_INSERTED
(
10031
))
{
if
(
ERROR_INSERTED
(
10031
))
{
ptr
.
p
->
masterData
.
state
.
setState
(
ABORTING
);
ptr
.
p
->
setErrorCode
(
331
);
ptr
.
p
->
setErrorCode
(
331
);
}
//if
}
//if
if
(
ptr
.
p
->
masterData
.
state
.
getState
()
==
ABORTING
)
{
if
(
ptr
.
p
->
checkError
())
{
jam
();
jam
();
/**
/**
...
@@ -1062,13 +1061,11 @@ Backup::dictCommitTableMutex_locked(Signal* signal, Uint32 ptrI,Uint32 retVal)
...
@@ -1062,13 +1061,11 @@ Backup::dictCommitTableMutex_locked(Signal* signal, Uint32 ptrI,Uint32 retVal)
Mutex
mutex2
(
signal
,
c_mutexMgr
,
ptr
.
p
->
masterData
.
m_defineBackupMutex
);
Mutex
mutex2
(
signal
,
c_mutexMgr
,
ptr
.
p
->
masterData
.
m_defineBackupMutex
);
jam
();
jam
();
mutex2
.
unlock
();
// ignore response
mutex2
.
unlock
();
// ignore response
sendBackupRef
(
signal
,
ptr
,
ptr
.
p
->
errorCode
);
sendBackupRef
(
signal
,
ptr
,
ptr
.
p
->
errorCode
);
return
;
return
;
}
//if
}
//if
ndbrequire
(
ptr
.
p
->
masterData
.
state
.
getState
()
==
DEFINING
);
sendDefineBackupReq
(
signal
,
ptr
);
sendDefineBackupReq
(
signal
,
ptr
);
}
}
...
@@ -1078,33 +1075,6 @@ Backup::dictCommitTableMutex_locked(Signal* signal, Uint32 ptrI,Uint32 retVal)
...
@@ -1078,33 +1075,6 @@ Backup::dictCommitTableMutex_locked(Signal* signal, Uint32 ptrI,Uint32 retVal)
*
*
*****************************************************************************/
*****************************************************************************/
void
Backup
::
sendSignalAllWait
(
BackupRecordPtr
ptr
,
Uint32
gsn
,
Signal
*
signal
,
Uint32
signalLength
,
bool
executeDirect
)
{
jam
();
ptr
.
p
->
masterData
.
gsn
=
gsn
;
ptr
.
p
->
masterData
.
sendCounter
.
clearWaitingFor
();
NodePtr
node
;
for
(
c_nodes
.
first
(
node
);
node
.
i
!=
RNIL
;
c_nodes
.
next
(
node
)){
jam
();
const
Uint32
nodeId
=
node
.
p
->
nodeId
;
if
(
node
.
p
->
alive
&&
ptr
.
p
->
nodes
.
get
(
nodeId
)){
jam
();
ptr
.
p
->
masterData
.
sendCounter
.
setWaitingFor
(
nodeId
);
const
BlockReference
ref
=
numberToRef
(
BACKUP
,
nodeId
);
if
(
!
executeDirect
||
ref
!=
reference
())
{
sendSignal
(
ref
,
gsn
,
signal
,
signalLength
,
JBB
);
}
//if
}
//if
}
//for
if
(
executeDirect
)
{
EXECUTE_DIRECT
(
BACKUP
,
gsn
,
signal
,
signalLength
);
}
}
bool
bool
Backup
::
haveAllSignals
(
BackupRecordPtr
ptr
,
Uint32
gsn
,
Uint32
nodeId
)
Backup
::
haveAllSignals
(
BackupRecordPtr
ptr
,
Uint32
gsn
,
Uint32
nodeId
)
{
{
...
@@ -1114,10 +1084,6 @@ Backup::haveAllSignals(BackupRecordPtr ptr, Uint32 gsn, Uint32 nodeId)
...
@@ -1114,10 +1084,6 @@ Backup::haveAllSignals(BackupRecordPtr ptr, Uint32 gsn, Uint32 nodeId)
ndbrequire
(
ptr
.
p
->
masterData
.
sendCounter
.
isWaitingFor
(
nodeId
));
ndbrequire
(
ptr
.
p
->
masterData
.
sendCounter
.
isWaitingFor
(
nodeId
));
ptr
.
p
->
masterData
.
sendCounter
.
clearWaitingFor
(
nodeId
);
ptr
.
p
->
masterData
.
sendCounter
.
clearWaitingFor
(
nodeId
);
if
(
ptr
.
p
->
masterData
.
sendCounter
.
done
())
ptr
.
p
->
masterData
.
gsn
=
0
;
return
ptr
.
p
->
masterData
.
sendCounter
.
done
();
return
ptr
.
p
->
masterData
.
sendCounter
.
done
();
}
}
...
@@ -1138,11 +1104,12 @@ Backup::sendDefineBackupReq(Signal *signal, BackupRecordPtr ptr)
...
@@ -1138,11 +1104,12 @@ Backup::sendDefineBackupReq(Signal *signal, BackupRecordPtr ptr)
req
->
nodes
=
ptr
.
p
->
nodes
;
req
->
nodes
=
ptr
.
p
->
nodes
;
req
->
backupDataLen
=
ptr
.
p
->
backupDataLen
;
req
->
backupDataLen
=
ptr
.
p
->
backupDataLen
;
ptr
.
p
->
masterData
.
errorCode
=
0
;
ptr
.
p
->
masterData
.
gsn
=
GSN_DEFINE_BACKUP_REQ
;
ptr
.
p
->
okToCleanMaster
=
false
;
// master must wait with cleaning to last
ptr
.
p
->
masterData
.
sendCounter
=
ptr
.
p
->
nodes
;
sendSignalAllWait
(
ptr
,
GSN_DEFINE_BACKUP_REQ
,
signal
,
NodeReceiverGroup
rg
(
BACKUP
,
ptr
.
p
->
nodes
);
DefineBackupReq
::
SignalLength
,
sendSignal
(
rg
,
GSN_DEFINE_BACKUP_REQ
,
signal
,
true
/* do execute direct on oneself */
);
DefineBackupReq
::
SignalLength
,
JBB
);
/**
/**
* Now send backup data
* Now send backup data
*/
*/
...
@@ -1167,17 +1134,15 @@ Backup::execDEFINE_BACKUP_REF(Signal* signal)
...
@@ -1167,17 +1134,15 @@ Backup::execDEFINE_BACKUP_REF(Signal* signal)
jamEntry
();
jamEntry
();
DefineBackupRef
*
ref
=
(
DefineBackupRef
*
)
signal
->
getDataPtr
();
DefineBackupRef
*
ref
=
(
DefineBackupRef
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
ref
->
backupPtr
;
const
Uint32
ptrI
=
ref
->
backupPtr
;
const
Uint32
backupId
=
ref
->
backupId
;
//
const Uint32 backupId = ref->backupId;
const
Uint32
nodeId
=
ref
ToNode
(
signal
->
senderBlockRef
())
;
const
Uint32
nodeId
=
ref
->
nodeId
;
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
masterAbortCheck
();
// macro will do return if ABORTING
ptr
.
p
->
masterData
.
errorCode
=
ref
->
errorCode
;
ptr
.
p
->
setErrorCode
(
ref
->
errorCode
)
;
defineBackupReply
(
signal
,
ptr
,
nodeId
);
defineBackupReply
(
signal
,
ptr
,
nodeId
);
}
}
...
@@ -1188,17 +1153,16 @@ Backup::execDEFINE_BACKUP_CONF(Signal* signal)
...
@@ -1188,17 +1153,16 @@ Backup::execDEFINE_BACKUP_CONF(Signal* signal)
DefineBackupConf
*
conf
=
(
DefineBackupConf
*
)
signal
->
getDataPtr
();
DefineBackupConf
*
conf
=
(
DefineBackupConf
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
conf
->
backupPtr
;
const
Uint32
ptrI
=
conf
->
backupPtr
;
const
Uint32
backupId
=
conf
->
backupId
;
//
const Uint32 backupId = conf->backupId;
const
Uint32
nodeId
=
refToNode
(
signal
->
senderBlockRef
());
const
Uint32
nodeId
=
refToNode
(
signal
->
senderBlockRef
());
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
masterAbortCheck
();
// macro will do return if ABORTING
if
(
ERROR_INSERTED
(
10024
))
{
if
(
ERROR_INSERTED
(
10024
))
{
ptr
.
p
->
setErrorCode
(
324
);
ptr
.
p
->
masterData
.
errorCode
=
324
;
}
}
//if
defineBackupReply
(
signal
,
ptr
,
nodeId
);
defineBackupReply
(
signal
,
ptr
,
nodeId
);
}
}
...
@@ -1210,6 +1174,7 @@ Backup::defineBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
...
@@ -1210,6 +1174,7 @@ Backup::defineBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
jam
();
jam
();
return
;
return
;
}
}
/**
/**
* Unlock mutexes
* Unlock mutexes
*/
*/
...
@@ -1223,16 +1188,10 @@ Backup::defineBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
...
@@ -1223,16 +1188,10 @@ Backup::defineBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
jam
();
jam
();
mutex2
.
unlock
();
// ignore response
mutex2
.
unlock
();
// ignore response
if
(
ptr
.
p
->
errorCode
)
{
if
(
ptr
.
p
->
checkError
())
jam
();
{
ptr
.
p
->
masterData
.
errorCode
=
ptr
.
p
->
errorCode
;
}
if
(
ptr
.
p
->
masterData
.
errorCode
){
jam
();
jam
();
ptr
.
p
->
setErrorCode
(
ptr
.
p
->
masterData
.
errorCode
);
masterAbort
(
signal
,
ptr
);
sendAbortBackupOrd
(
signal
,
ptr
,
AbortBackupOrd
::
OkToClean
);
masterSendAbortBackup
(
signal
,
ptr
);
return
;
return
;
}
}
...
@@ -1252,7 +1211,6 @@ Backup::defineBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
...
@@ -1252,7 +1211,6 @@ Backup::defineBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
ptr
.
p
->
nodes
.
copyto
(
NdbNodeBitmask
::
Size
,
signal
->
theData
+
3
);
ptr
.
p
->
nodes
.
copyto
(
NdbNodeBitmask
::
Size
,
signal
->
theData
+
3
);
sendSignal
(
CMVMI_REF
,
GSN_EVENT_REP
,
signal
,
3
+
NdbNodeBitmask
::
Size
,
JBB
);
sendSignal
(
CMVMI_REF
,
GSN_EVENT_REP
,
signal
,
3
+
NdbNodeBitmask
::
Size
,
JBB
);
ptr
.
p
->
masterData
.
state
.
setState
(
DEFINED
);
/**
/**
* Prepare Trig
* Prepare Trig
*/
*/
...
@@ -1286,7 +1244,6 @@ Backup::sendCreateTrig(Signal* signal,
...
@@ -1286,7 +1244,6 @@ Backup::sendCreateTrig(Signal* signal,
{
{
CreateTrigReq
*
req
=
(
CreateTrigReq
*
)
signal
->
getDataPtrSend
();
CreateTrigReq
*
req
=
(
CreateTrigReq
*
)
signal
->
getDataPtrSend
();
ptr
.
p
->
errorCode
=
0
;
ptr
.
p
->
masterData
.
gsn
=
GSN_CREATE_TRIG_REQ
;
ptr
.
p
->
masterData
.
gsn
=
GSN_CREATE_TRIG_REQ
;
ptr
.
p
->
masterData
.
sendCounter
=
3
;
ptr
.
p
->
masterData
.
sendCounter
=
3
;
ptr
.
p
->
masterData
.
createTrig
.
tableId
=
tabPtr
.
p
->
tableId
;
ptr
.
p
->
masterData
.
createTrig
.
tableId
=
tabPtr
.
p
->
tableId
;
...
@@ -1395,17 +1352,14 @@ Backup::createTrigReply(Signal* signal, BackupRecordPtr ptr)
...
@@ -1395,17 +1352,14 @@ Backup::createTrigReply(Signal* signal, BackupRecordPtr ptr)
return
;
return
;
}
//if
}
//if
ptr
.
p
->
masterData
.
gsn
=
0
;
if
(
ERROR_INSERTED
(
10025
))
{
ptr
.
p
->
errorCode
=
325
;
}
if
(
ptr
.
p
->
checkError
())
{
if
(
ptr
.
p
->
checkError
())
{
jam
();
jam
();
masterAbort
(
signal
,
ptr
,
true
);
masterAbort
(
signal
,
ptr
);
return
;
}
//if
if
(
ERROR_INSERTED
(
10025
))
{
ptr
.
p
->
errorCode
=
325
;
masterAbort
(
signal
,
ptr
,
true
);
return
;
return
;
}
//if
}
//if
...
@@ -1425,10 +1379,7 @@ Backup::createTrigReply(Signal* signal, BackupRecordPtr ptr)
...
@@ -1425,10 +1379,7 @@ Backup::createTrigReply(Signal* signal, BackupRecordPtr ptr)
/**
/**
* Finished with all tables, send StartBackupReq
* Finished with all tables, send StartBackupReq
*/
*/
ptr
.
p
->
masterData
.
state
.
setState
(
STARTED
);
ptr
.
p
->
tables
.
first
(
tabPtr
);
ptr
.
p
->
tables
.
first
(
tabPtr
);
ptr
.
p
->
errorCode
=
0
;
ptr
.
p
->
masterData
.
startBackup
.
signalNo
=
0
;
ptr
.
p
->
masterData
.
startBackup
.
signalNo
=
0
;
ptr
.
p
->
masterData
.
startBackup
.
noOfSignals
=
ptr
.
p
->
masterData
.
startBackup
.
noOfSignals
=
(
ptr
.
p
->
tables
.
noOfElements
()
+
StartBackupReq
::
MaxTableTriggers
-
1
)
/
(
ptr
.
p
->
tables
.
noOfElements
()
+
StartBackupReq
::
MaxTableTriggers
-
1
)
/
...
@@ -1467,9 +1418,12 @@ Backup::sendStartBackup(Signal* signal, BackupRecordPtr ptr, TablePtr tabPtr)
...
@@ -1467,9 +1418,12 @@ Backup::sendStartBackup(Signal* signal, BackupRecordPtr ptr, TablePtr tabPtr)
}
//for
}
//for
req
->
noOfTableTriggers
=
i
;
req
->
noOfTableTriggers
=
i
;
sendSignalAllWait
(
ptr
,
GSN_START_BACKUP_REQ
,
signal
,
ptr
.
p
->
masterData
.
gsn
=
GSN_START_BACKUP_REQ
;
StartBackupReq
::
HeaderLength
+
ptr
.
p
->
masterData
.
sendCounter
=
ptr
.
p
->
nodes
;
(
i
*
StartBackupReq
::
TableTriggerLength
));
NodeReceiverGroup
rg
(
BACKUP
,
ptr
.
p
->
nodes
);
sendSignal
(
rg
,
GSN_START_BACKUP_REQ
,
signal
,
StartBackupReq
::
HeaderLength
+
(
i
*
StartBackupReq
::
TableTriggerLength
),
JBB
);
}
}
void
void
...
@@ -1479,15 +1433,13 @@ Backup::execSTART_BACKUP_REF(Signal* signal)
...
@@ -1479,15 +1433,13 @@ Backup::execSTART_BACKUP_REF(Signal* signal)
StartBackupRef
*
ref
=
(
StartBackupRef
*
)
signal
->
getDataPtr
();
StartBackupRef
*
ref
=
(
StartBackupRef
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
ref
->
backupPtr
;
const
Uint32
ptrI
=
ref
->
backupPtr
;
const
Uint32
backupId
=
ref
->
backupId
;
//
const Uint32 backupId = ref->backupId;
const
Uint32
signalNo
=
ref
->
signalNo
;
const
Uint32
signalNo
=
ref
->
signalNo
;
const
Uint32
nodeId
=
ref
ToNode
(
signal
->
senderBlockRef
())
;
const
Uint32
nodeId
=
ref
->
nodeId
;
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
masterAbortCheck
();
// macro will do return if ABORTING
ptr
.
p
->
setErrorCode
(
ref
->
errorCode
);
ptr
.
p
->
setErrorCode
(
ref
->
errorCode
);
startBackupReply
(
signal
,
ptr
,
nodeId
,
signalNo
);
startBackupReply
(
signal
,
ptr
,
nodeId
,
signalNo
);
}
}
...
@@ -1499,15 +1451,13 @@ Backup::execSTART_BACKUP_CONF(Signal* signal)
...
@@ -1499,15 +1451,13 @@ Backup::execSTART_BACKUP_CONF(Signal* signal)
StartBackupConf
*
conf
=
(
StartBackupConf
*
)
signal
->
getDataPtr
();
StartBackupConf
*
conf
=
(
StartBackupConf
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
conf
->
backupPtr
;
const
Uint32
ptrI
=
conf
->
backupPtr
;
const
Uint32
backupId
=
conf
->
backupId
;
//
const Uint32 backupId = conf->backupId;
const
Uint32
signalNo
=
conf
->
signalNo
;
const
Uint32
signalNo
=
conf
->
signalNo
;
const
Uint32
nodeId
=
refToNode
(
signal
->
senderBlockRef
());
const
Uint32
nodeId
=
refToNode
(
signal
->
senderBlockRef
());
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
masterAbortCheck
();
// macro will do return if ABORTING
startBackupReply
(
signal
,
ptr
,
nodeId
,
signalNo
);
startBackupReply
(
signal
,
ptr
,
nodeId
,
signalNo
);
}
}
...
@@ -1524,17 +1474,16 @@ Backup::startBackupReply(Signal* signal, BackupRecordPtr ptr,
...
@@ -1524,17 +1474,16 @@ Backup::startBackupReply(Signal* signal, BackupRecordPtr ptr,
return
;
return
;
}
}
if
(
ERROR_INSERTED
(
10026
))
{
ptr
.
p
->
errorCode
=
326
;
}
if
(
ptr
.
p
->
checkError
()){
if
(
ptr
.
p
->
checkError
()){
jam
();
jam
();
masterAbort
(
signal
,
ptr
,
true
);
masterAbort
(
signal
,
ptr
);
return
;
return
;
}
}
if
(
ERROR_INSERTED
(
10026
))
{
ptr
.
p
->
errorCode
=
326
;
masterAbort
(
signal
,
ptr
,
true
);
return
;
}
//if
TablePtr
tabPtr
;
TablePtr
tabPtr
;
c_tablePool
.
getPtr
(
tabPtr
,
ptr
.
p
->
masterData
.
startBackup
.
tablePtr
);
c_tablePool
.
getPtr
(
tabPtr
,
ptr
.
p
->
masterData
.
startBackup
.
tablePtr
);
...
@@ -1566,7 +1515,6 @@ Backup::sendAlterTrig(Signal* signal, BackupRecordPtr ptr)
...
@@ -1566,7 +1515,6 @@ Backup::sendAlterTrig(Signal* signal, BackupRecordPtr ptr)
{
{
AlterTrigReq
*
req
=
(
AlterTrigReq
*
)
signal
->
getDataPtrSend
();
AlterTrigReq
*
req
=
(
AlterTrigReq
*
)
signal
->
getDataPtrSend
();
ptr
.
p
->
errorCode
=
0
;
ptr
.
p
->
masterData
.
gsn
=
GSN_ALTER_TRIG_REQ
;
ptr
.
p
->
masterData
.
gsn
=
GSN_ALTER_TRIG_REQ
;
ptr
.
p
->
masterData
.
sendCounter
=
0
;
ptr
.
p
->
masterData
.
sendCounter
=
0
;
...
@@ -1608,6 +1556,7 @@ Backup::sendAlterTrig(Signal* signal, BackupRecordPtr ptr)
...
@@ -1608,6 +1556,7 @@ Backup::sendAlterTrig(Signal* signal, BackupRecordPtr ptr)
return
;
return
;
}
//if
}
//if
ptr
.
p
->
masterData
.
alterTrig
.
tableId
=
RNIL
;
ptr
.
p
->
masterData
.
alterTrig
.
tableId
=
RNIL
;
/**
/**
* Finished with all tables
* Finished with all tables
*/
*/
...
@@ -1669,11 +1618,9 @@ Backup::alterTrigReply(Signal* signal, BackupRecordPtr ptr)
...
@@ -1669,11 +1618,9 @@ Backup::alterTrigReply(Signal* signal, BackupRecordPtr ptr)
return
;
return
;
}
//if
}
//if
ptr
.
p
->
masterData
.
gsn
=
0
;
if
(
ptr
.
p
->
checkError
()){
if
(
ptr
.
p
->
checkError
()){
jam
();
jam
();
masterAbort
(
signal
,
ptr
,
true
);
masterAbort
(
signal
,
ptr
);
return
;
return
;
}
//if
}
//if
...
@@ -1719,11 +1666,10 @@ Backup::execWAIT_GCP_CONF(Signal* signal){
...
@@ -1719,11 +1666,10 @@ Backup::execWAIT_GCP_CONF(Signal* signal){
ndbrequire
(
ptr
.
p
->
masterRef
==
reference
());
ndbrequire
(
ptr
.
p
->
masterRef
==
reference
());
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_WAIT_GCP_REQ
);
ndbrequire
(
ptr
.
p
->
masterData
.
gsn
==
GSN_WAIT_GCP_REQ
);
ptr
.
p
->
masterData
.
gsn
=
0
;
if
(
ptr
.
p
->
checkError
())
{
if
(
ptr
.
p
->
checkError
())
{
jam
();
jam
();
masterAbort
(
signal
,
ptr
,
true
);
masterAbort
(
signal
,
ptr
);
return
;
return
;
}
//if
}
//if
...
@@ -1731,13 +1677,13 @@ Backup::execWAIT_GCP_CONF(Signal* signal){
...
@@ -1731,13 +1677,13 @@ Backup::execWAIT_GCP_CONF(Signal* signal){
jam
();
jam
();
CRASH_INSERTION
((
10008
));
CRASH_INSERTION
((
10008
));
ptr
.
p
->
startGCP
=
gcp
;
ptr
.
p
->
startGCP
=
gcp
;
ptr
.
p
->
masterData
.
state
.
setState
(
SCANNING
);
ptr
.
p
->
masterData
.
sendCounter
=
0
;
ptr
.
p
->
masterData
.
gsn
=
GSN_BACKUP_FRAGMENT_REQ
;
nextFragment
(
signal
,
ptr
);
nextFragment
(
signal
,
ptr
);
}
else
{
}
else
{
jam
();
jam
();
CRASH_INSERTION
((
10009
));
CRASH_INSERTION
((
10009
));
ptr
.
p
->
stopGCP
=
gcp
;
ptr
.
p
->
stopGCP
=
gcp
;
ptr
.
p
->
masterData
.
state
.
setState
(
STOPPING
);
sendDropTrig
(
signal
,
ptr
);
// regular dropping of triggers
sendDropTrig
(
signal
,
ptr
);
// regular dropping of triggers
}
//if
}
//if
}
}
...
@@ -1787,6 +1733,7 @@ Backup::nextFragment(Signal* signal, BackupRecordPtr ptr)
...
@@ -1787,6 +1733,7 @@ Backup::nextFragment(Signal* signal, BackupRecordPtr ptr)
req
->
fragmentNo
=
i
;
req
->
fragmentNo
=
i
;
req
->
count
=
0
;
req
->
count
=
0
;
ptr
.
p
->
masterData
.
sendCounter
++
;
const
BlockReference
ref
=
numberToRef
(
BACKUP
,
nodeId
);
const
BlockReference
ref
=
numberToRef
(
BACKUP
,
nodeId
);
sendSignal
(
ref
,
GSN_BACKUP_FRAGMENT_REQ
,
signal
,
sendSignal
(
ref
,
GSN_BACKUP_FRAGMENT_REQ
,
signal
,
BackupFragmentReq
::
SignalLength
,
JBB
);
BackupFragmentReq
::
SignalLength
,
JBB
);
...
@@ -1824,7 +1771,7 @@ Backup::execBACKUP_FRAGMENT_CONF(Signal* signal)
...
@@ -1824,7 +1771,7 @@ Backup::execBACKUP_FRAGMENT_CONF(Signal* signal)
BackupFragmentConf
*
conf
=
(
BackupFragmentConf
*
)
signal
->
getDataPtr
();
BackupFragmentConf
*
conf
=
(
BackupFragmentConf
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
conf
->
backupPtr
;
const
Uint32
ptrI
=
conf
->
backupPtr
;
const
Uint32
backupId
=
conf
->
backupId
;
//
const Uint32 backupId = conf->backupId;
const
Uint32
tableId
=
conf
->
tableId
;
const
Uint32
tableId
=
conf
->
tableId
;
const
Uint32
fragmentNo
=
conf
->
fragmentNo
;
const
Uint32
fragmentNo
=
conf
->
fragmentNo
;
const
Uint32
nodeId
=
refToNode
(
signal
->
senderBlockRef
());
const
Uint32
nodeId
=
refToNode
(
signal
->
senderBlockRef
());
...
@@ -1834,10 +1781,9 @@ Backup::execBACKUP_FRAGMENT_CONF(Signal* signal)
...
@@ -1834,10 +1781,9 @@ Backup::execBACKUP_FRAGMENT_CONF(Signal* signal)
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
masterAbortCheck
();
// macro will do return if ABORTING
ptr
.
p
->
noOfBytes
+=
noOfBytes
;
ptr
.
p
->
noOfBytes
+=
noOfBytes
;
ptr
.
p
->
noOfRecords
+=
noOfRecords
;
ptr
.
p
->
noOfRecords
+=
noOfRecords
;
ptr
.
p
->
masterData
.
sendCounter
--
;
TablePtr
tabPtr
;
TablePtr
tabPtr
;
ndbrequire
(
findTable
(
ptr
,
tabPtr
,
tableId
));
ndbrequire
(
findTable
(
ptr
,
tabPtr
,
tableId
));
...
@@ -1852,17 +1798,24 @@ Backup::execBACKUP_FRAGMENT_CONF(Signal* signal)
...
@@ -1852,17 +1798,24 @@ Backup::execBACKUP_FRAGMENT_CONF(Signal* signal)
fragPtr
.
p
->
scanned
=
1
;
fragPtr
.
p
->
scanned
=
1
;
fragPtr
.
p
->
scanning
=
0
;
fragPtr
.
p
->
scanning
=
0
;
if
(
ptr
.
p
->
checkError
())
{
if
(
ERROR_INSERTED
(
10028
))
jam
();
{
masterAbort
(
signal
,
ptr
,
true
);
return
;
}
//if
if
(
ERROR_INSERTED
(
10028
))
{
ptr
.
p
->
errorCode
=
328
;
ptr
.
p
->
errorCode
=
328
;
masterAbort
(
signal
,
ptr
,
true
);
}
return
;
}
//if
if
(
ptr
.
p
->
checkError
())
nextFragment
(
signal
,
ptr
);
{
if
(
ptr
.
p
->
masterData
.
sendCounter
.
done
())
{
jam
();
masterAbort
(
signal
,
ptr
);
return
;
}
//if
}
else
{
nextFragment
(
signal
,
ptr
);
}
}
}
void
void
...
@@ -1874,15 +1827,52 @@ Backup::execBACKUP_FRAGMENT_REF(Signal* signal)
...
@@ -1874,15 +1827,52 @@ Backup::execBACKUP_FRAGMENT_REF(Signal* signal)
BackupFragmentRef
*
ref
=
(
BackupFragmentRef
*
)
signal
->
getDataPtr
();
BackupFragmentRef
*
ref
=
(
BackupFragmentRef
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
ref
->
backupPtr
;
const
Uint32
ptrI
=
ref
->
backupPtr
;
const
Uint32
backupId
=
ref
->
backupId
;
//const Uint32 backupId = ref->backupId;
const
Uint32
nodeId
=
ref
->
nodeId
;
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
masterAbortCheck
();
// macro will do return if ABORTING
TablePtr
tabPtr
;
ptr
.
p
->
tables
.
first
(
tabPtr
);
for
(;
tabPtr
.
i
!=
RNIL
;
ptr
.
p
->
tables
.
next
(
tabPtr
))
{
jam
();
FragmentPtr
fragPtr
;
Array
<
Fragment
>
&
frags
=
tabPtr
.
p
->
fragments
;
const
Uint32
fragCount
=
frags
.
getSize
();
for
(
Uint32
i
=
0
;
i
<
fragCount
;
i
++
)
{
jam
();
tabPtr
.
p
->
fragments
.
getPtr
(
fragPtr
,
i
);
if
(
fragPtr
.
p
->
scanning
!=
0
&&
nodeId
==
fragPtr
.
p
->
node
)
{
jam
();
ndbrequire
(
fragPtr
.
p
->
scanned
==
0
);
fragPtr
.
p
->
scanned
=
1
;
fragPtr
.
p
->
scanning
=
0
;
goto
done
;
}
}
}
ndbrequire
(
false
);
done:
ptr
.
p
->
masterData
.
sendCounter
--
;
ptr
.
p
->
setErrorCode
(
ref
->
errorCode
);
ptr
.
p
->
setErrorCode
(
ref
->
errorCode
);
masterAbort
(
signal
,
ptr
,
true
);
if
(
ptr
.
p
->
masterData
.
sendCounter
.
done
())
{
jam
();
masterAbort
(
signal
,
ptr
);
return
;
}
//if
AbortBackupOrd
*
ord
=
(
AbortBackupOrd
*
)
signal
->
getDataPtrSend
();
ord
->
backupId
=
ptr
.
p
->
backupId
;
ord
->
backupPtr
=
ptr
.
i
;
ord
->
requestType
=
AbortBackupOrd
::
LogBufferFull
;
ord
->
senderData
=
ptr
.
i
;
execABORT_BACKUP_ORD
(
signal
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -1910,15 +1900,7 @@ Backup::sendDropTrig(Signal* signal, BackupRecordPtr ptr)
...
@@ -1910,15 +1900,7 @@ Backup::sendDropTrig(Signal* signal, BackupRecordPtr ptr)
jam
();
jam
();
ptr
.
p
->
masterData
.
dropTrig
.
tableId
=
RNIL
;
ptr
.
p
->
masterData
.
dropTrig
.
tableId
=
RNIL
;
sendAbortBackupOrd
(
signal
,
ptr
,
AbortBackupOrd
::
OkToClean
);
sendStopBackup
(
signal
,
ptr
);
if
(
ptr
.
p
->
masterData
.
state
.
getState
()
==
STOPPING
)
{
jam
();
sendStopBackup
(
signal
,
ptr
);
return
;
}
//if
ndbrequire
(
ptr
.
p
->
masterData
.
state
.
getState
()
==
ABORTING
);
masterSendAbortBackup
(
signal
,
ptr
);
}
//if
}
//if
}
}
...
@@ -2010,7 +1992,6 @@ Backup::dropTrigReply(Signal* signal, BackupRecordPtr ptr)
...
@@ -2010,7 +1992,6 @@ Backup::dropTrigReply(Signal* signal, BackupRecordPtr ptr)
return
;
return
;
}
//if
}
//if
ptr
.
p
->
masterData
.
gsn
=
0
;
sendDropTrig
(
signal
,
ptr
);
// recursive next
sendDropTrig
(
signal
,
ptr
);
// recursive next
}
}
...
@@ -2023,14 +2004,23 @@ void
...
@@ -2023,14 +2004,23 @@ void
Backup
::
execSTOP_BACKUP_REF
(
Signal
*
signal
)
Backup
::
execSTOP_BACKUP_REF
(
Signal
*
signal
)
{
{
jamEntry
();
jamEntry
();
ndbrequire
(
0
);
StopBackupRef
*
ref
=
(
StopBackupRef
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
ref
->
backupPtr
;
//const Uint32 backupId = ref->backupId;
const
Uint32
nodeId
=
ref
->
nodeId
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
ptr
.
p
->
setErrorCode
(
ref
->
errorCode
);
stopBackupReply
(
signal
,
ptr
,
nodeId
);
}
}
void
void
Backup
::
sendStopBackup
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
Backup
::
sendStopBackup
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
{
{
jam
();
jam
();
ptr
.
p
->
masterData
.
gsn
=
GSN_STOP_BACKUP_REQ
;
StopBackupReq
*
stop
=
(
StopBackupReq
*
)
signal
->
getDataPtrSend
();
StopBackupReq
*
stop
=
(
StopBackupReq
*
)
signal
->
getDataPtrSend
();
stop
->
backupPtr
=
ptr
.
i
;
stop
->
backupPtr
=
ptr
.
i
;
...
@@ -2038,8 +2028,11 @@ Backup::sendStopBackup(Signal* signal, BackupRecordPtr ptr)
...
@@ -2038,8 +2028,11 @@ Backup::sendStopBackup(Signal* signal, BackupRecordPtr ptr)
stop
->
startGCP
=
ptr
.
p
->
startGCP
;
stop
->
startGCP
=
ptr
.
p
->
startGCP
;
stop
->
stopGCP
=
ptr
.
p
->
stopGCP
;
stop
->
stopGCP
=
ptr
.
p
->
stopGCP
;
sendSignalAllWait
(
ptr
,
GSN_STOP_BACKUP_REQ
,
signal
,
ptr
.
p
->
masterData
.
gsn
=
GSN_STOP_BACKUP_REQ
;
StopBackupReq
::
SignalLength
);
ptr
.
p
->
masterData
.
sendCounter
=
ptr
.
p
->
nodes
;
NodeReceiverGroup
rg
(
BACKUP
,
ptr
.
p
->
nodes
);
sendSignal
(
rg
,
GSN_STOP_BACKUP_REQ
,
signal
,
StopBackupReq
::
SignalLength
,
JBB
);
}
}
void
void
...
@@ -2049,14 +2042,12 @@ Backup::execSTOP_BACKUP_CONF(Signal* signal)
...
@@ -2049,14 +2042,12 @@ Backup::execSTOP_BACKUP_CONF(Signal* signal)
StopBackupConf
*
conf
=
(
StopBackupConf
*
)
signal
->
getDataPtr
();
StopBackupConf
*
conf
=
(
StopBackupConf
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
conf
->
backupPtr
;
const
Uint32
ptrI
=
conf
->
backupPtr
;
const
Uint32
backupId
=
conf
->
backupId
;
//
const Uint32 backupId = conf->backupId;
const
Uint32
nodeId
=
refToNode
(
signal
->
senderBlockRef
());
const
Uint32
nodeId
=
refToNode
(
signal
->
senderBlockRef
());
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
masterAbortCheck
();
// macro will do return if ABORTING
ptr
.
p
->
noOfLogBytes
+=
conf
->
noOfLogBytes
;
ptr
.
p
->
noOfLogBytes
+=
conf
->
noOfLogBytes
;
ptr
.
p
->
noOfLogRecords
+=
conf
->
noOfLogRecords
;
ptr
.
p
->
noOfLogRecords
+=
conf
->
noOfLogRecords
;
...
@@ -2073,35 +2064,39 @@ Backup::stopBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
...
@@ -2073,35 +2064,39 @@ Backup::stopBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
return
;
return
;
}
}
// ptr.p->masterData.state.setState(INITIAL);
// send backup complete first to slaves so that they know
sendAbortBackupOrd
(
signal
,
ptr
,
AbortBackupOrd
::
BackupComplete
);
sendAbortBackupOrd
(
signal
,
ptr
,
AbortBackupOrd
::
BackupComplete
);
BackupCompleteRep
*
rep
=
(
BackupCompleteRep
*
)
signal
->
getDataPtrSend
();
if
(
!
ptr
.
p
->
checkError
())
rep
->
backupId
=
ptr
.
p
->
backupId
;
{
rep
->
senderData
=
ptr
.
p
->
clientData
;
BackupCompleteRep
*
rep
=
(
BackupCompleteRep
*
)
signal
->
getDataPtrSend
();
rep
->
startGCP
=
ptr
.
p
->
startGCP
;
rep
->
backupId
=
ptr
.
p
->
backupId
;
rep
->
stopGCP
=
ptr
.
p
->
stopGCP
;
rep
->
senderData
=
ptr
.
p
->
clientData
;
rep
->
noOfBytes
=
ptr
.
p
->
noOfBytes
;
rep
->
startGCP
=
ptr
.
p
->
startGCP
;
rep
->
noOfRecords
=
ptr
.
p
->
noOfRecords
;
rep
->
stopGCP
=
ptr
.
p
->
stopGCP
;
rep
->
noOfLogBytes
=
ptr
.
p
->
noOfLogBytes
;
rep
->
noOfBytes
=
ptr
.
p
->
noOfBytes
;
rep
->
noOfLogRecords
=
ptr
.
p
->
noOfLogRecords
;
rep
->
noOfRecords
=
ptr
.
p
->
noOfRecords
;
rep
->
nodes
=
ptr
.
p
->
nodes
;
rep
->
noOfLogBytes
=
ptr
.
p
->
noOfLogBytes
;
sendSignal
(
ptr
.
p
->
clientRef
,
GSN_BACKUP_COMPLETE_REP
,
signal
,
rep
->
noOfLogRecords
=
ptr
.
p
->
noOfLogRecords
;
BackupCompleteRep
::
SignalLength
,
JBB
);
rep
->
nodes
=
ptr
.
p
->
nodes
;
sendSignal
(
ptr
.
p
->
clientRef
,
GSN_BACKUP_COMPLETE_REP
,
signal
,
signal
->
theData
[
0
]
=
NDB_LE_BackupCompleted
;
BackupCompleteRep
::
SignalLength
,
JBB
);
signal
->
theData
[
1
]
=
ptr
.
p
->
clientRef
;
signal
->
theData
[
2
]
=
ptr
.
p
->
backupId
;
signal
->
theData
[
0
]
=
NDB_LE_BackupCompleted
;
signal
->
theData
[
3
]
=
ptr
.
p
->
startGCP
;
signal
->
theData
[
1
]
=
ptr
.
p
->
clientRef
;
signal
->
theData
[
4
]
=
ptr
.
p
->
stopGCP
;
signal
->
theData
[
2
]
=
ptr
.
p
->
backupId
;
signal
->
theData
[
5
]
=
ptr
.
p
->
noOfBytes
;
signal
->
theData
[
3
]
=
ptr
.
p
->
startGCP
;
signal
->
theData
[
6
]
=
ptr
.
p
->
noOfRecords
;
signal
->
theData
[
4
]
=
ptr
.
p
->
stopGCP
;
signal
->
theData
[
7
]
=
ptr
.
p
->
noOfLogBytes
;
signal
->
theData
[
5
]
=
ptr
.
p
->
noOfBytes
;
signal
->
theData
[
8
]
=
ptr
.
p
->
noOfLogRecords
;
signal
->
theData
[
6
]
=
ptr
.
p
->
noOfRecords
;
ptr
.
p
->
nodes
.
copyto
(
NdbNodeBitmask
::
Size
,
signal
->
theData
+
9
);
signal
->
theData
[
7
]
=
ptr
.
p
->
noOfLogBytes
;
sendSignal
(
CMVMI_REF
,
GSN_EVENT_REP
,
signal
,
9
+
NdbNodeBitmask
::
Size
,
JBB
);
signal
->
theData
[
8
]
=
ptr
.
p
->
noOfLogRecords
;
ptr
.
p
->
nodes
.
copyto
(
NdbNodeBitmask
::
Size
,
signal
->
theData
+
9
);
sendSignal
(
CMVMI_REF
,
GSN_EVENT_REP
,
signal
,
9
+
NdbNodeBitmask
::
Size
,
JBB
);
}
else
{
masterAbort
(
signal
,
ptr
);
}
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -2110,199 +2105,96 @@ Backup::stopBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
...
@@ -2110,199 +2105,96 @@ Backup::stopBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId)
*
*
*****************************************************************************/
*****************************************************************************/
void
void
Backup
::
masterAbort
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
bool
controlledAbort
)
Backup
::
masterAbort
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
{
{
if
(
ptr
.
p
->
masterData
.
state
.
getState
()
==
ABORTING
)
{
jam
();
#ifdef DEBUG_ABORT
#ifdef DEBUG_ABORT
ndbout_c
(
"---- Master already aborting
"
);
ndbout_c
(
"************ masterAbort
"
);
#endif
#endif
if
(
ptr
.
p
->
masterData
.
errorCode
!=
0
)
{
jam
();
jam
();
return
;
return
;
}
}
jam
();
#ifdef DEBUG_ABORT
ndbout_c
(
"************ masterAbort"
);
#endif
sendAbortBackupOrd
(
signal
,
ptr
,
AbortBackupOrd
::
BackupFailure
);
BackupAbortRep
*
rep
=
(
BackupAbortRep
*
)
signal
->
getDataPtrSend
();
if
(
!
ptr
.
p
->
checkError
())
rep
->
backupId
=
ptr
.
p
->
backupId
;
ptr
.
p
->
errorCode
=
AbortBackupOrd
::
BackupFailureDueToNodeFail
;
rep
->
senderData
=
ptr
.
p
->
clientData
;
rep
->
reason
=
ptr
.
p
->
errorCode
;
const
State
s
=
ptr
.
p
->
masterData
.
state
.
getState
();
sendSignal
(
ptr
.
p
->
clientRef
,
GSN_BACKUP_ABORT_REP
,
signal
,
BackupAbortRep
::
SignalLength
,
JBB
);
ptr
.
p
->
masterData
.
state
.
setState
(
ABORTING
);
ndbrequire
(
s
==
INITIAL
||
s
==
STARTED
||
s
==
DEFINING
||
s
==
DEFINED
||
s
==
SCANNING
||
s
==
STOPPING
||
s
==
ABORTING
);
if
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_SEQUENCE_REQ
)
{
jam
();
DEBUG_OUT
(
"masterAbort: gsn = GSN_UTIL_SEQUENCE_REQ"
);
//-------------------------------------------------------
// We are waiting for UTIL_SEQUENCE response. We rely on
// this to arrive and check for ABORTING in response.
// No slaves are involved at this point and ABORT simply
// results in BACKUP_REF to client
//-------------------------------------------------------
/**
* Waiting for Sequence Id
* @see execUTIL_SEQUENCE_CONF
*/
return
;
}
//if
if
(
ptr
.
p
->
masterData
.
gsn
==
GSN_UTIL_LOCK_REQ
)
{
signal
->
theData
[
0
]
=
NDB_LE_BackupAborted
;
jam
();
signal
->
theData
[
1
]
=
ptr
.
p
->
clientRef
;
DEBUG_OUT
(
"masterAbort: gsn = GSN_UTIL_LOCK_REQ"
);
signal
->
theData
[
2
]
=
ptr
.
p
->
backupId
;
//-------------------------------------------------------
signal
->
theData
[
3
]
=
ptr
.
p
->
errorCode
;
// We are waiting for UTIL_LOCK response (mutex). We rely on
sendSignal
(
CMVMI_REF
,
GSN_EVENT_REP
,
signal
,
4
,
JBB
);
// this to arrive and check for ABORTING in response.
// No slaves are involved at this point and ABORT simply
// results in BACKUP_REF to client
//-------------------------------------------------------
/**
* Waiting for lock
* @see execUTIL_LOCK_CONF
*/
return
;
}
//if
/**
* Unlock mutexes only at master
*/
jam
();
Mutex
mutex1
(
signal
,
c_mutexMgr
,
ptr
.
p
->
masterData
.
m_dictCommitTableMutex
);
jam
();
mutex1
.
unlock
();
// ignore response
jam
();
Mutex
mutex2
(
signal
,
c_mutexMgr
,
ptr
.
p
->
masterData
.
m_defineBackupMutex
);
jam
();
mutex2
.
unlock
();
// ignore response
if
(
!
controlledAbort
)
{
jam
();
if
(
s
==
DEFINING
)
{
jam
();
//-------------------------------------------------------
// If we are in the defining phase all work is done by
// slaves. No triggers have been allocated thus slaves
// may free all "Master" resources, let them know...
//-------------------------------------------------------
sendAbortBackupOrd
(
signal
,
ptr
,
AbortBackupOrd
::
OkToClean
);
return
;
}
//if
if
(
s
==
DEFINED
)
{
jam
();
//-------------------------------------------------------
// DEFINED is the state when triggers are created. We rely
// on that DICT will report create trigger failure in case
// of node failure. Thus no special action is needed here.
// We will check for errorCode != 0 when receiving
// replies on create trigger.
//-------------------------------------------------------
return
;
}
//if
if
(
ptr
.
p
->
masterData
.
gsn
==
GSN_WAIT_GCP_REQ
)
{
jam
();
DEBUG_OUT
(
"masterAbort: gsn = GSN_WAIT_GCP_REQ"
);
//-------------------------------------------------------
// We are waiting for WAIT_GCP response. We rely on
// this to arrive and check for ABORTING in response.
//-------------------------------------------------------
/**
ndbrequire
(
ptr
.
p
->
errorCode
);
* Waiting for GCP
ptr
.
p
->
masterData
.
errorCode
=
ptr
.
p
->
errorCode
;
* @see execWAIT_GCP_CONF
*/
return
;
}
//if
if
(
ptr
.
p
->
masterData
.
gsn
==
GSN_ALTER_TRIG_REQ
)
{
jam
();
DEBUG_OUT
(
"masterAbort: gsn = GSN_ALTER_TRIG_REQ"
);
//-------------------------------------------------------
// We are waiting for ALTER_TRIG response. We rely on
// this to arrive and check for ABORTING in response.
//-------------------------------------------------------
/**
AbortBackupOrd
*
ord
=
(
AbortBackupOrd
*
)
signal
->
getDataPtrSend
();
* All triggers haven't been created yet
ord
->
backupId
=
ptr
.
p
->
backupId
;
*/
ord
->
backupPtr
=
ptr
.
i
;
return
;
ord
->
senderData
=
ptr
.
i
;
}
//if
NodeReceiverGroup
rg
(
BACKUP
,
ptr
.
p
->
nodes
);
if
(
ptr
.
p
->
masterData
.
gsn
==
GSN_DROP_TRIG_REQ
)
{
switch
(
ptr
.
p
->
masterData
.
gsn
)
{
jam
();
case
GSN_DEFINE_BACKUP_REQ
:
DEBUG_OUT
(
"masterAbort: gsn = GSN_DROP_TRIG_REQ"
)
;
ord
->
requestType
=
AbortBackupOrd
::
BackupFailure
;
//-------------------------------------------------------
sendSignal
(
rg
,
GSN_ABORT_BACKUP_ORD
,
signal
,
// We are waiting for DROP_TRIG response. We rely on
AbortBackupOrd
::
SignalLength
,
JBB
);
// this to arrive and will continue dropping triggers
return
;
// until completed.
case
GSN_CREATE_TRIG_REQ
:
//-------------------------------------------------------
case
GSN_START_BACKUP_REQ
:
case
GSN_ALTER_TRIG_REQ
:
/**
case
GSN_WAIT_GCP_REQ
:
* I'm currently dropping the trigger
case
GSN_BACKUP_FRAGMENT_REQ
:
*/
jam
();
return
;
ptr
.
p
->
stopGCP
=
ptr
.
p
->
startGCP
+
1
;
}
//if
sendDropTrig
(
signal
,
ptr
);
// dropping due to error
}
//if
return
;
case
GSN_UTIL_SEQUENCE_REQ
:
//-------------------------------------------------------
case
GSN_UTIL_LOCK_REQ
:
// If we are waiting for START_BACKUP responses we can
case
GSN_DROP_TRIG_REQ
:
// safely start dropping triggers (state == STARTED).
ndbrequire
(
false
);
// We will ignore any START_BACKUP responses after this.
return
;
//-------------------------------------------------------
case
GSN_STOP_BACKUP_REQ
:
DEBUG_OUT
(
"masterAbort: sendDropTrig"
)
;
return
;
sendDropTrig
(
signal
,
ptr
);
// dropping due to error
}
}
}
void
void
Backup
::
masterSendAbortBackup
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
Backup
::
abort_scan
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
{
{
if
(
ptr
.
p
->
masterData
.
state
.
getState
()
!=
ABORTING
)
{
AbortBackupOrd
*
ord
=
(
AbortBackupOrd
*
)
signal
->
getDataPtrSend
();
sendAbortBackupOrd
(
signal
,
ptr
,
AbortBackupOrd
::
BackupFailure
);
ord
->
backupId
=
ptr
.
p
->
backupId
;
ptr
.
p
->
masterData
.
state
.
setState
(
ABORTING
);
ord
->
backupPtr
=
ptr
.
i
;
}
ord
->
senderData
=
ptr
.
i
;
const
State
s
=
ptr
.
p
->
masterData
.
state
.
getAbortState
();
ord
->
requestType
=
AbortBackupOrd
::
AbortScan
;
/**
* First inform to client
*/
if
(
s
==
DEFINING
)
{
jam
();
#ifdef DEBUG_ABORT
ndbout_c
(
"** Abort: sending BACKUP_REF to mgmtsrvr"
);
#endif
sendBackupRef
(
ptr
.
p
->
clientRef
,
signal
,
ptr
.
p
->
clientData
,
ptr
.
p
->
errorCode
);
}
else
{
TablePtr
tabPtr
;
ptr
.
p
->
tables
.
first
(
tabPtr
);
for
(;
tabPtr
.
i
!=
RNIL
;
ptr
.
p
->
tables
.
next
(
tabPtr
))
{
jam
();
jam
();
#ifdef DEBUG_ABORT
FragmentPtr
fragPtr
;
ndbout_c
(
"** Abort: sending BACKUP_ABORT_REP to mgmtsrvr"
);
Array
<
Fragment
>
&
frags
=
tabPtr
.
p
->
fragments
;
#endif
const
Uint32
fragCount
=
frags
.
getSize
();
BackupAbortRep
*
rep
=
(
BackupAbortRep
*
)
signal
->
getDataPtrSend
();
rep
->
backupId
=
ptr
.
p
->
backupId
;
for
(
Uint32
i
=
0
;
i
<
fragCount
;
i
++
)
{
rep
->
senderData
=
ptr
.
p
->
clientData
;
jam
();
rep
->
reason
=
ptr
.
p
->
errorCode
;
tabPtr
.
p
->
fragments
.
getPtr
(
fragPtr
,
i
);
sendSignal
(
ptr
.
p
->
clientRef
,
GSN_BACKUP_ABORT_REP
,
signal
,
const
Uint32
nodeId
=
fragPtr
.
p
->
node
;
BackupAbortRep
::
SignalLength
,
JBB
);
if
(
fragPtr
.
p
->
scanning
!=
0
&&
ptr
.
p
->
nodes
.
get
(
nodeId
))
{
jam
();
signal
->
theData
[
0
]
=
NDB_LE_BackupAborted
;
signal
->
theData
[
1
]
=
ptr
.
p
->
clientRef
;
const
BlockReference
ref
=
numberToRef
(
BACKUP
,
nodeId
);
signal
->
theData
[
2
]
=
ptr
.
p
->
backupId
;
sendSignal
(
ref
,
GSN_ABORT_BACKUP_ORD
,
signal
,
signal
->
theData
[
3
]
=
ptr
.
p
->
errorCode
;
AbortBackupOrd
::
SignalLength
,
JBB
);
sendSignal
(
CMVMI_REF
,
GSN_EVENT_REP
,
signal
,
4
,
JBB
);
}
//if
}
}
// ptr.p->masterData.state.setState(INITIAL);
}
sendAbortBackupOrd
(
signal
,
ptr
,
AbortBackupOrd
::
BackupFailure
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -2313,26 +2205,17 @@ Backup::masterSendAbortBackup(Signal* signal, BackupRecordPtr ptr)
...
@@ -2313,26 +2205,17 @@ Backup::masterSendAbortBackup(Signal* signal, BackupRecordPtr ptr)
void
void
Backup
::
defineBackupRef
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Uint32
errCode
)
Backup
::
defineBackupRef
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Uint32
errCode
)
{
{
if
(
ptr
.
p
->
slaveState
.
getState
()
==
ABORTING
)
{
ptr
.
p
->
m_gsn
=
GSN_DEFINE_BACKUP_REF
;
jam
();
ptr
.
p
->
setErrorCode
(
errCode
);
return
;
}
ptr
.
p
->
slaveState
.
setState
(
ABORTING
);
if
(
errCode
!=
0
)
{
jam
();
ptr
.
p
->
setErrorCode
(
errCode
);
}
//if
ndbrequire
(
ptr
.
p
->
errorCode
!=
0
);
ndbrequire
(
ptr
.
p
->
errorCode
!=
0
);
DefineBackupRef
*
ref
=
(
DefineBackupRef
*
)
signal
->
getDataPtrSend
();
DefineBackupRef
*
ref
=
(
DefineBackupRef
*
)
signal
->
getDataPtrSend
();
ref
->
backupId
=
ptr
.
p
->
backupId
;
ref
->
backupId
=
ptr
.
p
->
backupId
;
ref
->
backupPtr
=
ptr
.
i
;
ref
->
backupPtr
=
ptr
.
i
;
ref
->
errorCode
=
ptr
.
p
->
errorCode
;
ref
->
errorCode
=
ptr
.
p
->
errorCode
;
ref
->
nodeId
=
getOwnNodeId
();
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_DEFINE_BACKUP_REF
,
signal
,
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_DEFINE_BACKUP_REF
,
signal
,
DefineBackupRef
::
SignalLength
,
JBB
);
DefineBackupRef
::
SignalLength
,
JBB
);
closeFiles
(
signal
,
ptr
);
}
}
void
void
...
@@ -2366,6 +2249,7 @@ Backup::execDEFINE_BACKUP_REQ(Signal* signal)
...
@@ -2366,6 +2249,7 @@ Backup::execDEFINE_BACKUP_REQ(Signal* signal)
CRASH_INSERTION
((
10014
));
CRASH_INSERTION
((
10014
));
ptr
.
p
->
m_gsn
=
GSN_DEFINE_BACKUP_REQ
;
ptr
.
p
->
slaveState
.
forceState
(
INITIAL
);
ptr
.
p
->
slaveState
.
forceState
(
INITIAL
);
ptr
.
p
->
slaveState
.
setState
(
DEFINING
);
ptr
.
p
->
slaveState
.
setState
(
DEFINING
);
ptr
.
p
->
errorCode
=
0
;
ptr
.
p
->
errorCode
=
0
;
...
@@ -2432,7 +2316,7 @@ Backup::execDEFINE_BACKUP_REQ(Signal* signal)
...
@@ -2432,7 +2316,7 @@ Backup::execDEFINE_BACKUP_REQ(Signal* signal)
files
[
i
].
p
->
tableId
=
RNIL
;
files
[
i
].
p
->
tableId
=
RNIL
;
files
[
i
].
p
->
backupPtr
=
ptr
.
i
;
files
[
i
].
p
->
backupPtr
=
ptr
.
i
;
files
[
i
].
p
->
filePointer
=
RNIL
;
files
[
i
].
p
->
filePointer
=
RNIL
;
files
[
i
].
p
->
file
Done
=
0
;
files
[
i
].
p
->
file
Closing
=
0
;
files
[
i
].
p
->
fileOpened
=
0
;
files
[
i
].
p
->
fileOpened
=
0
;
files
[
i
].
p
->
fileRunning
=
0
;
files
[
i
].
p
->
fileRunning
=
0
;
files
[
i
].
p
->
scanRunning
=
0
;
files
[
i
].
p
->
scanRunning
=
0
;
...
@@ -2468,17 +2352,14 @@ Backup::execDEFINE_BACKUP_REQ(Signal* signal)
...
@@ -2468,17 +2352,14 @@ Backup::execDEFINE_BACKUP_REQ(Signal* signal)
ptr
.
p
->
logFilePtr
=
files
[
1
].
i
;
ptr
.
p
->
logFilePtr
=
files
[
1
].
i
;
ptr
.
p
->
dataFilePtr
=
files
[
2
].
i
;
ptr
.
p
->
dataFilePtr
=
files
[
2
].
i
;
if
(
!
verifyNodesAlive
(
ptr
.
p
->
nodes
))
{
if
(
!
verifyNodesAlive
(
ptr
,
ptr
.
p
->
nodes
))
{
jam
();
jam
();
defineBackupRef
(
signal
,
ptr
,
DefineBackupRef
::
Undefined
);
defineBackupRef
(
signal
,
ptr
,
DefineBackupRef
::
Undefined
);
// sendBackupRef(signal, ptr,
// ptr.p->errorCode?ptr.p->errorCode:BackupRef::Undefined);
return
;
return
;
}
//if
}
//if
if
(
ERROR_INSERTED
(
10027
))
{
if
(
ERROR_INSERTED
(
10027
))
{
jam
();
jam
();
defineBackupRef
(
signal
,
ptr
,
327
);
defineBackupRef
(
signal
,
ptr
,
327
);
// sendBackupRef(signal, ptr, 327);
return
;
return
;
}
//if
}
//if
...
@@ -2546,8 +2427,6 @@ Backup::execLIST_TABLES_CONF(Signal* signal)
...
@@ -2546,8 +2427,6 @@ Backup::execLIST_TABLES_CONF(Signal* signal)
return
;
return
;
}
//if
}
//if
defineSlaveAbortCheck
();
/**
/**
* All tables fetched
* All tables fetched
*/
*/
...
@@ -2679,8 +2558,6 @@ Backup::openFilesReply(Signal* signal,
...
@@ -2679,8 +2558,6 @@ Backup::openFilesReply(Signal* signal,
}
//if
}
//if
}
//for
}
//for
defineSlaveAbortCheck
();
/**
/**
* Did open succeed for all files
* Did open succeed for all files
*/
*/
...
@@ -2810,8 +2687,6 @@ Backup::execGET_TABINFOREF(Signal* signal)
...
@@ -2810,8 +2687,6 @@ Backup::execGET_TABINFOREF(Signal* signal)
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
senderData
);
c_backupPool
.
getPtr
(
ptr
,
senderData
);
defineSlaveAbortCheck
();
defineBackupRef
(
signal
,
ptr
,
ref
->
errorCode
);
defineBackupRef
(
signal
,
ptr
,
ref
->
errorCode
);
}
}
...
@@ -2833,8 +2708,6 @@ Backup::execGET_TABINFO_CONF(Signal* signal)
...
@@ -2833,8 +2708,6 @@ Backup::execGET_TABINFO_CONF(Signal* signal)
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
senderData
);
c_backupPool
.
getPtr
(
ptr
,
senderData
);
defineSlaveAbortCheck
();
SegmentedSectionPtr
dictTabInfoPtr
;
SegmentedSectionPtr
dictTabInfoPtr
;
signal
->
getSection
(
dictTabInfoPtr
,
GetTabInfoConf
::
DICT_TAB_INFO
);
signal
->
getSection
(
dictTabInfoPtr
,
GetTabInfoConf
::
DICT_TAB_INFO
);
ndbrequire
(
dictTabInfoPtr
.
sz
==
len
);
ndbrequire
(
dictTabInfoPtr
.
sz
==
len
);
...
@@ -3047,8 +2920,6 @@ Backup::execDI_FCOUNTCONF(Signal* signal)
...
@@ -3047,8 +2920,6 @@ Backup::execDI_FCOUNTCONF(Signal* signal)
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
senderData
);
c_backupPool
.
getPtr
(
ptr
,
senderData
);
defineSlaveAbortCheck
();
TablePtr
tabPtr
;
TablePtr
tabPtr
;
ndbrequire
(
findTable
(
ptr
,
tabPtr
,
tableId
));
ndbrequire
(
findTable
(
ptr
,
tabPtr
,
tableId
));
...
@@ -3127,8 +2998,6 @@ Backup::execDIGETPRIMCONF(Signal* signal)
...
@@ -3127,8 +2998,6 @@ Backup::execDIGETPRIMCONF(Signal* signal)
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
senderData
);
c_backupPool
.
getPtr
(
ptr
,
senderData
);
defineSlaveAbortCheck
();
TablePtr
tabPtr
;
TablePtr
tabPtr
;
ndbrequire
(
findTable
(
ptr
,
tabPtr
,
tableId
));
ndbrequire
(
findTable
(
ptr
,
tabPtr
,
tableId
));
...
@@ -3143,9 +3012,7 @@ Backup::execDIGETPRIMCONF(Signal* signal)
...
@@ -3143,9 +3012,7 @@ Backup::execDIGETPRIMCONF(Signal* signal)
void
void
Backup
::
getFragmentInfoDone
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
Backup
::
getFragmentInfoDone
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
{
{
// Slave must now hold on to master data until
ptr
.
p
->
m_gsn
=
GSN_DEFINE_BACKUP_CONF
;
// AbortBackupOrd::OkToClean signal
ptr
.
p
->
okToCleanMaster
=
false
;
ptr
.
p
->
slaveState
.
setState
(
DEFINED
);
ptr
.
p
->
slaveState
.
setState
(
DEFINED
);
DefineBackupConf
*
conf
=
(
DefineBackupConf
*
)
signal
->
getDataPtr
();
DefineBackupConf
*
conf
=
(
DefineBackupConf
*
)
signal
->
getDataPtr
();
conf
->
backupPtr
=
ptr
.
i
;
conf
->
backupPtr
=
ptr
.
i
;
...
@@ -3169,16 +3036,15 @@ Backup::execSTART_BACKUP_REQ(Signal* signal)
...
@@ -3169,16 +3036,15 @@ Backup::execSTART_BACKUP_REQ(Signal* signal)
StartBackupReq
*
req
=
(
StartBackupReq
*
)
signal
->
getDataPtr
();
StartBackupReq
*
req
=
(
StartBackupReq
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
req
->
backupPtr
;
const
Uint32
ptrI
=
req
->
backupPtr
;
const
Uint32
backupId
=
req
->
backupId
;
//
const Uint32 backupId = req->backupId;
const
Uint32
signalNo
=
req
->
signalNo
;
const
Uint32
signalNo
=
req
->
signalNo
;
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
slaveAbortCheck
();
// macro will do return if ABORTING
ptr
.
p
->
slaveState
.
setState
(
STARTED
);
ptr
.
p
->
slaveState
.
setState
(
STARTED
);
ptr
.
p
->
m_gsn
=
GSN_START_BACKUP_REQ
;
for
(
Uint32
i
=
0
;
i
<
req
->
noOfTableTriggers
;
i
++
)
{
for
(
Uint32
i
=
0
;
i
<
req
->
noOfTableTriggers
;
i
++
)
{
jam
();
jam
();
TablePtr
tabPtr
;
TablePtr
tabPtr
;
...
@@ -3191,11 +3057,13 @@ Backup::execSTART_BACKUP_REQ(Signal* signal)
...
@@ -3191,11 +3057,13 @@ Backup::execSTART_BACKUP_REQ(Signal* signal)
TriggerPtr
trigPtr
;
TriggerPtr
trigPtr
;
if
(
!
ptr
.
p
->
triggers
.
seizeId
(
trigPtr
,
triggerId
))
{
if
(
!
ptr
.
p
->
triggers
.
seizeId
(
trigPtr
,
triggerId
))
{
jam
();
jam
();
ptr
.
p
->
m_gsn
=
GSN_START_BACKUP_REF
;
StartBackupRef
*
ref
=
(
StartBackupRef
*
)
signal
->
getDataPtrSend
();
StartBackupRef
*
ref
=
(
StartBackupRef
*
)
signal
->
getDataPtrSend
();
ref
->
backupPtr
=
ptr
.
i
;
ref
->
backupPtr
=
ptr
.
i
;
ref
->
backupId
=
ptr
.
p
->
backupId
;
ref
->
backupId
=
ptr
.
p
->
backupId
;
ref
->
signalNo
=
signalNo
;
ref
->
signalNo
=
signalNo
;
ref
->
errorCode
=
StartBackupRef
::
FailedToAllocateTriggerRecord
;
ref
->
errorCode
=
StartBackupRef
::
FailedToAllocateTriggerRecord
;
ref
->
nodeId
=
getOwnNodeId
();
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_START_BACKUP_REF
,
signal
,
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_START_BACKUP_REF
,
signal
,
StartBackupRef
::
SignalLength
,
JBB
);
StartBackupRef
::
SignalLength
,
JBB
);
return
;
return
;
...
@@ -3233,6 +3101,7 @@ Backup::execSTART_BACKUP_REQ(Signal* signal)
...
@@ -3233,6 +3101,7 @@ Backup::execSTART_BACKUP_REQ(Signal* signal)
}
//if
}
//if
}
//for
}
//for
ptr
.
p
->
m_gsn
=
GSN_START_BACKUP_CONF
;
StartBackupConf
*
conf
=
(
StartBackupConf
*
)
signal
->
getDataPtrSend
();
StartBackupConf
*
conf
=
(
StartBackupConf
*
)
signal
->
getDataPtrSend
();
conf
->
backupPtr
=
ptr
.
i
;
conf
->
backupPtr
=
ptr
.
i
;
conf
->
backupId
=
ptr
.
p
->
backupId
;
conf
->
backupId
=
ptr
.
p
->
backupId
;
...
@@ -3255,7 +3124,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
...
@@ -3255,7 +3124,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
CRASH_INSERTION
((
10016
));
CRASH_INSERTION
((
10016
));
const
Uint32
ptrI
=
req
->
backupPtr
;
const
Uint32
ptrI
=
req
->
backupPtr
;
const
Uint32
backupId
=
req
->
backupId
;
//
const Uint32 backupId = req->backupId;
const
Uint32
tableId
=
req
->
tableId
;
const
Uint32
tableId
=
req
->
tableId
;
const
Uint32
fragNo
=
req
->
fragmentNo
;
const
Uint32
fragNo
=
req
->
fragmentNo
;
const
Uint32
count
=
req
->
count
;
const
Uint32
count
=
req
->
count
;
...
@@ -3266,10 +3135,9 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
...
@@ -3266,10 +3135,9 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
slaveAbortCheck
();
// macro will do return if ABORTING
ptr
.
p
->
slaveState
.
setState
(
SCANNING
);
ptr
.
p
->
slaveState
.
setState
(
SCANNING
);
ptr
.
p
->
m_gsn
=
GSN_BACKUP_FRAGMENT_REQ
;
/**
/**
* Get file
* Get file
*/
*/
...
@@ -3280,7 +3148,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
...
@@ -3280,7 +3148,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
ndbrequire
(
filePtr
.
p
->
fileOpened
==
1
);
ndbrequire
(
filePtr
.
p
->
fileOpened
==
1
);
ndbrequire
(
filePtr
.
p
->
fileRunning
==
1
);
ndbrequire
(
filePtr
.
p
->
fileRunning
==
1
);
ndbrequire
(
filePtr
.
p
->
scanRunning
==
0
);
ndbrequire
(
filePtr
.
p
->
scanRunning
==
0
);
ndbrequire
(
filePtr
.
p
->
file
Done
==
0
);
ndbrequire
(
filePtr
.
p
->
file
Closing
==
0
);
/**
/**
* Get table
* Get table
...
@@ -3350,7 +3218,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
...
@@ -3350,7 +3218,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
req
->
transId1
=
0
;
req
->
transId1
=
0
;
req
->
transId2
=
(
BACKUP
<<
20
)
+
(
getOwnNodeId
()
<<
8
);
req
->
transId2
=
(
BACKUP
<<
20
)
+
(
getOwnNodeId
()
<<
8
);
req
->
clientOpPtr
=
filePtr
.
i
;
req
->
clientOpPtr
=
filePtr
.
i
;
req
->
batch_size_rows
=
16
;
req
->
batch_size_rows
=
parallelism
;
req
->
batch_size_bytes
=
0
;
req
->
batch_size_bytes
=
0
;
sendSignal
(
DBLQH_REF
,
GSN_SCAN_FRAGREQ
,
signal
,
sendSignal
(
DBLQH_REF
,
GSN_SCAN_FRAGREQ
,
signal
,
ScanFragReq
::
SignalLength
,
JBB
);
ScanFragReq
::
SignalLength
,
JBB
);
...
@@ -3572,6 +3440,13 @@ Backup::OperationRecord::newScan()
...
@@ -3572,6 +3440,13 @@ Backup::OperationRecord::newScan()
return
false
;
return
false
;
}
}
bool
Backup
::
OperationRecord
::
closeScan
()
{
opNoDone
=
opNoConf
=
opLen
=
0
;
return
true
;
}
bool
bool
Backup
::
OperationRecord
::
scanConf
(
Uint32
noOfOps
,
Uint32
total_len
)
Backup
::
OperationRecord
::
scanConf
(
Uint32
noOfOps
,
Uint32
total_len
)
{
{
...
@@ -3600,11 +3475,9 @@ Backup::execSCAN_FRAGREF(Signal* signal)
...
@@ -3600,11 +3475,9 @@ Backup::execSCAN_FRAGREF(Signal* signal)
c_backupFilePool
.
getPtr
(
filePtr
,
filePtrI
);
c_backupFilePool
.
getPtr
(
filePtr
,
filePtrI
);
filePtr
.
p
->
errorCode
=
ref
->
errorCode
;
filePtr
.
p
->
errorCode
=
ref
->
errorCode
;
filePtr
.
p
->
scanRunning
=
0
;
BackupRecordPtr
ptr
;
backupFragmentRef
(
signal
,
filePtr
);
c_backupPool
.
getPtr
(
ptr
,
filePtr
.
p
->
backupPtr
);
abortFile
(
signal
,
ptr
,
filePtr
);
}
}
void
void
...
@@ -3639,9 +3512,11 @@ Backup::fragmentCompleted(Signal* signal, BackupFilePtr filePtr)
...
@@ -3639,9 +3512,11 @@ Backup::fragmentCompleted(Signal* signal, BackupFilePtr filePtr)
{
{
jam
();
jam
();
if
(
filePtr
.
p
->
errorCode
!=
0
){
if
(
filePtr
.
p
->
errorCode
!=
0
)
{
jam
();
jam
();
abortFileHook
(
signal
,
filePtr
,
true
);
// Scan completed
filePtr
.
p
->
scanRunning
=
0
;
backupFragmentRef
(
signal
,
filePtr
);
// Scan completed
return
;
return
;
}
//if
}
//if
...
@@ -3669,20 +3544,51 @@ Backup::fragmentCompleted(Signal* signal, BackupFilePtr filePtr)
...
@@ -3669,20 +3544,51 @@ Backup::fragmentCompleted(Signal* signal, BackupFilePtr filePtr)
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_BACKUP_FRAGMENT_CONF
,
signal
,
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_BACKUP_FRAGMENT_CONF
,
signal
,
BackupFragmentConf
::
SignalLength
,
JBB
);
BackupFragmentConf
::
SignalLength
,
JBB
);
ptr
.
p
->
m_gsn
=
GSN_BACKUP_FRAGMENT_CONF
;
ptr
.
p
->
slaveState
.
setState
(
STARTED
);
ptr
.
p
->
slaveState
.
setState
(
STARTED
);
return
;
return
;
}
}
void
Backup
::
backupFragmentRef
(
Signal
*
signal
,
BackupFilePtr
filePtr
)
{
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
filePtr
.
p
->
backupPtr
);
ptr
.
p
->
m_gsn
=
GSN_BACKUP_FRAGMENT_REF
;
BackupFragmentRef
*
ref
=
(
BackupFragmentRef
*
)
signal
->
getDataPtrSend
();
ref
->
backupId
=
ptr
.
p
->
backupId
;
ref
->
backupPtr
=
ptr
.
i
;
ref
->
nodeId
=
getOwnNodeId
();
ref
->
errorCode
=
ptr
.
p
->
errorCode
;
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_BACKUP_FRAGMENT_REF
,
signal
,
BackupFragmentRef
::
SignalLength
,
JBB
);
}
void
void
Backup
::
checkScan
(
Signal
*
signal
,
BackupFilePtr
filePtr
)
Backup
::
checkScan
(
Signal
*
signal
,
BackupFilePtr
filePtr
)
{
{
if
(
filePtr
.
p
->
errorCode
!=
0
){
OperationRecord
&
op
=
filePtr
.
p
->
operation
;
if
(
filePtr
.
p
->
errorCode
!=
0
)
{
jam
();
jam
();
abortFileHook
(
signal
,
filePtr
,
false
);
// Scan not completed
/**
* Close scan
*/
op
.
closeScan
();
ScanFragNextReq
*
req
=
(
ScanFragNextReq
*
)
signal
->
getDataPtrSend
();
req
->
senderData
=
filePtr
.
i
;
req
->
closeFlag
=
1
;
req
->
transId1
=
0
;
req
->
transId2
=
(
BACKUP
<<
20
)
+
(
getOwnNodeId
()
<<
8
);
sendSignal
(
DBLQH_REF
,
GSN_SCAN_NEXTREQ
,
signal
,
ScanFragNextReq
::
SignalLength
,
JBB
);
return
;
return
;
}
//if
}
//if
OperationRecord
&
op
=
filePtr
.
p
->
operation
;
if
(
op
.
newScan
())
{
if
(
op
.
newScan
())
{
jam
();
jam
();
...
@@ -3693,8 +3599,28 @@ Backup::checkScan(Signal* signal, BackupFilePtr filePtr)
...
@@ -3693,8 +3599,28 @@ Backup::checkScan(Signal* signal, BackupFilePtr filePtr)
req
->
transId2
=
(
BACKUP
<<
20
)
+
(
getOwnNodeId
()
<<
8
);
req
->
transId2
=
(
BACKUP
<<
20
)
+
(
getOwnNodeId
()
<<
8
);
req
->
batch_size_rows
=
16
;
req
->
batch_size_rows
=
16
;
req
->
batch_size_bytes
=
0
;
req
->
batch_size_bytes
=
0
;
sendSignal
(
DBLQH_REF
,
GSN_SCAN_NEXTREQ
,
signal
,
if
(
ERROR_INSERTED
(
10032
))
ScanFragNextReq
::
SignalLength
,
JBB
);
sendSignalWithDelay
(
DBLQH_REF
,
GSN_SCAN_NEXTREQ
,
signal
,
100
,
ScanFragNextReq
::
SignalLength
);
else
if
(
ERROR_INSERTED
(
10033
))
{
SET_ERROR_INSERT_VALUE
(
10032
);
sendSignalWithDelay
(
DBLQH_REF
,
GSN_SCAN_NEXTREQ
,
signal
,
10000
,
ScanFragNextReq
::
SignalLength
);
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
filePtr
.
p
->
backupPtr
);
AbortBackupOrd
*
ord
=
(
AbortBackupOrd
*
)
signal
->
getDataPtrSend
();
ord
->
backupId
=
ptr
.
p
->
backupId
;
ord
->
backupPtr
=
ptr
.
i
;
ord
->
requestType
=
AbortBackupOrd
::
FileOrScanError
;
ord
->
senderData
=
ptr
.
i
;
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_ABORT_BACKUP_ORD
,
signal
,
AbortBackupOrd
::
SignalLength
,
JBB
);
}
else
sendSignal
(
DBLQH_REF
,
GSN_SCAN_NEXTREQ
,
signal
,
ScanFragNextReq
::
SignalLength
,
JBB
);
return
;
return
;
}
//if
}
//if
...
@@ -3718,11 +3644,8 @@ Backup::execFSAPPENDREF(Signal* signal)
...
@@ -3718,11 +3644,8 @@ Backup::execFSAPPENDREF(Signal* signal)
filePtr
.
p
->
fileRunning
=
0
;
filePtr
.
p
->
fileRunning
=
0
;
filePtr
.
p
->
errorCode
=
errCode
;
filePtr
.
p
->
errorCode
=
errCode
;
BackupRecordPtr
ptr
;
checkFile
(
signal
,
filePtr
);
c_backupPool
.
getPtr
(
ptr
,
filePtr
.
p
->
backupPtr
);
abortFile
(
signal
,
ptr
,
filePtr
);
}
}
void
void
...
@@ -3738,12 +3661,6 @@ Backup::execFSAPPENDCONF(Signal* signal)
...
@@ -3738,12 +3661,6 @@ Backup::execFSAPPENDCONF(Signal* signal)
BackupFilePtr
filePtr
;
BackupFilePtr
filePtr
;
c_backupFilePool
.
getPtr
(
filePtr
,
filePtrI
);
c_backupFilePool
.
getPtr
(
filePtr
,
filePtrI
);
if
(
ERROR_INSERTED
(
10029
))
{
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
filePtr
.
p
->
backupPtr
);
abortFile
(
signal
,
ptr
,
filePtr
);
}
//if
OperationRecord
&
op
=
filePtr
.
p
->
operation
;
OperationRecord
&
op
=
filePtr
.
p
->
operation
;
...
@@ -3761,30 +3678,25 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
...
@@ -3761,30 +3678,25 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
#endif
#endif
OperationRecord
&
op
=
filePtr
.
p
->
operation
;
OperationRecord
&
op
=
filePtr
.
p
->
operation
;
Uint32
*
tmp
,
sz
;
bool
eof
;
Uint32
*
tmp
,
sz
;
bool
eof
;
if
(
op
.
dataBuffer
.
getReadPtr
(
&
tmp
,
&
sz
,
&
eof
))
{
if
(
op
.
dataBuffer
.
getReadPtr
(
&
tmp
,
&
sz
,
&
eof
))
{
jam
();
jam
();
if
(
filePtr
.
p
->
errorCode
==
0
)
{
jam
();
jam
();
FsAppendReq
*
req
=
(
FsAppendReq
*
)
signal
->
getDataPtrSend
();
FsAppendReq
*
req
=
(
FsAppendReq
*
)
signal
->
getDataPtrSend
();
req
->
filePointer
=
filePtr
.
p
->
filePointer
;
req
->
filePointer
=
filePtr
.
p
->
filePointer
;
req
->
userPointer
=
filePtr
.
i
;
req
->
userPointer
=
filePtr
.
i
;
req
->
userReference
=
reference
();
req
->
userReference
=
reference
();
req
->
varIndex
=
0
;
req
->
varIndex
=
0
;
req
->
offset
=
tmp
-
c_startOfPages
;
req
->
offset
=
tmp
-
c_startOfPages
;
req
->
size
=
sz
;
req
->
size
=
sz
;
sendSignal
(
NDBFS_REF
,
GSN_FSAPPENDREQ
,
signal
,
sendSignal
(
NDBFS_REF
,
GSN_FSAPPENDREQ
,
signal
,
FsAppendReq
::
SignalLength
,
JBA
);
FsAppendReq
::
SignalLength
,
JBA
);
return
;
return
;
}
}
else
{
jam
();
if
(
filePtr
.
p
->
scanRunning
==
1
)
eof
=
false
;
}
//if
}
//if
if
(
!
eof
)
{
if
(
!
eof
)
{
jam
();
jam
();
...
@@ -3794,9 +3706,7 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
...
@@ -3794,9 +3706,7 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
return
;
return
;
}
//if
}
//if
ndbrequire
(
filePtr
.
p
->
fileDone
==
1
);
if
(
sz
>
0
)
{
if
(
sz
>
0
&&
filePtr
.
p
->
errorCode
==
0
)
{
jam
();
jam
();
FsAppendReq
*
req
=
(
FsAppendReq
*
)
signal
->
getDataPtrSend
();
FsAppendReq
*
req
=
(
FsAppendReq
*
)
signal
->
getDataPtrSend
();
req
->
filePointer
=
filePtr
.
p
->
filePointer
;
req
->
filePointer
=
filePtr
.
p
->
filePointer
;
...
@@ -3812,6 +3722,7 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
...
@@ -3812,6 +3722,7 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
}
//if
}
//if
filePtr
.
p
->
fileRunning
=
0
;
filePtr
.
p
->
fileRunning
=
0
;
filePtr
.
p
->
fileClosing
=
1
;
FsCloseReq
*
req
=
(
FsCloseReq
*
)
signal
->
getDataPtrSend
();
FsCloseReq
*
req
=
(
FsCloseReq
*
)
signal
->
getDataPtrSend
();
req
->
filePointer
=
filePtr
.
p
->
filePointer
;
req
->
filePointer
=
filePtr
.
p
->
filePointer
;
...
@@ -3819,64 +3730,11 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
...
@@ -3819,64 +3730,11 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
req
->
userReference
=
reference
();
req
->
userReference
=
reference
();
req
->
fileFlag
=
0
;
req
->
fileFlag
=
0
;
#ifdef DEBUG_ABORT
#ifdef DEBUG_ABORT
ndbout_c
(
"***** FSCLOSEREQ filePtr.i = %u"
,
filePtr
.
i
);
ndbout_c
(
"*****
a
FSCLOSEREQ filePtr.i = %u"
,
filePtr
.
i
);
#endif
#endif
sendSignal
(
NDBFS_REF
,
GSN_FSCLOSEREQ
,
signal
,
FsCloseReq
::
SignalLength
,
JBA
);
sendSignal
(
NDBFS_REF
,
GSN_FSCLOSEREQ
,
signal
,
FsCloseReq
::
SignalLength
,
JBA
);
}
}
void
Backup
::
abortFile
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
BackupFilePtr
filePtr
)
{
jam
();
if
(
ptr
.
p
->
slaveState
.
getState
()
!=
ABORTING
)
{
/**
* Inform master of failure
*/
jam
();
ptr
.
p
->
slaveState
.
setState
(
ABORTING
);
ptr
.
p
->
setErrorCode
(
AbortBackupOrd
::
FileOrScanError
);
sendAbortBackupOrdSlave
(
signal
,
ptr
,
AbortBackupOrd
::
FileOrScanError
);
return
;
}
//if
for
(
ptr
.
p
->
files
.
first
(
filePtr
);
filePtr
.
i
!=
RNIL
;
ptr
.
p
->
files
.
next
(
filePtr
)){
jam
();
filePtr
.
p
->
errorCode
=
1
;
}
//for
closeFiles
(
signal
,
ptr
);
}
void
Backup
::
abortFileHook
(
Signal
*
signal
,
BackupFilePtr
filePtr
,
bool
scanComplete
)
{
jam
();
if
(
!
scanComplete
)
{
jam
();
ScanFragNextReq
*
req
=
(
ScanFragNextReq
*
)
signal
->
getDataPtrSend
();
req
->
senderData
=
filePtr
.
i
;
req
->
closeFlag
=
1
;
req
->
transId1
=
0
;
req
->
transId2
=
(
BACKUP
<<
20
)
+
(
getOwnNodeId
()
<<
8
);
sendSignal
(
DBLQH_REF
,
GSN_SCAN_NEXTREQ
,
signal
,
ScanFragNextReq
::
SignalLength
,
JBB
);
return
;
}
//if
filePtr
.
p
->
scanRunning
=
0
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
filePtr
.
p
->
backupPtr
);
filePtr
.
i
=
RNIL
;
abortFile
(
signal
,
ptr
,
filePtr
);
}
/****************************************************************************
/****************************************************************************
*
*
...
@@ -3953,27 +3811,30 @@ Backup::execTRIG_ATTRINFO(Signal* signal) {
...
@@ -3953,27 +3811,30 @@ Backup::execTRIG_ATTRINFO(Signal* signal) {
}
//if
}
//if
BackupFormat
::
LogFile
::
LogEntry
*
logEntry
=
trigPtr
.
p
->
logEntry
;
BackupFormat
::
LogFile
::
LogEntry
*
logEntry
=
trigPtr
.
p
->
logEntry
;
if
(
logEntry
==
0
)
{
if
(
logEntry
==
0
)
{
jam
();
jam
();
Uint32
*
dst
;
Uint32
*
dst
;
FsBuffer
&
buf
=
trigPtr
.
p
->
operation
->
dataBuffer
;
FsBuffer
&
buf
=
trigPtr
.
p
->
operation
->
dataBuffer
;
ndbrequire
(
trigPtr
.
p
->
maxRecordSize
<=
buf
.
getMaxWrite
());
ndbrequire
(
trigPtr
.
p
->
maxRecordSize
<=
buf
.
getMaxWrite
());
BackupRecordPtr
ptr
;
if
(
ERROR_INSERTED
(
10030
)
||
c_backupPool
.
getPtr
(
ptr
,
trigPtr
.
p
->
backupPtr
);
!
buf
.
getWritePtr
(
&
dst
,
trigPtr
.
p
->
maxRecordSize
))
if
(
!
buf
.
getWritePtr
(
&
dst
,
trigPtr
.
p
->
maxRecordSize
))
{
{
jam
();
jam
();
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
trigPtr
.
p
->
backupPtr
);
trigPtr
.
p
->
errorCode
=
AbortBackupOrd
::
LogBufferFull
;
trigPtr
.
p
->
errorCode
=
AbortBackupOrd
::
LogBufferFull
;
sendAbortBackupOrdSlave
(
signal
,
ptr
,
AbortBackupOrd
::
LogBufferFull
);
AbortBackupOrd
*
ord
=
(
AbortBackupOrd
*
)
signal
->
getDataPtrSend
(
);
return
;
ord
->
backupId
=
ptr
.
p
->
backupId
;
}
//if
ord
->
backupPtr
=
ptr
.
i
;
if
(
trigPtr
.
p
->
operation
->
noOfBytes
>
123
&&
ERROR_INSERTED
(
10030
))
{
ord
->
requestType
=
AbortBackupOrd
::
LogBufferFull
;
jam
()
;
ord
->
senderData
=
ptr
.
i
;
trigPtr
.
p
->
errorCode
=
AbortBackupOrd
::
LogBufferFull
;
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_ABORT_BACKUP_ORD
,
signal
,
sendAbortBackupOrdSlave
(
signal
,
ptr
,
AbortBackupOrd
::
LogBufferFull
);
AbortBackupOrd
::
SignalLength
,
JBB
);
return
;
return
;
}
//if
}
//if
logEntry
=
(
BackupFormat
::
LogFile
::
LogEntry
*
)
dst
;
logEntry
=
(
BackupFormat
::
LogFile
::
LogEntry
*
)
dst
;
trigPtr
.
p
->
logEntry
=
logEntry
;
trigPtr
.
p
->
logEntry
=
logEntry
;
logEntry
->
Length
=
0
;
logEntry
->
Length
=
0
;
...
@@ -4015,9 +3876,10 @@ Backup::execFIRE_TRIG_ORD(Signal* signal)
...
@@ -4015,9 +3876,10 @@ Backup::execFIRE_TRIG_ORD(Signal* signal)
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
trigPtr
.
p
->
backupPtr
);
c_backupPool
.
getPtr
(
ptr
,
trigPtr
.
p
->
backupPtr
);
if
(
gci
!=
ptr
.
p
->
currGCP
)
{
if
(
gci
!=
ptr
.
p
->
currGCP
)
{
jam
();
jam
();
trigPtr
.
p
->
logEntry
->
TriggerEvent
=
htonl
(
trigPtr
.
p
->
event
|
0x10000
);
trigPtr
.
p
->
logEntry
->
TriggerEvent
=
htonl
(
trigPtr
.
p
->
event
|
0x10000
);
trigPtr
.
p
->
logEntry
->
Data
[
len
]
=
htonl
(
gci
);
trigPtr
.
p
->
logEntry
->
Data
[
len
]
=
htonl
(
gci
);
len
++
;
len
++
;
...
@@ -4035,20 +3897,6 @@ Backup::execFIRE_TRIG_ORD(Signal* signal)
...
@@ -4035,20 +3897,6 @@ Backup::execFIRE_TRIG_ORD(Signal* signal)
trigPtr
.
p
->
operation
->
noOfRecords
+=
1
;
trigPtr
.
p
->
operation
->
noOfRecords
+=
1
;
}
}
void
Backup
::
sendAbortBackupOrdSlave
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Uint32
requestType
)
{
jam
();
AbortBackupOrd
*
ord
=
(
AbortBackupOrd
*
)
signal
->
getDataPtrSend
();
ord
->
backupId
=
ptr
.
p
->
backupId
;
ord
->
backupPtr
=
ptr
.
i
;
ord
->
requestType
=
requestType
;
ord
->
senderData
=
ptr
.
i
;
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_ABORT_BACKUP_ORD
,
signal
,
AbortBackupOrd
::
SignalLength
,
JBB
);
}
void
void
Backup
::
sendAbortBackupOrd
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Backup
::
sendAbortBackupOrd
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Uint32
requestType
)
Uint32
requestType
)
...
@@ -4085,7 +3933,7 @@ Backup::execSTOP_BACKUP_REQ(Signal* signal)
...
@@ -4085,7 +3933,7 @@ Backup::execSTOP_BACKUP_REQ(Signal* signal)
CRASH_INSERTION
((
10020
));
CRASH_INSERTION
((
10020
));
const
Uint32
ptrI
=
req
->
backupPtr
;
const
Uint32
ptrI
=
req
->
backupPtr
;
const
Uint32
backupId
=
req
->
backupId
;
//
const Uint32 backupId = req->backupId;
const
Uint32
startGCP
=
req
->
startGCP
;
const
Uint32
startGCP
=
req
->
startGCP
;
const
Uint32
stopGCP
=
req
->
stopGCP
;
const
Uint32
stopGCP
=
req
->
stopGCP
;
...
@@ -4101,7 +3949,7 @@ Backup::execSTOP_BACKUP_REQ(Signal* signal)
...
@@ -4101,7 +3949,7 @@ Backup::execSTOP_BACKUP_REQ(Signal* signal)
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
ptr
.
p
->
slaveState
.
setState
(
STOPPING
);
ptr
.
p
->
slaveState
.
setState
(
STOPPING
);
slaveAbortCheck
();
// macro will do return if ABORTING
ptr
.
p
->
m_gsn
=
GSN_STOP_BACKUP_REQ
;
/**
/**
* Insert footers
* Insert footers
...
@@ -4140,12 +3988,6 @@ Backup::execSTOP_BACKUP_REQ(Signal* signal)
...
@@ -4140,12 +3988,6 @@ Backup::execSTOP_BACKUP_REQ(Signal* signal)
void
void
Backup
::
closeFiles
(
Signal
*
sig
,
BackupRecordPtr
ptr
)
Backup
::
closeFiles
(
Signal
*
sig
,
BackupRecordPtr
ptr
)
{
{
if
(
ptr
.
p
->
closingFiles
)
{
jam
();
return
;
}
ptr
.
p
->
closingFiles
=
true
;
/**
/**
* Close all files
* Close all files
*/
*/
...
@@ -4161,12 +4003,12 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr)
...
@@ -4161,12 +4003,12 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr)
jam
();
jam
();
openCount
++
;
openCount
++
;
if
(
filePtr
.
p
->
file
Done
==
1
){
if
(
filePtr
.
p
->
file
Closing
==
1
){
jam
();
jam
();
continue
;
continue
;
}
//if
}
//if
filePtr
.
p
->
file
Done
=
1
;
filePtr
.
p
->
file
Closing
=
1
;
if
(
filePtr
.
p
->
fileRunning
==
1
){
if
(
filePtr
.
p
->
fileRunning
==
1
){
jam
();
jam
();
...
@@ -4183,7 +4025,7 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr)
...
@@ -4183,7 +4025,7 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr)
req
->
userReference
=
reference
();
req
->
userReference
=
reference
();
req
->
fileFlag
=
0
;
req
->
fileFlag
=
0
;
#ifdef DEBUG_ABORT
#ifdef DEBUG_ABORT
ndbout_c
(
"***** FSCLOSEREQ filePtr.i = %u"
,
filePtr
.
i
);
ndbout_c
(
"*****
b
FSCLOSEREQ filePtr.i = %u"
,
filePtr
.
i
);
#endif
#endif
sendSignal
(
NDBFS_REF
,
GSN_FSCLOSEREQ
,
sig
,
sendSignal
(
NDBFS_REF
,
GSN_FSCLOSEREQ
,
sig
,
FsCloseReq
::
SignalLength
,
JBA
);
FsCloseReq
::
SignalLength
,
JBA
);
...
@@ -4210,11 +4052,6 @@ Backup::execFSCLOSEREF(Signal* signal)
...
@@ -4210,11 +4052,6 @@ Backup::execFSCLOSEREF(Signal* signal)
BackupRecordPtr
ptr
;
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
filePtr
.
p
->
backupPtr
);
c_backupPool
.
getPtr
(
ptr
,
filePtr
.
p
->
backupPtr
);
/**
* This should only happen during abort of backup
*/
ndbrequire
(
ptr
.
p
->
slaveState
.
getState
()
==
ABORTING
);
filePtr
.
p
->
fileOpened
=
1
;
filePtr
.
p
->
fileOpened
=
1
;
FsConf
*
conf
=
(
FsConf
*
)
signal
->
getDataPtr
();
FsConf
*
conf
=
(
FsConf
*
)
signal
->
getDataPtr
();
conf
->
userPointer
=
filePtrI
;
conf
->
userPointer
=
filePtrI
;
...
@@ -4237,7 +4074,7 @@ Backup::execFSCLOSECONF(Signal* signal)
...
@@ -4237,7 +4074,7 @@ Backup::execFSCLOSECONF(Signal* signal)
ndbout_c
(
"***** FSCLOSECONF filePtrI = %u"
,
filePtrI
);
ndbout_c
(
"***** FSCLOSECONF filePtrI = %u"
,
filePtrI
);
#endif
#endif
ndbrequire
(
filePtr
.
p
->
file
Done
==
1
);
ndbrequire
(
filePtr
.
p
->
file
Closing
==
1
);
ndbrequire
(
filePtr
.
p
->
fileOpened
==
1
);
ndbrequire
(
filePtr
.
p
->
fileOpened
==
1
);
ndbrequire
(
filePtr
.
p
->
fileRunning
==
0
);
ndbrequire
(
filePtr
.
p
->
fileRunning
==
0
);
ndbrequire
(
filePtr
.
p
->
scanRunning
==
0
);
ndbrequire
(
filePtr
.
p
->
scanRunning
==
0
);
...
@@ -4265,25 +4102,20 @@ Backup::closeFilesDone(Signal* signal, BackupRecordPtr ptr)
...
@@ -4265,25 +4102,20 @@ Backup::closeFilesDone(Signal* signal, BackupRecordPtr ptr)
{
{
jam
();
jam
();
if
(
ptr
.
p
->
slaveState
.
getState
()
==
STOPPING
)
{
jam
();
jam
();
BackupFilePtr
filePtr
;
BackupFilePtr
filePtr
;
ptr
.
p
->
files
.
getPtr
(
filePtr
,
ptr
.
p
->
logFilePtr
);
ptr
.
p
->
files
.
getPtr
(
filePtr
,
ptr
.
p
->
logFilePtr
);
StopBackupConf
*
conf
=
(
StopBackupConf
*
)
signal
->
getDataPtrSend
();
conf
->
backupId
=
ptr
.
p
->
backupId
;
conf
->
backupPtr
=
ptr
.
i
;
conf
->
noOfLogBytes
=
filePtr
.
p
->
operation
.
noOfBytes
;
conf
->
noOfLogRecords
=
filePtr
.
p
->
operation
.
noOfRecords
;
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_STOP_BACKUP_CONF
,
signal
,
StopBackupConf
::
SignalLength
,
JBB
);
ptr
.
p
->
slaveState
.
setState
(
CLEANING
);
return
;
}
//if
ndbrequire
(
ptr
.
p
->
slaveState
.
getState
()
==
ABORTING
);
StopBackupConf
*
conf
=
(
StopBackupConf
*
)
signal
->
getDataPtrSend
();
removeBackup
(
signal
,
ptr
);
conf
->
backupId
=
ptr
.
p
->
backupId
;
conf
->
backupPtr
=
ptr
.
i
;
conf
->
noOfLogBytes
=
filePtr
.
p
->
operation
.
noOfBytes
;
conf
->
noOfLogRecords
=
filePtr
.
p
->
operation
.
noOfRecords
;
sendSignal
(
ptr
.
p
->
masterRef
,
GSN_STOP_BACKUP_CONF
,
signal
,
StopBackupConf
::
SignalLength
,
JBB
);
ptr
.
p
->
m_gsn
=
GSN_STOP_BACKUP_CONF
;
ptr
.
p
->
slaveState
.
setState
(
CLEANING
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -4291,57 +4123,6 @@ Backup::closeFilesDone(Signal* signal, BackupRecordPtr ptr)
...
@@ -4291,57 +4123,6 @@ Backup::closeFilesDone(Signal* signal, BackupRecordPtr ptr)
* Slave functionallity: Abort backup
* Slave functionallity: Abort backup
*
*
*****************************************************************************/
*****************************************************************************/
void
Backup
::
removeBackup
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
{
jam
();
FsRemoveReq
*
req
=
(
FsRemoveReq
*
)
signal
->
getDataPtrSend
();
req
->
userReference
=
reference
();
req
->
userPointer
=
ptr
.
i
;
req
->
directory
=
1
;
req
->
ownDirectory
=
1
;
FsOpenReq
::
setVersion
(
req
->
fileNumber
,
2
);
FsOpenReq
::
setSuffix
(
req
->
fileNumber
,
FsOpenReq
::
S_CTL
);
FsOpenReq
::
v2_setSequence
(
req
->
fileNumber
,
ptr
.
p
->
backupId
);
FsOpenReq
::
v2_setNodeId
(
req
->
fileNumber
,
getOwnNodeId
());
sendSignal
(
NDBFS_REF
,
GSN_FSREMOVEREQ
,
signal
,
FsRemoveReq
::
SignalLength
,
JBA
);
}
void
Backup
::
execFSREMOVEREF
(
Signal
*
signal
)
{
jamEntry
();
ndbrequire
(
0
);
}
void
Backup
::
execFSREMOVECONF
(
Signal
*
signal
){
jamEntry
();
FsConf
*
conf
=
(
FsConf
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
conf
->
userPointer
;
/**
* Get backup record
*/
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
ndbrequire
(
ptr
.
p
->
slaveState
.
getState
()
==
ABORTING
);
if
(
ptr
.
p
->
masterRef
==
reference
())
{
if
(
ptr
.
p
->
masterData
.
state
.
getAbortState
()
==
DEFINING
)
{
jam
();
sendBackupRef
(
signal
,
ptr
,
ptr
.
p
->
errorCode
);
return
;
}
else
{
jam
();
}
//if
}
//if
cleanupSlaveResources
(
ptr
);
}
/*****************************************************************************
/*****************************************************************************
*
*
* Slave functionallity: Abort backup
* Slave functionallity: Abort backup
...
@@ -4394,8 +4175,7 @@ Backup::execABORT_BACKUP_ORD(Signal* signal)
...
@@ -4394,8 +4175,7 @@ Backup::execABORT_BACKUP_ORD(Signal* signal)
if
(
c_backupPool
.
findId
(
senderData
))
{
if
(
c_backupPool
.
findId
(
senderData
))
{
jam
();
jam
();
c_backupPool
.
getPtr
(
ptr
,
senderData
);
c_backupPool
.
getPtr
(
ptr
,
senderData
);
}
else
{
// TODO might be abort sent to not master,
}
else
{
// or master aborting too early
jam
();
jam
();
#ifdef DEBUG_ABORT
#ifdef DEBUG_ABORT
ndbout_c
(
"Backup: abort request type=%u on id=%u,%u not found"
,
ndbout_c
(
"Backup: abort request type=%u on id=%u,%u not found"
,
...
@@ -4405,15 +4185,15 @@ Backup::execABORT_BACKUP_ORD(Signal* signal)
...
@@ -4405,15 +4185,15 @@ Backup::execABORT_BACKUP_ORD(Signal* signal)
}
}
}
//if
}
//if
ptr
.
p
->
m_gsn
=
GSN_ABORT_BACKUP_ORD
;
const
bool
isCoordinator
=
(
ptr
.
p
->
masterRef
==
reference
());
const
bool
isCoordinator
=
(
ptr
.
p
->
masterRef
==
reference
());
bool
ok
=
false
;
bool
ok
=
false
;
switch
(
requestType
){
switch
(
requestType
){
/**
/**
* Requests sent to master
* Requests sent to master
*/
*/
case
AbortBackupOrd
:
:
ClientAbort
:
case
AbortBackupOrd
:
:
ClientAbort
:
jam
();
jam
();
// fall through
// fall through
...
@@ -4422,113 +4202,61 @@ Backup::execABORT_BACKUP_ORD(Signal* signal)
...
@@ -4422,113 +4202,61 @@ Backup::execABORT_BACKUP_ORD(Signal* signal)
// fall through
// fall through
case
AbortBackupOrd
:
:
FileOrScanError
:
case
AbortBackupOrd
:
:
FileOrScanError
:
jam
();
jam
();
if
(
ptr
.
p
->
masterData
.
state
.
getState
()
==
ABORTING
)
{
ndbrequire
(
isCoordinator
);
#ifdef DEBUG_ABORT
ndbout_c
(
"---- Already aborting"
);
#endif
jam
();
return
;
}
ptr
.
p
->
setErrorCode
(
requestType
);
ptr
.
p
->
setErrorCode
(
requestType
);
ndbrequire
(
isCoordinator
);
// Sent from slave to coordinator
if
(
ptr
.
p
->
masterData
.
gsn
==
GSN_BACKUP_FRAGMENT_REQ
)
masterAbort
(
signal
,
ptr
,
false
);
{
/**
* Only scans are actively aborted
*/
abort_scan
(
signal
,
ptr
);
}
return
;
return
;
/**
/**
*
Info
sent to slave
*
Requests
sent to slave
*/
*/
case
AbortBackupOrd
:
:
AbortScan
:
case
AbortBackupOrd
:
:
OkToClean
:
jam
();
jam
();
cleanupMasterResources
(
ptr
);
ptr
.
p
->
setErrorCode
(
requestType
);
return
;
return
;
/**
* Requests sent to slave
*/
case
AbortBackupOrd
:
:
BackupComplete
:
case
AbortBackupOrd
:
:
BackupComplete
:
jam
();
jam
();
if
(
ptr
.
p
->
slaveState
.
getState
()
==
CLEANING
)
{
// TODO what if state is
cleanup
(
signal
,
ptr
);
// not CLEANING?
jam
();
cleanupSlaveResources
(
ptr
);
}
//if
return
;
return
;
break
;
case
AbortBackupOrd
:
:
BackupFailureDueToNodeFail
:
jam
();
ok
=
true
;
if
(
ptr
.
p
->
errorCode
!=
0
)
ptr
.
p
->
setErrorCode
(
requestType
);
break
;
case
AbortBackupOrd
:
:
BackupFailure
:
case
AbortBackupOrd
:
:
BackupFailure
:
jam
();
case
AbortBackupOrd
:
:
BackupFailureDueToNodeFail
:
ok
=
true
;
case
AbortBackupOrd
:
:
OkToClean
:
break
;
case
AbortBackupOrd
:
:
IncompatibleVersions
:
#ifndef VM_TRACE
default:
#endif
ptr
.
p
->
setErrorCode
(
requestType
);
ok
=
true
;
}
}
ndbrequire
(
ok
);
ndbrequire
(
ok
);
/**
Uint32
ref
=
ptr
.
p
->
masterRef
;
* Slave abort
ptr
.
p
->
masterRef
=
reference
();
*/
ptr
.
p
->
nodes
.
clear
();
slaveAbort
(
signal
,
ptr
);
ptr
.
p
->
nodes
.
set
(
getOwnNodeId
());
}
if
(
ref
==
reference
())
void
{
Backup
::
slaveAbort
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
ptr
.
p
->
stopGCP
=
ptr
.
p
->
startGCP
+
1
;
{
sendDropTrig
(
signal
,
ptr
);
if
(
ptr
.
p
->
slaveState
.
getState
()
==
ABORTING
)
{
#ifdef DEBUG_ABORT
ndbout_c
(
"---- Slave already aborting"
);
#endif
jam
();
return
;
}
}
#ifdef DEBUG_ABORT
else
ndbout_c
(
"************* slaveAbort"
);
{
#endif
ptr
.
p
->
masterData
.
gsn
=
GSN_STOP_BACKUP_REQ
;
ptr
.
p
->
masterData
.
sendCounter
.
clearWaitingFor
();
State
slaveState
=
ptr
.
p
->
slaveState
.
getState
();
ptr
.
p
->
masterData
.
sendCounter
.
setWaitingFor
(
getOwnNodeId
());
ptr
.
p
->
slaveState
.
setState
(
ABORTING
);
switch
(
slaveState
)
{
case
DEFINING
:
jam
();
return
;
//------------------------------------------
// Will watch for the abort at various places
// in the defining phase.
//------------------------------------------
case
ABORTING
:
jam
();
//Fall through
case
DEFINED
:
jam
();
//Fall through
case
STOPPING
:
jam
();
closeFiles
(
signal
,
ptr
);
closeFiles
(
signal
,
ptr
);
return
;
case
STARTED
:
jam
();
//Fall through
case
SCANNING
:
jam
();
BackupFilePtr
filePtr
;
filePtr
.
i
=
RNIL
;
abortFile
(
signal
,
ptr
,
filePtr
);
return
;
case
CLEANING
:
jam
();
cleanupSlaveResources
(
ptr
);
return
;
case
INITIAL
:
jam
();
ndbrequire
(
false
);
return
;
}
}
}
}
void
void
Backup
::
dumpUsedResources
()
Backup
::
dumpUsedResources
()
{
{
...
@@ -4576,12 +4304,8 @@ Backup::dumpUsedResources()
...
@@ -4576,12 +4304,8 @@ Backup::dumpUsedResources()
}
}
void
void
Backup
::
cleanup
MasterResources
(
BackupRecordPtr
ptr
)
Backup
::
cleanup
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
{
{
#ifdef DEBUG_ABORT
ndbout_c
(
"******** Cleanup Master Resources *********"
);
ndbout_c
(
"backupId = %u, errorCode = %u"
,
ptr
.
p
->
backupId
,
ptr
.
p
->
errorCode
);
#endif
TablePtr
tabPtr
;
TablePtr
tabPtr
;
for
(
ptr
.
p
->
tables
.
first
(
tabPtr
);
tabPtr
.
i
!=
RNIL
;
ptr
.
p
->
tables
.
next
(
tabPtr
))
for
(
ptr
.
p
->
tables
.
first
(
tabPtr
);
tabPtr
.
i
!=
RNIL
;
ptr
.
p
->
tables
.
next
(
tabPtr
))
...
@@ -4601,20 +4325,6 @@ Backup::cleanupMasterResources(BackupRecordPtr ptr)
...
@@ -4601,20 +4325,6 @@ Backup::cleanupMasterResources(BackupRecordPtr ptr)
tabPtr
.
p
->
triggerIds
[
j
]
=
ILLEGAL_TRIGGER_ID
;
tabPtr
.
p
->
triggerIds
[
j
]
=
ILLEGAL_TRIGGER_ID
;
}
//for
}
//for
}
//for
}
//for
ptr
.
p
->
tables
.
release
();
ptr
.
p
->
triggers
.
release
();
ptr
.
p
->
okToCleanMaster
=
true
;
cleanupFinalResources
(
ptr
);
}
void
Backup
::
cleanupSlaveResources
(
BackupRecordPtr
ptr
)
{
#ifdef DEBUG_ABORT
ndbout_c
(
"******** Clean Up Slave Resources*********"
);
ndbout_c
(
"backupId = %u, errorCode = %u"
,
ptr
.
p
->
backupId
,
ptr
.
p
->
errorCode
);
#endif
BackupFilePtr
filePtr
;
BackupFilePtr
filePtr
;
for
(
ptr
.
p
->
files
.
first
(
filePtr
);
for
(
ptr
.
p
->
files
.
first
(
filePtr
);
...
@@ -4626,35 +4336,65 @@ Backup::cleanupSlaveResources(BackupRecordPtr ptr)
...
@@ -4626,35 +4336,65 @@ Backup::cleanupSlaveResources(BackupRecordPtr ptr)
ndbrequire
(
filePtr
.
p
->
scanRunning
==
0
);
ndbrequire
(
filePtr
.
p
->
scanRunning
==
0
);
filePtr
.
p
->
pages
.
release
();
filePtr
.
p
->
pages
.
release
();
}
//for
}
//for
ptr
.
p
->
files
.
release
();
ptr
.
p
->
files
.
release
();
ptr
.
p
->
tables
.
release
();
ptr
.
p
->
triggers
.
release
();
cleanupFinalResources
(
ptr
);
ptr
.
p
->
tables
.
release
();
ptr
.
p
->
triggers
.
release
();
ptr
.
p
->
pages
.
release
();
ptr
.
p
->
backupId
=
~
0
;
if
(
ptr
.
p
->
checkError
())
removeBackup
(
signal
,
ptr
);
else
c_backups
.
release
(
ptr
);
}
}
void
void
Backup
::
cleanupFinalResources
(
BackupRecordPtr
ptr
)
Backup
::
removeBackup
(
Signal
*
signal
,
BackupRecordPtr
ptr
)
{
{
#ifdef DEBUG_ABORT
jam
();
ndbout_c
(
"******** Clean Up Final Resources*********"
);
ndbout_c
(
"backupId = %u, errorCode = %u"
,
ptr
.
p
->
backupId
,
ptr
.
p
->
errorCode
);
FsRemoveReq
*
req
=
(
FsRemoveReq
*
)
signal
->
getDataPtrSend
();
#endif
req
->
userReference
=
reference
();
req
->
userPointer
=
ptr
.
i
;
req
->
directory
=
1
;
req
->
ownDirectory
=
1
;
FsOpenReq
::
setVersion
(
req
->
fileNumber
,
2
);
FsOpenReq
::
setSuffix
(
req
->
fileNumber
,
FsOpenReq
::
S_CTL
);
FsOpenReq
::
v2_setSequence
(
req
->
fileNumber
,
ptr
.
p
->
backupId
);
FsOpenReq
::
v2_setNodeId
(
req
->
fileNumber
,
getOwnNodeId
());
sendSignal
(
NDBFS_REF
,
GSN_FSREMOVEREQ
,
signal
,
FsRemoveReq
::
SignalLength
,
JBA
);
}
// if (!ptr.p->tables.empty() || !ptr.p->files.empty()) {
void
if
(
!
ptr
.
p
->
okToCleanMaster
||
!
ptr
.
p
->
files
.
empty
())
{
Backup
::
execFSREMOVEREF
(
Signal
*
signal
)
jam
();
{
#ifdef DEBUG_ABORT
jamEntry
();
ndbout_c
(
"******** Waiting to do final cleanup"
);
FsRef
*
ref
=
(
FsRef
*
)
signal
->
getDataPtr
();
#endif
const
Uint32
ptrI
=
ref
->
userPointer
;
return
;
}
FsConf
*
conf
=
(
FsConf
*
)
signal
->
getDataPtr
();
ptr
.
p
->
pages
.
release
();
conf
->
userPointer
=
ptrI
;
ptr
.
p
->
masterData
.
state
.
setState
(
INITIAL
);
execFSREMOVECONF
(
signal
);
ptr
.
p
->
slaveState
.
setState
(
INITIAL
);
}
ptr
.
p
->
backupId
=
0
;
ptr
.
p
->
closingFiles
=
false
;
void
ptr
.
p
->
okToCleanMaster
=
true
;
Backup
::
execFSREMOVECONF
(
Signal
*
signal
){
jamEntry
();
FsConf
*
conf
=
(
FsConf
*
)
signal
->
getDataPtr
();
const
Uint32
ptrI
=
conf
->
userPointer
;
/**
* Get backup record
*/
BackupRecordPtr
ptr
;
c_backupPool
.
getPtr
(
ptr
,
ptrI
);
c_backups
.
release
(
ptr
);
c_backups
.
release
(
ptr
);
// ndbrequire(false);
}
}
ndb/src/kernel/blocks/backup/Backup.hpp
View file @
2ce7824e
...
@@ -232,6 +232,7 @@ public:
...
@@ -232,6 +232,7 @@ public:
*/
*/
bool
newScan
();
bool
newScan
();
bool
scanConf
(
Uint32
noOfOps
,
Uint32
opLen
);
bool
scanConf
(
Uint32
noOfOps
,
Uint32
opLen
);
bool
closeScan
();
/**
/**
* Per record
* Per record
...
@@ -330,7 +331,7 @@ public:
...
@@ -330,7 +331,7 @@ public:
Uint8
fileOpened
;
Uint8
fileOpened
;
Uint8
fileRunning
;
Uint8
fileRunning
;
Uint8
file
Done
;
Uint8
file
Closing
;
Uint8
scanRunning
;
Uint8
scanRunning
;
};
};
typedef
Ptr
<
BackupFile
>
BackupFilePtr
;
typedef
Ptr
<
BackupFile
>
BackupFilePtr
;
...
@@ -403,13 +404,11 @@ public:
...
@@ -403,13 +404,11 @@ public:
ArrayPool
<
TriggerRecord
>
&
trp
)
ArrayPool
<
TriggerRecord
>
&
trp
)
:
slaveState
(
b
,
validSlaveTransitions
,
validSlaveTransitionsCount
,
1
)
:
slaveState
(
b
,
validSlaveTransitions
,
validSlaveTransitionsCount
,
1
)
,
tables
(
tp
),
triggers
(
trp
),
files
(
bp
),
pages
(
pp
)
,
tables
(
tp
),
triggers
(
trp
),
files
(
bp
),
pages
(
pp
)
,
masterData
(
b
,
validMasterTransitions
,
validMasterTransitionsCount
)
,
masterData
(
b
),
backup
(
b
)
,
backup
(
b
)
{
{
}
closingFiles
=
false
;
okToCleanMaster
=
true
;
}
Uint32
m_gsn
;
CompoundState
slaveState
;
CompoundState
slaveState
;
Uint32
clientRef
;
Uint32
clientRef
;
...
@@ -420,9 +419,6 @@ public:
...
@@ -420,9 +419,6 @@ public:
Uint32
errorCode
;
Uint32
errorCode
;
NdbNodeBitmask
nodes
;
NdbNodeBitmask
nodes
;
bool
okToCleanMaster
;
bool
closingFiles
;
Uint64
noOfBytes
;
Uint64
noOfBytes
;
Uint64
noOfRecords
;
Uint64
noOfRecords
;
Uint64
noOfLogBytes
;
Uint64
noOfLogBytes
;
...
@@ -444,15 +440,13 @@ public:
...
@@ -444,15 +440,13 @@ public:
SimpleProperties
props
;
// Used for (un)packing backup request
SimpleProperties
props
;
// Used for (un)packing backup request
struct
MasterData
{
struct
MasterData
{
MasterData
(
Backup
&
b
,
const
State
valid
[],
Uint32
count
)
MasterData
(
Backup
&
b
)
:
state
(
b
,
valid
,
count
,
0
)
{
{
}
}
MutexHandle2
<
BACKUP_DEFINE_MUTEX
>
m_defineBackupMutex
;
MutexHandle2
<
BACKUP_DEFINE_MUTEX
>
m_defineBackupMutex
;
MutexHandle2
<
DICT_COMMIT_TABLE_MUTEX
>
m_dictCommitTableMutex
;
MutexHandle2
<
DICT_COMMIT_TABLE_MUTEX
>
m_dictCommitTableMutex
;
Uint32
gsn
;
Uint32
gsn
;
CompoundState
state
;
SignalCounter
sendCounter
;
SignalCounter
sendCounter
;
Uint32
errorCode
;
Uint32
errorCode
;
struct
{
struct
{
...
@@ -557,7 +551,8 @@ public:
...
@@ -557,7 +551,8 @@ public:
void
stopBackupReply
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Uint32
nodeId
);
void
stopBackupReply
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Uint32
nodeId
);
void
defineBackupRef
(
Signal
*
,
BackupRecordPtr
,
Uint32
errCode
=
0
);
void
defineBackupRef
(
Signal
*
,
BackupRecordPtr
,
Uint32
errCode
=
0
);
void
backupFragmentRef
(
Signal
*
signal
,
BackupFilePtr
filePtr
);
void
nextFragment
(
Signal
*
,
BackupRecordPtr
);
void
nextFragment
(
Signal
*
,
BackupRecordPtr
);
void
sendCreateTrig
(
Signal
*
,
BackupRecordPtr
ptr
,
TablePtr
tabPtr
);
void
sendCreateTrig
(
Signal
*
,
BackupRecordPtr
ptr
,
TablePtr
tabPtr
);
...
@@ -578,14 +573,14 @@ public:
...
@@ -578,14 +573,14 @@ public:
void
sendAbortBackupOrd
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Uint32
errCode
);
void
sendAbortBackupOrd
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Uint32
errCode
);
void
sendAbortBackupOrdSlave
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
void
sendAbortBackupOrdSlave
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
Uint32
errCode
);
Uint32
errCode
);
void
masterAbort
(
Signal
*
,
BackupRecordPtr
ptr
,
bool
controlledAbort
);
void
masterAbort
(
Signal
*
,
BackupRecordPtr
ptr
);
void
masterSendAbortBackup
(
Signal
*
,
BackupRecordPtr
ptr
);
void
masterSendAbortBackup
(
Signal
*
,
BackupRecordPtr
ptr
);
void
slaveAbort
(
Signal
*
,
BackupRecordPtr
ptr
);
void
slaveAbort
(
Signal
*
,
BackupRecordPtr
ptr
);
void
abortFile
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
BackupFilePtr
filePtr
);
void
abortFile
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
BackupFilePtr
filePtr
);
void
abortFileHook
(
Signal
*
signal
,
BackupFilePtr
filePtr
,
bool
scanDone
);
void
abortFileHook
(
Signal
*
signal
,
BackupFilePtr
filePtr
,
bool
scanDone
);
bool
verifyNodesAlive
(
const
NdbNodeBitmask
&
aNodeBitMask
);
bool
verifyNodesAlive
(
BackupRecordPtr
,
const
NdbNodeBitmask
&
aNodeBitMask
);
bool
checkAbort
(
BackupRecordPtr
ptr
);
bool
checkAbort
(
BackupRecordPtr
ptr
);
void
checkNodeFail
(
Signal
*
signal
,
void
checkNodeFail
(
Signal
*
signal
,
BackupRecordPtr
ptr
,
BackupRecordPtr
ptr
,
...
@@ -603,9 +598,8 @@ public:
...
@@ -603,9 +598,8 @@ public:
void
sendBackupRef
(
BlockReference
ref
,
Signal
*
signal
,
void
sendBackupRef
(
BlockReference
ref
,
Signal
*
signal
,
Uint32
senderData
,
Uint32
errorCode
);
Uint32
senderData
,
Uint32
errorCode
);
void
dumpUsedResources
();
void
dumpUsedResources
();
void
cleanupMasterResources
(
BackupRecordPtr
ptr
);
void
cleanup
(
Signal
*
,
BackupRecordPtr
ptr
);
void
cleanupSlaveResources
(
BackupRecordPtr
ptr
);
void
abort_scan
(
Signal
*
,
BackupRecordPtr
ptr
);
void
cleanupFinalResources
(
BackupRecordPtr
ptr
);
void
removeBackup
(
Signal
*
,
BackupRecordPtr
ptr
);
void
removeBackup
(
Signal
*
,
BackupRecordPtr
ptr
);
void
sendSTTORRY
(
Signal
*
);
void
sendSTTORRY
(
Signal
*
);
...
...
ndb/src/kernel/blocks/backup/Backup.txt
View file @
2ce7824e
...
@@ -341,3 +341,28 @@ start backup
...
@@ -341,3 +341,28 @@ start backup
(ERROR_INSERTED(10022))) {
(ERROR_INSERTED(10022))) {
if (ERROR_INSERTED(10029)) {
if (ERROR_INSERTED(10029)) {
if(trigPtr.p->operation->noOfBytes > 123 && ERROR_INSERTED(10030)) {
if(trigPtr.p->operation->noOfBytes > 123 && ERROR_INSERTED(10030)) {
----- XXX ---
DEFINE_BACKUP_REF ->
ABORT_BACKUP_ORD(no reply) when all DEFINE_BACKUP replies has arrived
START_BACKUP_REF
ABORT_BACKUP_ORD(no reply) when all START_BACKUP_ replies has arrived
BACKUP_FRAGMENT_REF
ABORT_BACKUP_ORD(reply) directly to all nodes running BACKUP_FRAGMENT
When all nodes has replied BACKUP_FRAGMENT
ABORT_BACKUP_ORD(no reply)
STOP_BACKUP_REF
ABORT_BACKUP_ORD(no reply) when all STOP_BACKUP_ replies has arrived
NF_COMPLETE_REP
slave dies
master sends OUTSTANDING_REF to self
slave does nothing
master dies
slave elects self as master and sets only itself as participant
ndb/src/kernel/blocks/backup/BackupInit.cpp
View file @
2ce7824e
...
@@ -175,7 +175,7 @@ Backup::Backup(const Configuration & conf) :
...
@@ -175,7 +175,7 @@ Backup::Backup(const Configuration & conf) :
addRecSignal
(
GSN_START_BACKUP_CONF
,
&
Backup
::
execSTART_BACKUP_CONF
);
addRecSignal
(
GSN_START_BACKUP_CONF
,
&
Backup
::
execSTART_BACKUP_CONF
);
addRecSignal
(
GSN_BACKUP_FRAGMENT_REQ
,
&
Backup
::
execBACKUP_FRAGMENT_REQ
);
addRecSignal
(
GSN_BACKUP_FRAGMENT_REQ
,
&
Backup
::
execBACKUP_FRAGMENT_REQ
);
//
addRecSignal(GSN_BACKUP_FRAGMENT_REF, &Backup::execBACKUP_FRAGMENT_REF);
addRecSignal
(
GSN_BACKUP_FRAGMENT_REF
,
&
Backup
::
execBACKUP_FRAGMENT_REF
);
addRecSignal
(
GSN_BACKUP_FRAGMENT_CONF
,
&
Backup
::
execBACKUP_FRAGMENT_CONF
);
addRecSignal
(
GSN_BACKUP_FRAGMENT_CONF
,
&
Backup
::
execBACKUP_FRAGMENT_CONF
);
addRecSignal
(
GSN_STOP_BACKUP_REQ
,
&
Backup
::
execSTOP_BACKUP_REQ
);
addRecSignal
(
GSN_STOP_BACKUP_REQ
,
&
Backup
::
execSTOP_BACKUP_REQ
);
...
...
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
View file @
2ce7824e
...
@@ -126,6 +126,7 @@ Cmvmi::Cmvmi(const Configuration & conf) :
...
@@ -126,6 +126,7 @@ Cmvmi::Cmvmi(const Configuration & conf) :
}
}
setNodeInfo
(
getOwnNodeId
()).
m_connected
=
true
;
setNodeInfo
(
getOwnNodeId
()).
m_connected
=
true
;
setNodeInfo
(
getOwnNodeId
()).
m_version
=
ndbGetOwnVersion
();
}
}
Cmvmi
::~
Cmvmi
()
Cmvmi
::~
Cmvmi
()
...
...
ndb/src/mgmapi/mgmapi.cpp
View file @
2ce7824e
...
@@ -1615,9 +1615,9 @@ ndb_mgm_start_backup(NdbMgmHandle handle, int wait_completed,
...
@@ -1615,9 +1615,9 @@ ndb_mgm_start_backup(NdbMgmHandle handle, int wait_completed,
{
// start backup can take some time, set timeout high
{
// start backup can take some time, set timeout high
Uint64
old_timeout
=
handle
->
read_timeout
;
Uint64
old_timeout
=
handle
->
read_timeout
;
if
(
wait_completed
==
2
)
if
(
wait_completed
==
2
)
handle
->
read_timeout
=
30
*
60
*
1000
;
// 30 minute
s
handle
->
read_timeout
=
48
*
60
*
60
*
1000
;
// 48 hour
s
else
if
(
wait_completed
==
1
)
else
if
(
wait_completed
==
1
)
handle
->
read_timeout
=
5
*
60
*
1000
;
// 5
minutes
handle
->
read_timeout
=
10
*
60
*
1000
;
// 10
minutes
reply
=
ndb_mgm_call
(
handle
,
start_backup_reply
,
"start backup"
,
&
args
);
reply
=
ndb_mgm_call
(
handle
,
start_backup_reply
,
"start backup"
,
&
args
);
handle
->
read_timeout
=
old_timeout
;
handle
->
read_timeout
=
old_timeout
;
}
}
...
...
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
2ce7824e
...
@@ -810,7 +810,7 @@ MgmtSrvr::restartNode(int processId, bool nostart,
...
@@ -810,7 +810,7 @@ MgmtSrvr::restartNode(int processId, bool nostart,
result
=
sendSignal
(
processId
,
NO_WAIT
,
signal
,
true
);
result
=
sendSignal
(
processId
,
NO_WAIT
,
signal
,
true
);
}
}
if
(
result
==
-
1
)
{
if
(
result
==
-
1
&&
theWaitState
!=
WAIT_NODEFAILURE
)
{
m_stopRec
.
inUse
=
false
;
m_stopRec
.
inUse
=
false
;
return
SEND_OR_RECEIVE_FAILED
;
return
SEND_OR_RECEIVE_FAILED
;
}
}
...
@@ -1937,6 +1937,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
...
@@ -1937,6 +1937,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
#ifdef VM_TRACE
#ifdef VM_TRACE
ndbout_c
(
"I'm not master resending to %d"
,
aNodeId
);
ndbout_c
(
"I'm not master resending to %d"
,
aNodeId
);
#endif
#endif
theWaitNode
=
aNodeId
;
NdbApiSignal
aSignal
(
_ownReference
);
NdbApiSignal
aSignal
(
_ownReference
);
BackupReq
*
req
=
CAST_PTR
(
BackupReq
,
aSignal
.
getDataPtrSend
());
BackupReq
*
req
=
CAST_PTR
(
BackupReq
,
aSignal
.
getDataPtrSend
());
aSignal
.
set
(
TestOrd
::
TraceAPI
,
BACKUP
,
GSN_BACKUP_REQ
,
aSignal
.
set
(
TestOrd
::
TraceAPI
,
BACKUP
,
GSN_BACKUP_REQ
,
...
@@ -1964,6 +1965,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
...
@@ -1964,6 +1965,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
event
.
Event
=
BackupEvent
::
BackupAborted
;
event
.
Event
=
BackupEvent
::
BackupAborted
;
event
.
Aborted
.
Reason
=
rep
->
reason
;
event
.
Aborted
.
Reason
=
rep
->
reason
;
event
.
Aborted
.
BackupId
=
rep
->
backupId
;
event
.
Aborted
.
BackupId
=
rep
->
backupId
;
event
.
Aborted
.
ErrorCode
=
rep
->
reason
;
backupCallback
(
event
);
backupCallback
(
event
);
}
}
break
;
break
;
...
@@ -2093,6 +2095,13 @@ MgmtSrvr::handleStatus(NodeId nodeId, bool alive, bool nfComplete)
...
@@ -2093,6 +2095,13 @@ MgmtSrvr::handleStatus(NodeId nodeId, bool alive, bool nfComplete)
handleStopReply
(
nodeId
,
0
);
handleStopReply
(
nodeId
,
0
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
if
(
theWaitNode
==
nodeId
&&
theWaitState
!=
NO_WAIT
&&
theWaitState
!=
WAIT_STOP
)
{
theWaitState
=
WAIT_NODEFAILURE
;
NdbCondition_Signal
(
theMgmtWaitForResponseCondPtr
);
}
}
}
eventReport
(
_ownNodeId
,
theData
);
eventReport
(
_ownNodeId
,
theData
);
...
@@ -2448,7 +2457,7 @@ MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted)
...
@@ -2448,7 +2457,7 @@ MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted)
int
result
;
int
result
;
if
(
waitCompleted
==
2
)
{
if
(
waitCompleted
==
2
)
{
result
=
sendRecSignal
(
nodeId
,
WAIT_BACKUP_COMPLETED
,
result
=
sendRecSignal
(
nodeId
,
WAIT_BACKUP_COMPLETED
,
signal
,
true
,
30
*
60
*
1000
/*30 secs
*/
);
signal
,
true
,
48
*
60
*
60
*
1000
/* 48 hours
*/
);
}
}
else
if
(
waitCompleted
==
1
)
{
else
if
(
waitCompleted
==
1
)
{
result
=
sendRecSignal
(
nodeId
,
WAIT_BACKUP_STARTED
,
result
=
sendRecSignal
(
nodeId
,
WAIT_BACKUP_STARTED
,
...
@@ -2477,22 +2486,6 @@ MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted)
...
@@ -2477,22 +2486,6 @@ MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted)
return
-
1
;
return
-
1
;
break
;
break
;
}
}
}
else
{
switch
(
m_lastBackupEvent
.
Event
){
case
BackupEvent
:
:
BackupCompleted
:
backupId
=
m_lastBackupEvent
.
Completed
.
BackupId
;
break
;
case
BackupEvent
:
:
BackupStarted
:
backupId
=
m_lastBackupEvent
.
Started
.
BackupId
;
break
;
case
BackupEvent
:
:
BackupFailedToStart
:
return
m_lastBackupEvent
.
FailedToStart
.
ErrorCode
;
case
BackupEvent
:
:
BackupAborted
:
return
m_lastBackupEvent
.
Aborted
.
ErrorCode
;
default:
return
-
1
;
break
;
}
}
}
return
0
;
return
0
;
...
...
ndb/src/mgmsrv/MgmtSrvr.hpp
View file @
2ce7824e
...
@@ -622,7 +622,8 @@ private:
...
@@ -622,7 +622,8 @@ private:
WAIT_STOP
,
WAIT_STOP
,
WAIT_BACKUP_STARTED
,
WAIT_BACKUP_STARTED
,
WAIT_BACKUP_COMPLETED
,
WAIT_BACKUP_COMPLETED
,
WAIT_VERSION
WAIT_VERSION
,
WAIT_NODEFAILURE
};
};
/**
/**
...
@@ -706,6 +707,7 @@ private:
...
@@ -706,6 +707,7 @@ private:
NdbApiSignal
*
theSignalIdleList
;
NdbApiSignal
*
theSignalIdleList
;
// List of unused signals
// List of unused signals
Uint32
theWaitNode
;
WaitSignalType
theWaitState
;
WaitSignalType
theWaitState
;
// State denoting a set of signals we accept to recieve.
// State denoting a set of signals we accept to recieve.
...
...
ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp
View file @
2ce7824e
...
@@ -108,6 +108,7 @@ MgmtSrvr::sendRecSignal(Uint16 aNodeId,
...
@@ -108,6 +108,7 @@ MgmtSrvr::sendRecSignal(Uint16 aNodeId,
return
-
1
;
return
-
1
;
}
}
theWaitState
=
aWaitState
;
theWaitState
=
aWaitState
;
theWaitNode
=
aNodeId
;
return
receiveOptimisedResponse
(
waitTime
);
return
receiveOptimisedResponse
(
waitTime
);
}
}
...
@@ -119,11 +120,12 @@ MgmtSrvr::receiveOptimisedResponse(int waitTime)
...
@@ -119,11 +120,12 @@ MgmtSrvr::receiveOptimisedResponse(int waitTime)
theFacade
->
checkForceSend
(
_blockNumber
);
theFacade
->
checkForceSend
(
_blockNumber
);
NDB_TICKS
maxTime
=
NdbTick_CurrentMillisecond
()
+
waitTime
;
NDB_TICKS
maxTime
=
NdbTick_CurrentMillisecond
()
+
waitTime
;
while
(
theWaitState
!=
NO_WAIT
&&
waitTime
>
0
)
{
while
(
theWaitState
!=
NO_WAIT
&&
theWaitState
!=
WAIT_NODEFAILURE
&&
waitTime
>
0
)
{
NdbCondition_WaitTimeout
(
theMgmtWaitForResponseCondPtr
,
NdbCondition_WaitTimeout
(
theMgmtWaitForResponseCondPtr
,
theFacade
->
theMutexPtr
,
theFacade
->
theMutexPtr
,
waitTime
);
waitTime
);
if
(
theWaitState
==
NO_WAIT
)
if
(
theWaitState
==
NO_WAIT
||
theWaitState
==
WAIT_NODEFAILURE
)
break
;
break
;
waitTime
=
(
maxTime
-
NdbTick_CurrentMillisecond
());
waitTime
=
(
maxTime
-
NdbTick_CurrentMillisecond
());
}
//while
}
//while
...
...
ndb/src/ndbapi/ndberror.c
View file @
2ce7824e
...
@@ -381,7 +381,7 @@ ErrorBundle ErrorCodes[] = {
...
@@ -381,7 +381,7 @@ ErrorBundle ErrorCodes[] = {
{
1325
,
IE
,
"File or scan error"
},
{
1325
,
IE
,
"File or scan error"
},
{
1326
,
IE
,
"Backup abortet due to node failure"
},
{
1326
,
IE
,
"Backup abortet due to node failure"
},
{
1327
,
IE
,
"1327"
},
{
1327
,
IE
,
"1327"
},
{
1340
,
IE
,
"Backup undefined error"
},
{
1340
,
IE
,
"Backup undefined error"
},
{
1342
,
AE
,
"Backup failed to allocate buffers (check configuration)"
},
{
1342
,
AE
,
"Backup failed to allocate buffers (check configuration)"
},
{
1343
,
AE
,
"Backup failed to setup fs buffers (check configuration)"
},
{
1343
,
AE
,
"Backup failed to setup fs buffers (check configuration)"
},
...
@@ -391,7 +391,8 @@ ErrorBundle ErrorCodes[] = {
...
@@ -391,7 +391,8 @@ ErrorBundle ErrorCodes[] = {
{
1347
,
AE
,
"Backup failed to allocate table memory (check configuration)"
},
{
1347
,
AE
,
"Backup failed to allocate table memory (check configuration)"
},
{
1348
,
AE
,
"Backup failed to allocate file record (check configuration)"
},
{
1348
,
AE
,
"Backup failed to allocate file record (check configuration)"
},
{
1349
,
AE
,
"Backup failed to allocate attribute record (check configuration)"
},
{
1349
,
AE
,
"Backup failed to allocate attribute record (check configuration)"
},
{
1329
,
AE
,
"Backup during software upgrade not supported"
},
/**
/**
* Still uncategorized
* Still uncategorized
*/
*/
...
...
ndb/test/ndbapi/testBackup.cpp
View file @
2ce7824e
...
@@ -74,20 +74,20 @@ int runAbort(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -74,20 +74,20 @@ int runAbort(NDBT_Context* ctx, NDBT_Step* step){
if
(
testMaster
)
{
if
(
testMaster
)
{
if
(
testSlave
)
{
if
(
testSlave
)
{
if
(
backup
.
NFMasterAsSlave
(
restarter
)
==
-
1
){
if
(
backup
.
NFMasterAsSlave
(
restarter
)
!=
NDBT_OK
){
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
}
else
{
}
else
{
if
(
backup
.
NFMaster
(
restarter
)
==
-
1
){
if
(
backup
.
NFMaster
(
restarter
)
!=
NDBT_OK
){
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
}
}
}
else
{
}
else
{
if
(
backup
.
NFSlave
(
restarter
)
==
-
1
){
if
(
backup
.
NFSlave
(
restarter
)
!=
NDBT_OK
){
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
}
}
return
NDBT_OK
;
return
NDBT_OK
;
}
}
...
@@ -108,16 +108,16 @@ int runFail(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -108,16 +108,16 @@ int runFail(NDBT_Context* ctx, NDBT_Step* step){
if
(
testMaster
)
{
if
(
testMaster
)
{
if
(
testSlave
)
{
if
(
testSlave
)
{
if
(
backup
.
FailMasterAsSlave
(
restarter
)
==
-
1
){
if
(
backup
.
FailMasterAsSlave
(
restarter
)
!=
NDBT_OK
){
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
}
else
{
}
else
{
if
(
backup
.
FailMaster
(
restarter
)
==
-
1
){
if
(
backup
.
FailMaster
(
restarter
)
!=
NDBT_OK
){
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
}
}
}
else
{
}
else
{
if
(
backup
.
FailSlave
(
restarter
)
==
-
1
){
if
(
backup
.
FailSlave
(
restarter
)
!=
NDBT_OK
){
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
}
}
...
...
ndb/test/run-test/daily-basic-tests.txt
View file @
2ce7824e
...
@@ -2,6 +2,30 @@ max-time: 3600
...
@@ -2,6 +2,30 @@ max-time: 3600
cmd: atrt-mysql-test-run
cmd: atrt-mysql-test-run
args: --force
args: --force
max-time: 600
cmd: atrt-testBackup
args: -n NFMaster T1
max-time: 600
cmd: atrt-testBackup
args: -n NFMasterAsSlave T1
max-time: 600
cmd: atrt-testBackup
args: -n NFSlave T1
max-time: 600
cmd: atrt-testBackup
args: -n FailMaster T1
max-time: 600
cmd: atrt-testBackup
args: -n FailMasterAsSlave T1
max-time: 600
cmd: atrt-testBackup
args: -n FailSlave T1
max-time: 600
max-time: 600
cmd: atrt-testBackup
cmd: atrt-testBackup
args: -n BackupOne T1 T6 T3 I3
args: -n BackupOne T1 T6 T3 I3
...
...
ndb/test/src/NdbBackup.cpp
View file @
2ce7824e
...
@@ -245,6 +245,10 @@ NdbBackup::NFSlave(NdbRestarter& _restarter){
...
@@ -245,6 +245,10 @@ NdbBackup::NFSlave(NdbRestarter& _restarter){
int
int
NdbBackup
::
NF
(
NdbRestarter
&
_restarter
,
int
*
NFDuringBackup_codes
,
const
int
sz
,
bool
onMaster
){
NdbBackup
::
NF
(
NdbRestarter
&
_restarter
,
int
*
NFDuringBackup_codes
,
const
int
sz
,
bool
onMaster
){
{
{
int
nNodes
=
_restarter
.
getNumDbNodes
();
if
(
nNodes
==
1
)
return
NDBT_OK
;
int
nodeId
=
_restarter
.
getMasterNodeId
();
int
nodeId
=
_restarter
.
getMasterNodeId
();
CHECK
(
_restarter
.
restartOneDbNode
(
nodeId
,
false
,
true
,
true
)
==
0
,
CHECK
(
_restarter
.
restartOneDbNode
(
nodeId
,
false
,
true
,
true
)
==
0
,
...
@@ -255,15 +259,11 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
...
@@ -255,15 +259,11 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
CHECK
(
_restarter
.
startNodes
(
&
nodeId
,
1
)
==
0
,
CHECK
(
_restarter
.
startNodes
(
&
nodeId
,
1
)
==
0
,
"failed to start node"
);
"failed to start node"
);
NdbSleep_SecSleep
(
10
);
}
}
CHECK
(
_restarter
.
waitClusterStarted
()
==
0
,
CHECK
(
_restarter
.
waitClusterStarted
()
==
0
,
"waitClusterStarted failed"
);
"waitClusterStarted failed"
);
int
nNodes
=
_restarter
.
getNumDbNodes
();
myRandom48Init
(
NdbTick_CurrentMillisecond
());
myRandom48Init
(
NdbTick_CurrentMillisecond
());
for
(
int
i
=
0
;
i
<
sz
;
i
++
){
for
(
int
i
=
0
;
i
<
sz
;
i
++
){
...
@@ -296,6 +296,7 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
...
@@ -296,6 +296,7 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
"failed to set error insert"
);
"failed to set error insert"
);
g_info
<<
"error inserted"
<<
endl
;
g_info
<<
"error inserted"
<<
endl
;
NdbSleep_SecSleep
(
1
);
g_info
<<
"starting backup"
<<
endl
;
g_info
<<
"starting backup"
<<
endl
;
int
r
=
start
(
backupId
);
int
r
=
start
(
backupId
);
...
@@ -304,6 +305,7 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
...
@@ -304,6 +305,7 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
if
(
r
==
0
)
{
if
(
r
==
0
)
{
g_err
<<
"Backup should have failed on error_insertion "
<<
error
<<
endl
g_err
<<
"Backup should have failed on error_insertion "
<<
error
<<
endl
<<
"Master = "
<<
masterNodeId
<<
"Node = "
<<
nodeId
<<
endl
;
<<
"Master = "
<<
masterNodeId
<<
"Node = "
<<
nodeId
<<
endl
;
return
NDBT_FAILED
;
}
}
CHECK
(
_restarter
.
waitNodesNoStart
(
&
nodeId
,
1
)
==
0
,
CHECK
(
_restarter
.
waitNodesNoStart
(
&
nodeId
,
1
)
==
0
,
...
@@ -316,8 +318,6 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
...
@@ -316,8 +318,6 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
NdbSleep_SecSleep
(
1
);
g_info
<<
"starting new backup"
<<
endl
;
g_info
<<
"starting new backup"
<<
endl
;
CHECK
(
start
(
backupId
)
==
0
,
CHECK
(
start
(
backupId
)
==
0
,
"failed to start backup"
);
"failed to start backup"
);
...
@@ -331,8 +331,14 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
...
@@ -331,8 +331,14 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
"waitClusterStarted failed"
);
"waitClusterStarted failed"
);
g_info
<<
"node started"
<<
endl
;
g_info
<<
"node started"
<<
endl
;
int
val2
[]
=
{
24
,
2424
};
CHECK
(
_restarter
.
dumpStateAllNodes
(
val2
,
2
)
==
0
,
"failed to check backup resources RestartOnErrorInsert"
);
CHECK
(
_restarter
.
insertErrorInNode
(
nodeId
,
10099
)
==
0
,
CHECK
(
_restarter
.
insertErrorInNode
(
nodeId
,
10099
)
==
0
,
"failed to set error insert"
);
"failed to set error insert"
);
NdbSleep_SecSleep
(
1
);
}
}
return
NDBT_OK
;
return
NDBT_OK
;
...
@@ -340,15 +346,8 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
...
@@ -340,15 +346,8 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
int
int
FailS_codes
[]
=
{
FailS_codes
[]
=
{
10023
,
10024
,
10025
,
10026
,
10027
,
10027
,
10028
,
10033
10029
,
10030
,
10031
};
};
int
int
...
@@ -359,9 +358,8 @@ FailM_codes[] = {
...
@@ -359,9 +358,8 @@ FailM_codes[] = {
10026
,
10026
,
10027
,
10027
,
10028
,
10028
,
10029
,
10031
,
10030
,
10033
10031
};
};
int
int
...
@@ -426,13 +424,21 @@ NdbBackup::Fail(NdbRestarter& _restarter, int *Fail_codes, const int sz, bool on
...
@@ -426,13 +424,21 @@ NdbBackup::Fail(NdbRestarter& _restarter, int *Fail_codes, const int sz, bool on
if
(
r
==
0
)
{
if
(
r
==
0
)
{
g_err
<<
"Backup should have failed on error_insertion "
<<
error
<<
endl
g_err
<<
"Backup should have failed on error_insertion "
<<
error
<<
endl
<<
"Master = "
<<
masterNodeId
<<
"Node = "
<<
nodeId
<<
endl
;
<<
"Master = "
<<
masterNodeId
<<
"Node = "
<<
nodeId
<<
endl
;
return
NDBT_FAILED
;
}
}
CHECK
(
_restarter
.
waitClusterStarted
()
==
0
,
CHECK
(
_restarter
.
waitClusterStarted
()
==
0
,
"waitClusterStarted failed"
);
"waitClusterStarted failed"
);
CHECK
(
_restarter
.
insertErrorInNode
(
nodeId
,
10099
)
==
0
,
CHECK
(
_restarter
.
insertErrorInNode
(
nodeId
,
10099
)
==
0
,
"failed to set error insert"
);
"failed to set error insert"
);
NdbSleep_SecSleep
(
5
);
int
val2
[]
=
{
24
,
2424
};
CHECK
(
_restarter
.
dumpStateAllNodes
(
val2
,
2
)
==
0
,
"failed to check backup resources RestartOnErrorInsert"
);
}
}
return
NDBT_OK
;
return
NDBT_OK
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment