Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/jonas/src/mysql-5.0


ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Auto merged
ndb/src/ndbapi/ndberror.c:
  Auto merged
This commit is contained in:
unknown 2005-04-22 12:53:07 +02:00
commit ad8e2dcf54
25 changed files with 1078 additions and 1077 deletions

View file

@ -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:
Uint32 backupId; Uint32 backupId;
Uint32 backupPtr; Uint32 backupPtr;
Uint32 errorCode; Uint32 errorCode;
Uint32 nodeId;
}; };
class DefineBackupConf { class DefineBackupConf {
@ -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:
Uint32 backupPtr; Uint32 backupPtr;
Uint32 signalNo; Uint32 signalNo;
Uint32 errorCode; Uint32 errorCode;
Uint32 nodeId;
}; };
class StartBackupConf { class StartBackupConf {
@ -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 {
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 {

View file

@ -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;

View file

@ -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;
} }

File diff suppressed because it is too large Load diff

View file

@ -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:
Uint8 fileOpened; Uint8 fileOpened;
Uint8 fileRunning; Uint8 fileRunning;
Uint8 fileDone; Uint8 fileClosing;
Uint8 scanRunning; Uint8 scanRunning;
}; };
typedef Ptr<BackupFile> BackupFilePtr; typedef Ptr<BackupFile> BackupFilePtr;
@ -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:
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:
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:
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:
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:
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*);

View file

@ -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

View file

@ -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);

View file

@ -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()

View file

@ -984,7 +984,7 @@ private:
Uint32 placeReadInLockQueue(Signal* signal); Uint32 placeReadInLockQueue(Signal* signal);
void placeSerialQueueRead(Signal* signal); void placeSerialQueueRead(Signal* signal);
void checkOnlyReadEntry(Signal* signal); void checkOnlyReadEntry(Signal* signal);
void getNoParallelTransaction(Signal* signal); Uint32 getNoParallelTransaction(const Operationrec*);
void moveLastParallelQueue(Signal* signal); void moveLastParallelQueue(Signal* signal);
void moveLastParallelQueueWrite(Signal* signal); void moveLastParallelQueueWrite(Signal* signal);
Uint32 placeWriteInLockQueue(Signal* signal); Uint32 placeWriteInLockQueue(Signal* signal);
@ -1045,6 +1045,8 @@ private:
Uint32 executeNextOperation(Signal* signal); Uint32 executeNextOperation(Signal* signal);
void releaselock(Signal* signal); void releaselock(Signal* signal);
void takeOutFragWaitQue(Signal* signal); void takeOutFragWaitQue(Signal* signal);
void check_lock_upgrade(Signal* signal, OperationrecPtr lock_owner,
OperationrecPtr release_op);
void allocOverflowPage(Signal* signal); void allocOverflowPage(Signal* signal);
bool getrootfragmentrec(Signal* signal, RootfragmentrecPtr&, Uint32 fragId); bool getrootfragmentrec(Signal* signal, RootfragmentrecPtr&, Uint32 fragId);
void insertLockOwnersList(Signal* signal, const OperationrecPtr&); void insertLockOwnersList(Signal* signal, const OperationrecPtr&);
@ -1206,7 +1208,6 @@ private:
OperationrecPtr mlpqOperPtr; OperationrecPtr mlpqOperPtr;
OperationrecPtr queOperPtr; OperationrecPtr queOperPtr;
OperationrecPtr readWriteOpPtr; OperationrecPtr readWriteOpPtr;
OperationrecPtr tgnptMainOpPtr;
Uint32 cfreeopRec; Uint32 cfreeopRec;
Uint32 coprecsize; Uint32 coprecsize;
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
@ -1412,7 +1413,6 @@ private:
Uint32 turlIndex; Uint32 turlIndex;
Uint32 tlfrTmp1; Uint32 tlfrTmp1;
Uint32 tlfrTmp2; Uint32 tlfrTmp2;
Uint32 tgnptNrTransaction;
Uint32 tscanTrid1; Uint32 tscanTrid1;
Uint32 tscanTrid2; Uint32 tscanTrid2;

View file

@ -2033,9 +2033,7 @@ void Dbacc::insertelementLab(Signal* signal)
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
Uint32 Dbacc::placeReadInLockQueue(Signal* signal) Uint32 Dbacc::placeReadInLockQueue(Signal* signal)
{ {
tgnptMainOpPtr = queOperPtr; if (getNoParallelTransaction(queOperPtr.p) == 1) {
getNoParallelTransaction(signal);
if (tgnptNrTransaction == 1) {
if ((queOperPtr.p->transId1 == operationRecPtr.p->transId1) && if ((queOperPtr.p->transId1 == operationRecPtr.p->transId1) &&
(queOperPtr.p->transId2 == operationRecPtr.p->transId2)) { (queOperPtr.p->transId2 == operationRecPtr.p->transId2)) {
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
@ -2118,9 +2116,7 @@ void Dbacc::placeSerialQueueRead(Signal* signal)
checkOnlyReadEntry(signal); checkOnlyReadEntry(signal);
return; return;
}//if }//if
tgnptMainOpPtr = readWriteOpPtr; if (getNoParallelTransaction(readWriteOpPtr.p) == 1) {
getNoParallelTransaction(signal);
if (tgnptNrTransaction == 1) {
jam(); jam();
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
/* THERE WAS ONLY ONE TRANSACTION INVOLVED IN THE PARALLEL QUEUE. IF THIS IS OUR */ /* THERE WAS ONLY ONE TRANSACTION INVOLVED IN THE PARALLEL QUEUE. IF THIS IS OUR */
@ -2201,24 +2197,23 @@ void Dbacc::checkOnlyReadEntry(Signal* signal)
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
/* GET_NO_PARALLEL_TRANSACTION */ /* GET_NO_PARALLEL_TRANSACTION */
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
void Dbacc::getNoParallelTransaction(Signal* signal) Uint32
Dbacc::getNoParallelTransaction(const Operationrec * op)
{ {
OperationrecPtr tnptOpPtr; OperationrecPtr tmp;
tgnptNrTransaction = 1; tmp.i= op->nextParallelQue;
tnptOpPtr.i = tgnptMainOpPtr.p->nextParallelQue; Uint32 transId[2] = { op->transId1, op->transId2 };
while ((tnptOpPtr.i != RNIL) && while (tmp.i != RNIL)
(tgnptNrTransaction == 1)) { {
jam(); jam();
ptrCheckGuard(tnptOpPtr, coprecsize, operationrec); ptrCheckGuard(tmp, coprecsize, operationrec);
if ((tnptOpPtr.p->transId1 == tgnptMainOpPtr.p->transId1) && if (tmp.p->transId1 == transId[0] && tmp.p->transId2 == transId[1])
(tnptOpPtr.p->transId2 == tgnptMainOpPtr.p->transId2)) { tmp.i = tmp.p->nextParallelQue;
tnptOpPtr.i = tnptOpPtr.p->nextParallelQue; else
} else { return 2;
jam(); }
tgnptNrTransaction++; return 1;
}//if
}//while
}//Dbacc::getNoParallelTransaction() }//Dbacc::getNoParallelTransaction()
void Dbacc::moveLastParallelQueue(Signal* signal) void Dbacc::moveLastParallelQueue(Signal* signal)
@ -2259,9 +2254,7 @@ void Dbacc::moveLastParallelQueueWrite(Signal* signal)
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
Uint32 Dbacc::placeWriteInLockQueue(Signal* signal) Uint32 Dbacc::placeWriteInLockQueue(Signal* signal)
{ {
tgnptMainOpPtr = queOperPtr; if (!((getNoParallelTransaction(queOperPtr.p) == 1) &&
getNoParallelTransaction(signal);
if (!((tgnptNrTransaction == 1) &&
(queOperPtr.p->transId1 == operationRecPtr.p->transId1) && (queOperPtr.p->transId1 == operationRecPtr.p->transId1) &&
(queOperPtr.p->transId2 == operationRecPtr.p->transId2))) { (queOperPtr.p->transId2 == operationRecPtr.p->transId2))) {
jam(); jam();
@ -2312,9 +2305,7 @@ void Dbacc::placeSerialQueueWrite(Signal* signal)
}//if }//if
readWriteOpPtr.i = readWriteOpPtr.p->nextSerialQue; readWriteOpPtr.i = readWriteOpPtr.p->nextSerialQue;
ptrCheckGuard(readWriteOpPtr, coprecsize, operationrec); ptrCheckGuard(readWriteOpPtr, coprecsize, operationrec);
tgnptMainOpPtr = readWriteOpPtr; if (getNoParallelTransaction(readWriteOpPtr.p) == 1) {
getNoParallelTransaction(signal);
if (tgnptNrTransaction == 1) {
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
/* THERE WAS ONLY ONE TRANSACTION INVOLVED IN THE PARALLEL QUEUE. IF THIS IS OUR */ /* THERE WAS ONLY ONE TRANSACTION INVOLVED IN THE PARALLEL QUEUE. IF THIS IS OUR */
/* TRANSACTION WE CAN STILL GET HOLD OF THE LOCK. */ /* TRANSACTION WE CAN STILL GET HOLD OF THE LOCK. */
@ -4449,9 +4440,154 @@ void Dbacc::commitOperation(Signal* signal)
ptrCheckGuard(tolqTmpPtr, coprecsize, operationrec); ptrCheckGuard(tolqTmpPtr, coprecsize, operationrec);
tolqTmpPtr.p->prevParallelQue = operationRecPtr.p->prevParallelQue; tolqTmpPtr.p->prevParallelQue = operationRecPtr.p->prevParallelQue;
}//if }//if
}//if
/**
* Check possible lock upgrade
* 1) Find lock owner
* 2) Count transactions in parallel que
* 3) If count == 1 and TRANSID(next serial) == TRANSID(lock owner)
* upgrade next serial
*/
if(operationRecPtr.p->lockMode)
{
jam();
/**
* Committing a non shared operation can't lead to lock upgrade
*/
return;
}
OperationrecPtr lock_owner;
lock_owner.i = operationRecPtr.p->prevParallelQue;
ptrCheckGuard(lock_owner, coprecsize, operationrec);
Uint32 transid[2] = { lock_owner.p->transId1,
lock_owner.p->transId2 };
while(lock_owner.p->prevParallelQue != RNIL)
{
lock_owner.i = lock_owner.p->prevParallelQue;
ptrCheckGuard(lock_owner, coprecsize, operationrec);
if(lock_owner.p->transId1 != transid[0] ||
lock_owner.p->transId2 != transid[1])
{
jam();
/**
* If more than 1 trans in lock queue -> no lock upgrade
*/
return;
}
}
check_lock_upgrade(signal, lock_owner, operationRecPtr);
}
}//Dbacc::commitOperation() }//Dbacc::commitOperation()
void
Dbacc::check_lock_upgrade(Signal* signal,
OperationrecPtr lock_owner,
OperationrecPtr release_op)
{
if((lock_owner.p->transId1 == release_op.p->transId1 &&
lock_owner.p->transId2 == release_op.p->transId2) ||
release_op.p->lockMode ||
lock_owner.p->nextSerialQue == RNIL)
{
jam();
/**
* No lock upgrade if same trans or lock owner has no serial queue
* or releasing non shared op
*/
return;
}
OperationrecPtr next;
next.i = lock_owner.p->nextSerialQue;
ptrCheckGuard(next, coprecsize, operationrec);
if(lock_owner.p->transId1 != next.p->transId1 ||
lock_owner.p->transId2 != next.p->transId2)
{
jam();
/**
* No lock upgrad if !same trans in serial queue
*/
return;
}
if (getNoParallelTransaction(lock_owner.p) > 1)
{
jam();
/**
* No lock upgrade if more than 1 transaction in parallell queue
*/
return;
}
if (getNoParallelTransaction(next.p) > 1)
{
jam();
/**
* No lock upgrade if more than 1 transaction in next's parallell queue
*/
return;
}
OperationrecPtr tmp;
tmp.i = lock_owner.p->nextSerialQue = next.p->nextSerialQue;
if(tmp.i != RNIL)
{
ptrCheckGuard(tmp, coprecsize, operationrec);
ndbassert(tmp.p->prevSerialQue == next.i);
tmp.p->prevSerialQue = lock_owner.i;
}
next.p->nextSerialQue = next.p->prevSerialQue = RNIL;
// Find end of parallell que
tmp = lock_owner;
while(tmp.p->nextParallelQue != RNIL)
{
jam();
tmp.i = tmp.p->nextParallelQue;
ptrCheckGuard(tmp, coprecsize, operationrec);
}
next.p->prevParallelQue = tmp.i;
tmp.p->nextParallelQue = next.i;
OperationrecPtr save = operationRecPtr;
Uint32 lockMode = lock_owner.p->lockMode;
Uint32 TelementIsDisappeared = 0; // lock upgrade = all reads
Uint32 ThashValue = lock_owner.p->hashValue;
Uint32 localdata[2];
localdata[0] = lock_owner.p->localdata[0];
localdata[1] = lock_owner.p->localdata[1];
do {
next.p->elementIsDisappeared = TelementIsDisappeared;
next.p->hashValue = ThashValue;
next.p->localdata[0] = localdata[0];
next.p->localdata[1] = localdata[1];
operationRecPtr = next;
next.p->lockMode = lockMode;
TelementIsDisappeared = executeNextOperation(signal);
if (next.p->nextParallelQue != RNIL)
{
jam();
next.i = next.p->nextParallelQue;
ptrCheckGuard(next, coprecsize, operationrec);
} else {
jam();
break;
}//if
} while (1);
operationRecPtr = save;
}
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* RELEASELOCK */ /* RELEASELOCK */
/* RESETS LOCK OF AN ELEMENT. */ /* RESETS LOCK OF AN ELEMENT. */
@ -4488,6 +4624,8 @@ void Dbacc::releaselock(Signal* signal)
ptrCheckGuard(trlTmpOperPtr, coprecsize, operationrec); ptrCheckGuard(trlTmpOperPtr, coprecsize, operationrec);
trlTmpOperPtr.p->prevSerialQue = trlOperPtr.i; trlTmpOperPtr.p->prevSerialQue = trlOperPtr.i;
}//if }//if
check_lock_upgrade(signal, copyInOperPtr, operationRecPtr);
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
/* SINCE THERE ARE STILL ITEMS IN THE PARALLEL QUEUE WE NEED NOT WORRY ABOUT */ /* SINCE THERE ARE STILL ITEMS IN THE PARALLEL QUEUE WE NEED NOT WORRY ABOUT */
/* STARTING QUEUED OPERATIONS. THUS WE CAN END HERE. */ /* STARTING QUEUED OPERATIONS. THUS WE CAN END HERE. */
@ -6952,7 +7090,7 @@ void Dbacc::checkSendLcpConfLab(Signal* signal)
break; break;
}//switch }//switch
lcpConnectptr.p->noOfLcpConf++; lcpConnectptr.p->noOfLcpConf++;
ndbrequire(lcpConnectptr.p->noOfLcpConf <= 2); ndbrequire(lcpConnectptr.p->noOfLcpConf <= 4);
fragrecptr.p->fragState = ACTIVEFRAG; fragrecptr.p->fragState = ACTIVEFRAG;
rlpPageptr.i = fragrecptr.p->zeroPagePtr; rlpPageptr.i = fragrecptr.p->zeroPagePtr;
ptrCheckGuard(rlpPageptr, cpagesize, page8); ptrCheckGuard(rlpPageptr, cpagesize, page8);
@ -6970,7 +7108,7 @@ void Dbacc::checkSendLcpConfLab(Signal* signal)
}//for }//for
signal->theData[0] = fragrecptr.p->lcpLqhPtr; signal->theData[0] = fragrecptr.p->lcpLqhPtr;
sendSignal(lcpConnectptr.p->lcpUserblockref, GSN_ACC_LCPCONF, signal, 1, JBB); sendSignal(lcpConnectptr.p->lcpUserblockref, GSN_ACC_LCPCONF, signal, 1, JBB);
if (lcpConnectptr.p->noOfLcpConf == 2) { if (lcpConnectptr.p->noOfLcpConf == 4) {
jam(); jam();
releaseLcpConnectRec(signal); releaseLcpConnectRec(signal);
rootfragrecptr.i = fragrecptr.p->myroot; rootfragrecptr.i = fragrecptr.p->myroot;
@ -7001,6 +7139,13 @@ void Dbacc::execACC_CONTOPREQ(Signal* signal)
/* LOCAL FRAG ID */ /* LOCAL FRAG ID */
tresult = 0; tresult = 0;
ptrCheckGuard(lcpConnectptr, clcpConnectsize, lcpConnectrec); ptrCheckGuard(lcpConnectptr, clcpConnectsize, lcpConnectrec);
if(ERROR_INSERTED(3002) && lcpConnectptr.p->noOfLcpConf < 2)
{
sendSignalWithDelay(cownBlockref, GSN_ACC_CONTOPREQ, signal, 300,
signal->getLength());
return;
}
ndbrequire(lcpConnectptr.p->lcpstate == LCP_ACTIVE); ndbrequire(lcpConnectptr.p->lcpstate == LCP_ACTIVE);
rootfragrecptr.i = lcpConnectptr.p->rootrecptr; rootfragrecptr.i = lcpConnectptr.p->rootrecptr;
ptrCheckGuard(rootfragrecptr, crootfragmentsize, rootfragmentrec); ptrCheckGuard(rootfragrecptr, crootfragmentsize, rootfragmentrec);
@ -7034,6 +7179,15 @@ void Dbacc::execACC_CONTOPREQ(Signal* signal)
}//while }//while
signal->theData[0] = fragrecptr.p->lcpLqhPtr; signal->theData[0] = fragrecptr.p->lcpLqhPtr;
sendSignal(lcpConnectptr.p->lcpUserblockref, GSN_ACC_CONTOPCONF, signal, 1, JBA); sendSignal(lcpConnectptr.p->lcpUserblockref, GSN_ACC_CONTOPCONF, signal, 1, JBA);
lcpConnectptr.p->noOfLcpConf++;
if (lcpConnectptr.p->noOfLcpConf == 4) {
jam();
releaseLcpConnectRec(signal);
rootfragrecptr.i = fragrecptr.p->myroot;
ptrCheckGuard(rootfragrecptr, crootfragmentsize, rootfragmentrec);
rootfragrecptr.p->rootState = ACTIVEROOT;
}//if
return; /* ALL QUEUED OPERATION ARE RESTARTED IF NEEDED. */ return; /* ALL QUEUED OPERATION ARE RESTARTED IF NEEDED. */
}//Dbacc::execACC_CONTOPREQ() }//Dbacc::execACC_CONTOPREQ()

View file

@ -9884,11 +9884,20 @@ Dbdict::execBUILDINDXREQ(Signal* signal)
requestType == BuildIndxReq::RT_ALTER_INDEX || requestType == BuildIndxReq::RT_ALTER_INDEX ||
requestType == BuildIndxReq::RT_SYSTEMRESTART) { requestType == BuildIndxReq::RT_SYSTEMRESTART) {
jam(); jam();
const bool isLocal = req->getRequestFlag() & RequestFlag::RF_LOCAL;
NdbNodeBitmask receiverNodes = c_aliveNodes;
if (isLocal) {
receiverNodes.clear();
receiverNodes.set(getOwnNodeId());
}
if (signal->getLength() == BuildIndxReq::SignalLength) { if (signal->getLength() == BuildIndxReq::SignalLength) {
jam(); jam();
if (getOwnNodeId() != c_masterNodeId) {
if (!isLocal && getOwnNodeId() != c_masterNodeId) {
jam(); jam();
releaseSections(signal); releaseSections(signal);
OpBuildIndex opBad; OpBuildIndex opBad;
opPtr.p = &opBad; opPtr.p = &opBad;
@ -9901,9 +9910,9 @@ Dbdict::execBUILDINDXREQ(Signal* signal)
} }
// forward initial request plus operation key to all // forward initial request plus operation key to all
req->setOpKey(++c_opRecordSequence); req->setOpKey(++c_opRecordSequence);
NodeReceiverGroup rg(DBDICT, c_aliveNodes); NodeReceiverGroup rg(DBDICT, receiverNodes);
sendSignal(rg, GSN_BUILDINDXREQ, sendSignal(rg, GSN_BUILDINDXREQ,
signal, BuildIndxReq::SignalLength + 1, JBB); signal, BuildIndxReq::SignalLength + 1, JBB);
return; return;
} }
// seize operation record // seize operation record
@ -9926,7 +9935,7 @@ Dbdict::execBUILDINDXREQ(Signal* signal)
} }
c_opBuildIndex.add(opPtr); c_opBuildIndex.add(opPtr);
// master expects to hear from all // master expects to hear from all
opPtr.p->m_signalCounter = c_aliveNodes; opPtr.p->m_signalCounter = receiverNodes;
buildIndex_sendReply(signal, opPtr, false); buildIndex_sendReply(signal, opPtr, false);
return; return;
} }
@ -10281,10 +10290,20 @@ Dbdict::buildIndex_sendSlaveReq(Signal* signal, OpBuildIndexPtr opPtr)
req->setConnectionPtr(opPtr.p->key); req->setConnectionPtr(opPtr.p->key);
req->setRequestType(opPtr.p->m_requestType); req->setRequestType(opPtr.p->m_requestType);
req->addRequestFlag(opPtr.p->m_requestFlag); req->addRequestFlag(opPtr.p->m_requestFlag);
opPtr.p->m_signalCounter = c_aliveNodes; if(opPtr.p->m_requestFlag & RequestFlag::RF_LOCAL)
NodeReceiverGroup rg(DBDICT, c_aliveNodes); {
sendSignal(rg, GSN_BUILDINDXREQ, opPtr.p->m_signalCounter.clearWaitingFor();
signal, BuildIndxReq::SignalLength, JBB); opPtr.p->m_signalCounter.setWaitingFor(getOwnNodeId());
sendSignal(reference(), GSN_BUILDINDXREQ,
signal, BuildIndxReq::SignalLength, JBB);
}
else
{
opPtr.p->m_signalCounter = c_aliveNodes;
NodeReceiverGroup rg(DBDICT, c_aliveNodes);
sendSignal(rg, GSN_BUILDINDXREQ,
signal, BuildIndxReq::SignalLength, JBB);
}
} }
void void

View file

@ -966,7 +966,6 @@ public:
enum LcpState { enum LcpState {
LCP_IDLE = 0, LCP_IDLE = 0,
LCP_STARTED = 1,
LCP_COMPLETED = 2, LCP_COMPLETED = 2,
LCP_WAIT_FRAGID = 3, LCP_WAIT_FRAGID = 3,
LCP_WAIT_TUP_PREPLCP = 4, LCP_WAIT_TUP_PREPLCP = 4,
@ -2265,7 +2264,7 @@ private:
void sendCopyActiveConf(Signal* signal,Uint32 tableId); void sendCopyActiveConf(Signal* signal,Uint32 tableId);
void checkLcpCompleted(Signal* signal); void checkLcpCompleted(Signal* signal);
void checkLcpHoldop(Signal* signal); void checkLcpHoldop(Signal* signal);
void checkLcpStarted(Signal* signal); bool checkLcpStarted(Signal* signal);
void checkLcpTupprep(Signal* signal); void checkLcpTupprep(Signal* signal);
void getNextFragForLcp(Signal* signal); void getNextFragForLcp(Signal* signal);
void initLcpLocAcc(Signal* signal, Uint32 fragId); void initLcpLocAcc(Signal* signal, Uint32 fragId);

View file

@ -10426,8 +10426,8 @@ void Dblqh::execTUP_LCPSTARTED(Signal* signal)
void Dblqh::lcpStartedLab(Signal* signal) void Dblqh::lcpStartedLab(Signal* signal)
{ {
checkLcpStarted(signal); if (checkLcpStarted(signal))
if (lcpPtr.p->lcpState == LcpRecord::LCP_STARTED) { {
jam(); jam();
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* THE LOCAL CHECKPOINT HAS BEEN STARTED. IT IS NOW TIME TO * THE LOCAL CHECKPOINT HAS BEEN STARTED. IT IS NOW TIME TO
@ -10507,26 +10507,7 @@ void Dblqh::execLQH_RESTART_OP(Signal* signal)
lcpPtr.i = signal->theData[1]; lcpPtr.i = signal->theData[1];
ptrCheckGuard(lcpPtr, clcpFileSize, lcpRecord); ptrCheckGuard(lcpPtr, clcpFileSize, lcpRecord);
ndbrequire(fragptr.p->fragStatus == Fragrecord::BLOCKED); ndbrequire(fragptr.p->fragStatus == Fragrecord::BLOCKED);
if (lcpPtr.p->lcpState == LcpRecord::LCP_STARTED) { restartOperationsLab(signal);
jam();
/***********************************************************************/
/* THIS SIGNAL CAN ONLY BE RECEIVED WHEN FRAGMENT IS BLOCKED AND
* THE LOCAL CHECKPOINT HAS BEEN STARTED. THE BLOCKING WILL BE
* REMOVED AS SOON AS ALL OPERATIONS HAVE BEEN STARTED.
***********************************************************************/
restartOperationsLab(signal);
} else if (lcpPtr.p->lcpState == LcpRecord::LCP_BLOCKED_COMP) {
jam();
/*******************************************************************>
* THE CHECKPOINT IS COMPLETED BUT HAS NOT YET STARTED UP
* ALL OPERATIONS AGAIN.
* WE PERFORM THIS START-UP BEFORE CONTINUING WITH THE NEXT
* FRAGMENT OF THE LOCAL CHECKPOINT TO AVOID ANY STRANGE ERRORS.
*******************************************************************> */
restartOperationsLab(signal);
} else {
ndbrequire(false);
}
}//Dblqh::execLQH_RESTART_OP() }//Dblqh::execLQH_RESTART_OP()
void Dblqh::restartOperationsLab(Signal* signal) void Dblqh::restartOperationsLab(Signal* signal)
@ -11075,7 +11056,8 @@ void Dblqh::checkLcpHoldop(Signal* signal)
* *
* SUBROUTINE SHORT NAME = CLS * SUBROUTINE SHORT NAME = CLS
* ========================================================================== */ * ========================================================================== */
void Dblqh::checkLcpStarted(Signal* signal) bool
Dblqh::checkLcpStarted(Signal* signal)
{ {
LcpLocRecordPtr clsLcpLocptr; LcpLocRecordPtr clsLcpLocptr;
@ -11085,7 +11067,7 @@ void Dblqh::checkLcpStarted(Signal* signal)
do { do {
ptrCheckGuard(clsLcpLocptr, clcpLocrecFileSize, lcpLocRecord); ptrCheckGuard(clsLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
if (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_WAIT_STARTED){ if (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_WAIT_STARTED){
return; return false;
}//if }//if
clsLcpLocptr.i = clsLcpLocptr.p->nextLcpLoc; clsLcpLocptr.i = clsLcpLocptr.p->nextLcpLoc;
i++; i++;
@ -11096,12 +11078,13 @@ void Dblqh::checkLcpStarted(Signal* signal)
do { do {
ptrCheckGuard(clsLcpLocptr, clcpLocrecFileSize, lcpLocRecord); ptrCheckGuard(clsLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
if (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::TUP_WAIT_STARTED){ if (clsLcpLocptr.p->lcpLocstate == LcpLocRecord::TUP_WAIT_STARTED){
return; return false;
}//if }//if
clsLcpLocptr.i = clsLcpLocptr.p->nextLcpLoc; clsLcpLocptr.i = clsLcpLocptr.p->nextLcpLoc;
i++; i++;
} while (clsLcpLocptr.i != RNIL); } while (clsLcpLocptr.i != RNIL);
lcpPtr.p->lcpState = LcpRecord::LCP_STARTED;
return true;
}//Dblqh::checkLcpStarted() }//Dblqh::checkLcpStarted()
/* ========================================================================== /* ==========================================================================
@ -11262,20 +11245,12 @@ void Dblqh::sendAccContOp(Signal* signal)
do { do {
ptrCheckGuard(sacLcpLocptr, clcpLocrecFileSize, lcpLocRecord); ptrCheckGuard(sacLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
sacLcpLocptr.p->accContCounter = 0; sacLcpLocptr.p->accContCounter = 0;
if(sacLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_STARTED){ /* ------------------------------------------------------------------- */
/* ------------------------------------------------------------------- */ /*SEND START OPERATIONS TO ACC AGAIN */
/*SEND START OPERATIONS TO ACC AGAIN */ /* ------------------------------------------------------------------- */
/* ------------------------------------------------------------------- */ signal->theData[0] = lcpPtr.p->lcpAccptr;
signal->theData[0] = lcpPtr.p->lcpAccptr; signal->theData[1] = sacLcpLocptr.p->locFragid;
signal->theData[1] = sacLcpLocptr.p->locFragid; sendSignal(fragptr.p->accBlockref, GSN_ACC_CONTOPREQ, signal, 2, JBA);
sendSignal(fragptr.p->accBlockref, GSN_ACC_CONTOPREQ, signal, 2, JBA);
count++;
} else if(sacLcpLocptr.p->lcpLocstate == LcpLocRecord::ACC_COMPLETED){
signal->theData[0] = sacLcpLocptr.i;
sendSignal(reference(), GSN_ACC_CONTOPCONF, signal, 1, JBB);
} else {
ndbrequire(false);
}
sacLcpLocptr.i = sacLcpLocptr.p->nextLcpLoc; sacLcpLocptr.i = sacLcpLocptr.p->nextLcpLoc;
} while (sacLcpLocptr.i != RNIL); } while (sacLcpLocptr.i != RNIL);
@ -11311,9 +11286,18 @@ void Dblqh::sendStartLcp(Signal* signal)
signal->theData[0] = stlLcpLocptr.i; signal->theData[0] = stlLcpLocptr.i;
signal->theData[1] = cownref; signal->theData[1] = cownref;
signal->theData[2] = stlLcpLocptr.p->tupRef; signal->theData[2] = stlLcpLocptr.p->tupRef;
sendSignal(fragptr.p->tupBlockref, GSN_TUP_LCPREQ, signal, 3, JBA); if(ERROR_INSERTED(5077))
sendSignalWithDelay(fragptr.p->tupBlockref, GSN_TUP_LCPREQ,
signal, 5000, 3);
else
sendSignal(fragptr.p->tupBlockref, GSN_TUP_LCPREQ, signal, 3, JBA);
stlLcpLocptr.i = stlLcpLocptr.p->nextLcpLoc; stlLcpLocptr.i = stlLcpLocptr.p->nextLcpLoc;
} while (stlLcpLocptr.i != RNIL); } while (stlLcpLocptr.i != RNIL);
if(ERROR_INSERTED(5077))
{
ndbout_c("Delayed TUP_LCPREQ with 5 sec");
}
}//Dblqh::sendStartLcp() }//Dblqh::sendStartLcp()
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View file

@ -82,8 +82,14 @@ inline bool OpenFiles::insert(AsyncFile* file, Uint16 id){
continue; continue;
if(strcmp(m_files[i].m_file->theFileName.c_str(), if(strcmp(m_files[i].m_file->theFileName.c_str(),
file->theFileName.c_str()) == 0){ file->theFileName.c_str()) == 0)
ERROR_SET(fatal, AFS_ERROR_ALLREADY_OPEN,"","OpenFiles::insert()"); {
BaseString names;
names.assfmt("open: >%s< existing: >%s<",
file->theFileName.c_str(),
m_files[i].m_file->theFileName.c_str());
ERROR_SET(fatal, AFS_ERROR_ALLREADY_OPEN, names.c_str(),
"OpenFiles::insert()");
} }
} }

View file

@ -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 minutes handle->read_timeout= 48*60*60*1000; // 48 hours
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;
} }

View file

@ -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)
#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)
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)
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)
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)
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;

View file

@ -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:
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.

View file

@ -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)
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

View file

@ -454,7 +454,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tFirstDataPtr = int2void(tFirstData); tFirstDataPtr = int2void(tFirstData);
if(tFirstDataPtr != 0){ if(tFirstDataPtr != 0){
tOp = void2rec_op(tFirstDataPtr); tOp = void2rec_op(tFirstDataPtr);
if (tOp->checkMagicNumber() == 0) { if (tOp->checkMagicNumber(false) == 0) {
tCon = tOp->theNdbCon; tCon = tOp->theNdbCon;
if (tCon != NULL) { if (tCon != NULL) {
if ((tCon->theSendStatus == NdbTransaction::sendTC_OP) || if ((tCon->theSendStatus == NdbTransaction::sendTC_OP) ||
@ -467,11 +467,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
}//if }//if
}//if }//if
}//if }//if
} else {
#ifdef VM_TRACE
ndbout_c("Recevied TCKEY_FAILREF wo/ operation");
#endif
} }
#ifdef VM_TRACE
ndbout_c("Recevied TCKEY_FAILREF wo/ operation");
#endif
return;
break; break;
} }
case GSN_TCKEYREF: case GSN_TCKEYREF:

View file

@ -144,10 +144,10 @@ ErrorBundle ErrorCodes[] = {
{ 4008, UR, "Receive from NDB failed" }, { 4008, UR, "Receive from NDB failed" },
{ 4009, UR, "Cluster Failure" }, { 4009, UR, "Cluster Failure" },
{ 4012, UR, { 4012, UR,
"Time-out, most likely caused by simple read or cluster failure" }, "Request ndbd time-out, maybe due to high load or communication problems"},
{ 4024, UR, { 4024, UR,
"Time-out, most likely caused by simple read or cluster failure" }, "Time-out, most likely caused by simple read or cluster failure" },
/** /**
* TemporaryResourceError * TemporaryResourceError
*/ */
@ -383,7 +383,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)" },
@ -393,7 +393,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
*/ */

View file

@ -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){
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;
} }
} }

View file

@ -1323,14 +1323,14 @@ TESTCASE("NFNR2_O",
"Test that indexes are correctly maintained during node fail and node restart"){ "Test that indexes are correctly maintained during node fail and node restart"){
TC_PROPERTY("OrderedIndex", 1); TC_PROPERTY("OrderedIndex", 1);
TC_PROPERTY("LoggedIndexes", (unsigned)0); TC_PROPERTY("LoggedIndexes", (unsigned)0);
TC_PROPERTY("PauseThreads", 2); TC_PROPERTY("PauseThreads", 1);
INITIALIZER(runClearTable); INITIALIZER(runClearTable);
INITIALIZER(createRandomIndex); INITIALIZER(createRandomIndex);
INITIALIZER(createPkIndex); INITIALIZER(createPkIndex);
INITIALIZER(runLoadTable); INITIALIZER(runLoadTable);
STEP(runRestarts); STEP(runRestarts);
STEP(runTransactions2); STEP(runTransactions2);
STEP(runTransactions2); //STEP(runTransactions2);
FINALIZER(runVerifyIndex); FINALIZER(runVerifyIndex);
FINALIZER(createRandomIndex_Drop); FINALIZER(createRandomIndex_Drop);
FINALIZER(createPkIndex_Drop); FINALIZER(createPkIndex_Drop);

View file

@ -547,21 +547,64 @@ runLockUpgrade1(NDBT_Context* ctx, NDBT_Step* step){
do do
{ {
CHECK(hugoOps.startTransaction(pNdb) == 0); CHECK(hugoOps.startTransaction(pNdb) == 0);
CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0); if(ctx->getProperty("LOCK_UPGRADE", 1) == 1)
CHECK(hugoOps.execute_NoCommit(pNdb) == 0); {
CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
ctx->setProperty("READ_DONE", 1); ctx->setProperty("READ_DONE", 1);
ctx->broadcast(); ctx->broadcast();
ndbout_c("wait 2"); ndbout_c("wait 2");
ctx->getPropertyWait("READ_DONE", 2); ctx->getPropertyWait("READ_DONE", 2);
ndbout_c("wait 2 - done"); ndbout_c("wait 2 - done");
}
else
{
ctx->setProperty("READ_DONE", 1);
ctx->broadcast();
ctx->getPropertyWait("READ_DONE", 2);
ndbout_c("wait 2 - done");
CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
}
if(ctx->getProperty("LU_OP", o_INS) == o_INS)
{
CHECK(hugoOps.pkDeleteRecord(pNdb, 0, 1) == 0);
CHECK(hugoOps.pkInsertRecord(pNdb, 0, 1, 2) == 0);
}
else if(ctx->getProperty("LU_OP", o_UPD) == o_UPD)
{
CHECK(hugoOps.pkUpdateRecord(pNdb, 0, 1, 2) == 0);
}
else
{
CHECK(hugoOps.pkDeleteRecord(pNdb, 0, 1) == 0);
}
ctx->setProperty("READ_DONE", 3); ctx->setProperty("READ_DONE", 3);
ctx->broadcast(); ctx->broadcast();
ndbout_c("before update"); ndbout_c("before update");
CHECK(hugoOps.pkUpdateRecord(pNdb, 0, 1, 2) == 0);
ndbout_c("wait update"); ndbout_c("wait update");
CHECK(hugoOps.execute_NoCommit(pNdb) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0);
CHECK(hugoOps.closeTransaction(pNdb)); CHECK(hugoOps.closeTransaction(pNdb) == 0);
CHECK(hugoOps.startTransaction(pNdb) == 0);
CHECK(hugoOps.pkReadRecord(pNdb, 0, 1) == 0);
int res= hugoOps.execute_Commit(pNdb);
if(ctx->getProperty("LU_OP", o_INS) == o_INS)
{
CHECK(res == 0);
CHECK(hugoOps.verifyUpdatesValue(2) == 0);
}
else if(ctx->getProperty("LU_OP", o_UPD) == o_UPD)
{
CHECK(res == 0);
CHECK(hugoOps.verifyUpdatesValue(2) == 0);
}
else
{
CHECK(res == 626);
}
} while(0); } while(0);
return result; return result;
@ -592,10 +635,10 @@ runLockUpgrade2(NDBT_Context* ctx, NDBT_Step* step){
ndbout_c("wait 3 - done"); ndbout_c("wait 3 - done");
NdbSleep_MilliSleep(200); NdbSleep_MilliSleep(200);
CHECK(hugoOps.execute_Commit(pNdb) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0);
} while(0); } while(0);
return NDBT_FAILED; return result;
} }
int int
@ -607,11 +650,16 @@ main(int argc, const char** argv){
NDBT_TestSuite ts("testOperations"); NDBT_TestSuite ts("testOperations");
for(Uint32 i = 0; i <6; i++)
{ {
BaseString name("bug_9749"); BaseString name("bug_9749");
name.appfmt("_%d", i);
NDBT_TestCaseImpl1 *pt = new NDBT_TestCaseImpl1(&ts, NDBT_TestCaseImpl1 *pt = new NDBT_TestCaseImpl1(&ts,
name.c_str(), ""); name.c_str(), "");
pt->setProperty("LOCK_UPGRADE", 1 + (i & 1));
pt->setProperty("LU_OP", 1 + (i >> 1));
pt->addInitializer(new NDBT_Initializer(pt, pt->addInitializer(new NDBT_Initializer(pt,
"runClearTable", "runClearTable",
runClearTable)); runClearTable));

View file

@ -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

View file

@ -244,7 +244,11 @@ 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,
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,
"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,
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,
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,
"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,
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[] = {
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
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;