Commit 591aedaa authored by unknown's avatar unknown

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

into  perch.ndb.mysql.com:/home/jonas/src/41-work

parents 367442f7 ad6dcfb1
...@@ -44,7 +44,8 @@ private: ...@@ -44,7 +44,8 @@ private:
CHECK_WAIT_DROP_TAB_FAILED_LQH = 16, CHECK_WAIT_DROP_TAB_FAILED_LQH = 16,
TRIGGER_PENDING = 17, TRIGGER_PENDING = 17,
DelayTCKEYCONF = 18 DelayTCKEYCONF = 18,
ZNF_CHECK_TRANSACTIONS = 19
}; };
}; };
......
...@@ -1038,7 +1038,8 @@ private: ...@@ -1038,7 +1038,8 @@ private:
void prepareReplicas(FragmentstorePtr regFragptr); void prepareReplicas(FragmentstorePtr regFragptr);
void removeNodeFromStored(Uint32 nodeId, void removeNodeFromStored(Uint32 nodeId,
FragmentstorePtr regFragptr, FragmentstorePtr regFragptr,
ReplicaRecordPtr replicaPtr); ReplicaRecordPtr replicaPtr,
bool temporary);
void removeOldStoredReplica(FragmentstorePtr regFragptr, void removeOldStoredReplica(FragmentstorePtr regFragptr,
ReplicaRecordPtr replicaPtr); ReplicaRecordPtr replicaPtr);
void removeStoredReplica(FragmentstorePtr regFragptr, void removeStoredReplica(FragmentstorePtr regFragptr,
......
...@@ -5212,6 +5212,7 @@ void Dbdih::removeNodeFromTable(Signal* signal, ...@@ -5212,6 +5212,7 @@ void Dbdih::removeNodeFromTable(Signal* signal,
//const Uint32 lcpId = SYSFILE->latestLCP_ID; //const Uint32 lcpId = SYSFILE->latestLCP_ID;
const bool lcpOngoingFlag = (tabPtr.p->tabLcpStatus== TabRecord::TLS_ACTIVE); const bool lcpOngoingFlag = (tabPtr.p->tabLcpStatus== TabRecord::TLS_ACTIVE);
const bool temporary = !tabPtr.p->storedTable;
FragmentstorePtr fragPtr; FragmentstorePtr fragPtr;
for(Uint32 fragNo = 0; fragNo < tabPtr.p->totalfragments; fragNo++){ for(Uint32 fragNo = 0; fragNo < tabPtr.p->totalfragments; fragNo++){
...@@ -5232,7 +5233,7 @@ void Dbdih::removeNodeFromTable(Signal* signal, ...@@ -5232,7 +5233,7 @@ void Dbdih::removeNodeFromTable(Signal* signal,
jam(); jam();
found = true; found = true;
noOfRemovedReplicas++; noOfRemovedReplicas++;
removeNodeFromStored(nodeId, fragPtr, replicaPtr); removeNodeFromStored(nodeId, fragPtr, replicaPtr, temporary);
if(replicaPtr.p->lcpOngoingFlag){ if(replicaPtr.p->lcpOngoingFlag){
jam(); jam();
/** /**
...@@ -12051,9 +12052,18 @@ void Dbdih::removeDeadNode(NodeRecordPtr removeNodePtr) ...@@ -12051,9 +12052,18 @@ void Dbdih::removeDeadNode(NodeRecordPtr removeNodePtr)
/*---------------------------------------------------------------*/ /*---------------------------------------------------------------*/
void Dbdih::removeNodeFromStored(Uint32 nodeId, void Dbdih::removeNodeFromStored(Uint32 nodeId,
FragmentstorePtr fragPtr, FragmentstorePtr fragPtr,
ReplicaRecordPtr replicatePtr) ReplicaRecordPtr replicatePtr,
bool temporary)
{ {
newCrashedReplica(nodeId, replicatePtr); if (!temporary)
{
jam();
newCrashedReplica(nodeId, replicatePtr);
}
else
{
jam();
}
removeStoredReplica(fragPtr, replicatePtr); removeStoredReplica(fragPtr, replicatePtr);
linkOldStoredReplica(fragPtr, replicatePtr); linkOldStoredReplica(fragPtr, replicatePtr);
ndbrequire(fragPtr.p->storedReplicas != RNIL); ndbrequire(fragPtr.p->storedReplicas != RNIL);
......
...@@ -18448,6 +18448,172 @@ Dblqh::execDUMP_STATE_ORD(Signal* signal) ...@@ -18448,6 +18448,172 @@ Dblqh::execDUMP_STATE_ORD(Signal* signal)
c_error_insert_table_id = dumpState->args[1]; c_error_insert_table_id = dumpState->args[1];
SET_ERROR_INSERT_VALUE(5042); SET_ERROR_INSERT_VALUE(5042);
} }
TcConnectionrec *regTcConnectionrec = tcConnectionrec;
Uint32 ttcConnectrecFileSize = ctcConnectrecFileSize;
Uint32 arg = dumpState->args[0];
if(arg == 2306)
{
for(Uint32 i = 0; i<1024; i++)
{
TcConnectionrecPtr tcRec;
tcRec.i = ctransidHash[i];
while(tcRec.i != RNIL)
{
ptrCheckGuard(tcRec, ttcConnectrecFileSize, regTcConnectionrec);
ndbout << "TcConnectionrec " << tcRec.i;
signal->theData[0] = 2307;
signal->theData[1] = tcRec.i;
execDUMP_STATE_ORD(signal);
tcRec.i = tcRec.p->nextHashRec;
}
}
}
if(arg == 2307 || arg == 2308)
{
TcConnectionrecPtr tcRec;
tcRec.i = signal->theData[1];
ptrCheckGuard(tcRec, ttcConnectrecFileSize, regTcConnectionrec);
ndbout << " transactionState = " << tcRec.p->transactionState<<endl;
ndbout << " operation = " << tcRec.p->operation<<endl;
ndbout << " tcNodeFailrec = " << tcRec.p->tcNodeFailrec
<< " seqNoReplica = " << tcRec.p->seqNoReplica
<< " simpleRead = " << tcRec.p->simpleRead
<< endl;
ndbout << " replicaType = " << tcRec.p->replicaType
<< " reclenAiLqhkey = " << tcRec.p->reclenAiLqhkey
<< " opExec = " << tcRec.p->opExec
<< endl;
ndbout << " opSimple = " << tcRec.p->opSimple
<< " nextSeqNoReplica = " << tcRec.p->nextSeqNoReplica
<< " lockType = " << tcRec.p->lockType
<< endl;
ndbout << " lastReplicaNo = " << tcRec.p->lastReplicaNo
<< " indTakeOver = " << tcRec.p->indTakeOver
<< " dirtyOp = " << tcRec.p->dirtyOp
<< endl;
ndbout << " activeCreat = " << tcRec.p->activeCreat
<< " tcBlockref = " << hex << tcRec.p->tcBlockref
<< " reqBlockref = " << hex << tcRec.p->reqBlockref
<< " primKeyLen = " << tcRec.p->primKeyLen
<< endl;
ndbout << " nextReplica = " << tcRec.p->nextReplica
<< " tcBlockref = " << hex << tcRec.p->tcBlockref
<< " reqBlockref = " << hex << tcRec.p->reqBlockref
<< " primKeyLen = " << tcRec.p->primKeyLen
<< endl;
ndbout << " logStopPageNo = " << tcRec.p->logStopPageNo
<< " logStartPageNo = " << tcRec.p->logStartPageNo
<< " logStartPageIndex = " << tcRec.p->logStartPageIndex
<< endl;
ndbout << " errorCode = " << tcRec.p->errorCode
<< " clientBlockref = " << hex << tcRec.p->clientBlockref
<< " applRef = " << hex << tcRec.p->applRef
<< " totSendlenAi = " << tcRec.p->totSendlenAi
<< endl;
ndbout << " totReclenAi = " << tcRec.p->totReclenAi
<< " tcScanRec = " << tcRec.p->tcScanRec
<< " tcScanInfo = " << tcRec.p->tcScanInfo
<< " tcOprec = " << hex << tcRec.p->tcOprec
<< endl;
ndbout << " tableref = " << tcRec.p->tableref
<< " simpleTcConnect = " << tcRec.p->simpleTcConnect
<< " storedProcId = " << tcRec.p->storedProcId
<< " schemaVersion = " << tcRec.p->schemaVersion
<< endl;
ndbout << " reqinfo = " << tcRec.p->reqinfo
<< " reqRef = " << tcRec.p->reqRef
<< " readlenAi = " << tcRec.p->readlenAi
<< " prevTc = " << tcRec.p->prevTc
<< endl;
ndbout << " prevLogTcrec = " << tcRec.p->prevLogTcrec
<< " prevHashRec = " << tcRec.p->prevHashRec
<< " nodeAfterNext0 = " << tcRec.p->nodeAfterNext[0]
<< " nodeAfterNext1 = " << tcRec.p->nodeAfterNext[1]
<< endl;
ndbout << " nextTcConnectrec = " << tcRec.p->nextTcConnectrec
<< " nextTc = " << tcRec.p->nextTc
<< " nextTcLogQueue = " << tcRec.p->nextTcLogQueue
<< " nextLogTcrec = " << tcRec.p->nextLogTcrec
<< endl;
ndbout << " nextHashRec = " << tcRec.p->nextHashRec
<< " logWriteState = " << tcRec.p->logWriteState
<< " logStartFileNo = " << tcRec.p->logStartFileNo
<< " listState = " << tcRec.p->listState
<< endl;
ndbout << " lastAttrinbuf = " << tcRec.p->lastAttrinbuf
<< " lastTupkeybuf = " << tcRec.p->lastTupkeybuf
<< " hashValue = " << tcRec.p->hashValue
<< endl;
ndbout << " gci = " << tcRec.p->gci
<< " fragmentptr = " << tcRec.p->fragmentptr
<< " fragmentid = " << tcRec.p->fragmentid
<< " firstTupkeybuf = " << tcRec.p->firstTupkeybuf
<< endl;
ndbout << " firstAttrinbuf = " << tcRec.p->firstAttrinbuf
<< " currTupAiLen = " << tcRec.p->currTupAiLen
<< " currReclenAi = " << tcRec.p->currReclenAi
<< endl;
ndbout << " tcTimer = " << tcRec.p->tcTimer
<< " clientConnectrec = " << tcRec.p->clientConnectrec
<< " applOprec = " << hex << tcRec.p->applOprec
<< " abortState = " << tcRec.p->abortState
<< endl;
ndbout << " transid0 = " << hex << tcRec.p->transid[0]
<< " transid1 = " << hex << tcRec.p->transid[1]
<< " tupkeyData0 = " << tcRec.p->tupkeyData[0]
<< " tupkeyData1 = " << tcRec.p->tupkeyData[1]
<< endl;
ndbout << " tupkeyData2 = " << tcRec.p->tupkeyData[2]
<< " tupkeyData3 = " << tcRec.p->tupkeyData[3]
<< endl;
switch (tcRec.p->transactionState) {
case TcConnectionrec::SCAN_STATE_USED:
if (tcRec.p->tcScanRec < cscanrecFileSize){
ScanRecordPtr TscanPtr;
c_scanRecordPool.getPtr(TscanPtr, tcRec.p->tcScanRec);
ndbout << " scanState = " << TscanPtr.p->scanState << endl;
//TscanPtr.p->scanLocalref[2];
ndbout << " copyPtr="<<TscanPtr.p->copyPtr
<< " scanAccPtr="<<TscanPtr.p->scanAccPtr
<< " scanAiLength="<<TscanPtr.p->scanAiLength
<< endl;
ndbout << " m_curr_batch_size_rows="<<
TscanPtr.p->m_curr_batch_size_rows
<< " m_max_batch_size_rows="<<
TscanPtr.p->m_max_batch_size_rows
<< " scanErrorCounter="<<TscanPtr.p->scanErrorCounter
<< endl;
ndbout << " scanSchemaVersion="<<TscanPtr.p->scanSchemaVersion
<< " scanStoredProcId="<<TscanPtr.p->scanStoredProcId
<< " scanTcrec="<<TscanPtr.p->scanTcrec
<< endl;
ndbout << " scanType="<<TscanPtr.p->scanType
<< " scanApiBlockref="<<TscanPtr.p->scanApiBlockref
<< " scanNodeId="<<TscanPtr.p->scanNodeId
<< " scanCompletedStatus="<<TscanPtr.p->scanCompletedStatus
<< endl;
ndbout << " scanFlag="<<TscanPtr.p->scanFlag
<< " scanLockHold="<<TscanPtr.p->scanLockHold
<< " scanLockMode="<<TscanPtr.p->scanLockMode
<< " scanNumber="<<TscanPtr.p->scanNumber
<< endl;
ndbout << " scanReleaseCounter="<<TscanPtr.p->scanReleaseCounter
<< " scanTcWaiting="<<TscanPtr.p->scanTcWaiting
<< " scanKeyinfoFlag="<<TscanPtr.p->scanKeyinfoFlag
<< endl;
} else{
ndbout << "No connected scan record found" << endl;
}
break;
default:
break;
}
ndbrequire(arg != 2308);
}
}//Dblqh::execDUMP_STATE_ORD() }//Dblqh::execDUMP_STATE_ORD()
......
...@@ -211,14 +211,6 @@ public: ...@@ -211,14 +211,6 @@ public:
LTS_ACTIVE = 1 LTS_ACTIVE = 1
}; };
enum TakeOverState {
TOS_NOT_DEFINED = 0,
TOS_IDLE = 1,
TOS_ACTIVE = 2,
TOS_COMPLETED = 3,
TOS_NODE_FAILED = 4
};
enum FailState { enum FailState {
FS_IDLE = 0, FS_IDLE = 0,
FS_LISTENING = 1, FS_LISTENING = 1,
...@@ -636,6 +628,7 @@ public: ...@@ -636,6 +628,7 @@ public:
ConnectionState apiConnectstate; ConnectionState apiConnectstate;
UintR transid[2]; UintR transid[2];
UintR firstTcConnect; UintR firstTcConnect;
NdbNodeBitmask m_transaction_nodes;
//--------------------------------------------------- //---------------------------------------------------
// Second 16 byte cache line. Hot variables. // Second 16 byte cache line. Hot variables.
...@@ -932,7 +925,6 @@ public: ...@@ -932,7 +925,6 @@ public:
struct HostRecord { struct HostRecord {
HostState hostStatus; HostState hostStatus;
LqhTransState lqhTransStatus; LqhTransState lqhTransStatus;
TakeOverState takeOverStatus;
bool inPackedList; bool inPackedList;
UintR noOfPackedWordsLqh; UintR noOfPackedWordsLqh;
UintR packedWordsLqh[26]; UintR packedWordsLqh[26];
...@@ -941,6 +933,17 @@ public: ...@@ -941,6 +933,17 @@ public:
UintR noOfWordsTCINDXCONF; UintR noOfWordsTCINDXCONF;
UintR packedWordsTCINDXCONF[30]; UintR packedWordsTCINDXCONF[30];
BlockReference hostLqhBlockRef; BlockReference hostLqhBlockRef;
enum NodeFailBits
{
NF_TAKEOVER = 0x1,
NF_CHECK_SCAN = 0x2,
NF_CHECK_TRANSACTION = 0x4,
NF_CHECK_DROP_TAB = 0x8,
NF_NODE_FAIL_BITS = 0xF // All bits...
};
Uint32 m_nf_bits;
NdbNodeBitmask m_lqh_trans_conf;
}; /* p2c: size = 128 bytes */ }; /* p2c: size = 128 bytes */
typedef Ptr<HostRecord> HostRecordPtr; typedef Ptr<HostRecord> HostRecordPtr;
...@@ -1578,7 +1581,7 @@ private: ...@@ -1578,7 +1581,7 @@ private:
void wrongSchemaVersionErrorLab(Signal* signal); void wrongSchemaVersionErrorLab(Signal* signal);
void noFreeConnectionErrorLab(Signal* signal); void noFreeConnectionErrorLab(Signal* signal);
void tckeyreq050Lab(Signal* signal); void tckeyreq050Lab(Signal* signal);
void timeOutFoundLab(Signal* signal, UintR anAdd); void timeOutFoundLab(Signal* signal, UintR anAdd, Uint32 errCode);
void completeTransAtTakeOverLab(Signal* signal, UintR TtakeOverInd); void completeTransAtTakeOverLab(Signal* signal, UintR TtakeOverInd);
void completeTransAtTakeOverDoLast(Signal* signal, UintR TtakeOverInd); void completeTransAtTakeOverDoLast(Signal* signal, UintR TtakeOverInd);
void completeTransAtTakeOverDoOne(Signal* signal, UintR TtakeOverInd); void completeTransAtTakeOverDoOne(Signal* signal, UintR TtakeOverInd);
...@@ -1600,6 +1603,9 @@ private: ...@@ -1600,6 +1603,9 @@ private:
void checkScanFragList(Signal*, Uint32 failedNodeId, ScanRecord * scanP, void checkScanFragList(Signal*, Uint32 failedNodeId, ScanRecord * scanP,
LocalDLList<ScanFragRec>::Head&); LocalDLList<ScanFragRec>::Head&);
void nodeFailCheckTransactions(Signal*,Uint32 transPtrI,Uint32 failedNodeId);
void checkNodeFailComplete(Signal* signal, Uint32 failedNodeId, Uint32 bit);
// Initialisation // Initialisation
void initData(); void initData();
void initRecords(); void initRecords();
...@@ -1626,6 +1632,7 @@ private: ...@@ -1626,6 +1632,7 @@ private:
HostRecord *hostRecord; HostRecord *hostRecord;
HostRecordPtr hostptr; HostRecordPtr hostptr;
UintR chostFilesize; UintR chostFilesize;
NdbNodeBitmask c_alive_nodes;
GcpRecord *gcpRecord; GcpRecord *gcpRecord;
GcpRecordPtr gcpPtr; GcpRecordPtr gcpPtr;
......
This diff is collapsed.
...@@ -257,6 +257,7 @@ void Qmgr::setArbitTimeout(UintR aArbitTimeout) ...@@ -257,6 +257,7 @@ void Qmgr::setArbitTimeout(UintR aArbitTimeout)
void Qmgr::execCONNECT_REP(Signal* signal) void Qmgr::execCONNECT_REP(Signal* signal)
{ {
jamEntry();
const Uint32 nodeId = signal->theData[0]; const Uint32 nodeId = signal->theData[0];
c_connectedNodes.set(nodeId); c_connectedNodes.set(nodeId);
NodeRecPtr nodePtr; NodeRecPtr nodePtr;
...@@ -264,9 +265,13 @@ void Qmgr::execCONNECT_REP(Signal* signal) ...@@ -264,9 +265,13 @@ void Qmgr::execCONNECT_REP(Signal* signal)
ptrCheckGuard(nodePtr, MAX_NODES, nodeRec); ptrCheckGuard(nodePtr, MAX_NODES, nodeRec);
switch(nodePtr.p->phase){ switch(nodePtr.p->phase){
case ZSTARTING: case ZSTARTING:
case ZRUNNING:
jam(); jam();
if(!c_start.m_nodes.isWaitingFor(nodeId)){
jam();
return;
}
break; break;
case ZRUNNING:
case ZPREPARE_FAIL: case ZPREPARE_FAIL:
case ZFAIL_CLOSING: case ZFAIL_CLOSING:
jam(); jam();
...@@ -277,21 +282,28 @@ void Qmgr::execCONNECT_REP(Signal* signal) ...@@ -277,21 +282,28 @@ void Qmgr::execCONNECT_REP(Signal* signal)
case ZAPI_INACTIVE: case ZAPI_INACTIVE:
return; return;
} }
if(!c_start.m_nodes.isWaitingFor(nodeId)){
jam();
return;
}
switch(c_start.m_gsn){ switch(c_start.m_gsn){
case GSN_CM_REGREQ: case GSN_CM_REGREQ:
jam(); jam();
sendCmRegReq(signal, nodeId); sendCmRegReq(signal, nodeId);
return; return;
case GSN_CM_NODEINFOREQ:{ case GSN_CM_NODEINFOREQ:
jam(); jam();
sendCmNodeInfoReq(signal, nodeId, nodePtr.p); sendCmNodeInfoReq(signal, nodeId, nodePtr.p);
return; return;
case GSN_CM_ADD:{
jam();
ndbrequire(getOwnNodeId() != cpresident);
c_start.m_nodes.clearWaitingFor(nodeId);
c_start.m_gsn = RNIL;
NodeRecPtr addNodePtr;
addNodePtr.i = nodeId;
ptrCheckGuard(addNodePtr, MAX_NDB_NODES, nodeRec);
cmAddPrepare(signal, addNodePtr, nodePtr.p);
return;
} }
default: default:
return; return;
...@@ -924,15 +936,27 @@ Qmgr::cmAddPrepare(Signal* signal, NodeRecPtr nodePtr, const NodeRec * self){ ...@@ -924,15 +936,27 @@ Qmgr::cmAddPrepare(Signal* signal, NodeRecPtr nodePtr, const NodeRec * self){
return; return;
case ZFAIL_CLOSING: case ZFAIL_CLOSING:
jam(); jam();
#ifdef VM_TRACE
ndbout_c("Enabling communication to CM_ADD node state=%d", #if 1
nodePtr.p->phase); warningEvent("Recieved request to incorperate node %u, "
#endif "while error handling has not yet completed",
nodePtr.i);
ndbrequire(getOwnNodeId() != cpresident);
ndbrequire(signal->header.theVerId_signalNumber == GSN_CM_ADD);
c_start.m_nodes.clearWaitingFor();
c_start.m_nodes.setWaitingFor(nodePtr.i);
c_start.m_gsn = GSN_CM_ADD;
#else
warningEvent("Enabling communication to CM_ADD node %u state=%d",
nodePtr.i,
nodePtr.p->phase);
nodePtr.p->phase = ZSTARTING; nodePtr.p->phase = ZSTARTING;
nodePtr.p->failState = NORMAL; nodePtr.p->failState = NORMAL;
signal->theData[0] = 0; signal->theData[0] = 0;
signal->theData[1] = nodePtr.i; signal->theData[1] = nodePtr.i;
sendSignal(CMVMI_REF, GSN_OPEN_COMREQ, signal, 2, JBA); sendSignal(CMVMI_REF, GSN_OPEN_COMREQ, signal, 2, JBA);
#endif
return; return;
case ZSTARTING: case ZSTARTING:
break; break;
...@@ -1766,11 +1790,27 @@ void Qmgr::execNDB_FAILCONF(Signal* signal) ...@@ -1766,11 +1790,27 @@ void Qmgr::execNDB_FAILCONF(Signal* signal)
jamEntry(); jamEntry();
failedNodePtr.i = signal->theData[0]; failedNodePtr.i = signal->theData[0];
if (ERROR_INSERTED(930))
{
CLEAR_ERROR_INSERT_VALUE;
infoEvent("Discarding NDB_FAILCONF for %u", failedNodePtr.i);
return;
}
ptrCheckGuard(failedNodePtr, MAX_NODES, nodeRec); ptrCheckGuard(failedNodePtr, MAX_NODES, nodeRec);
if (failedNodePtr.p->failState == WAITING_FOR_NDB_FAILCONF){ if (failedNodePtr.p->failState == WAITING_FOR_NDB_FAILCONF){
failedNodePtr.p->failState = NORMAL; failedNodePtr.p->failState = NORMAL;
} else { } else {
jam(); jam();
char buf[100];
BaseString::snprintf(buf, 100,
"Received NDB_FAILCONF for node %u with state: %d %d",
failedNodePtr.i,
failedNodePtr.p->phase,
failedNodePtr.p->failState);
progError(__LINE__, 0, buf);
systemErrorLab(signal, __LINE__); systemErrorLab(signal, __LINE__);
}//if }//if
if (cpresident == getOwnNodeId()) { if (cpresident == getOwnNodeId()) {
...@@ -2077,10 +2117,42 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode, ...@@ -2077,10 +2117,42 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
ptrCheckGuard(failedNodePtr, MAX_NODES, nodeRec); ptrCheckGuard(failedNodePtr, MAX_NODES, nodeRec);
if (failedNodePtr.i == getOwnNodeId()) { if (failedNodePtr.i == getOwnNodeId()) {
jam(); jam();
systemErrorLab(signal, __LINE__);
const char * msg = 0;
switch(aFailCause){
case FailRep::ZOWN_FAILURE:
msg = "Own failure";
break;
case FailRep::ZOTHER_NODE_WHEN_WE_START:
case FailRep::ZOTHERNODE_FAILED_DURING_START:
msg = "Other node died during start";
break;
case FailRep::ZIN_PREP_FAIL_REQ:
msg = "Prep fail";
break;
case FailRep::ZSTART_IN_REGREQ:
msg = "Start timeout";
break;
case FailRep::ZHEARTBEAT_FAILURE:
msg = "Hearbeat failure";
break;
case FailRep::ZLINK_FAILURE:
msg = "Connection failure";
break;
}
char buf[100];
BaseString::snprintf(buf, 100,
"We(%u) have been declared dead by %u reason: %s(%u)",
getOwnNodeId(),
refToNode(signal->getSendersBlockRef()),
aFailCause,
msg ? msg : "<Unknown>");
progError(__LINE__, 0, buf);
return; return;
}//if }//if
myNodePtr.i = getOwnNodeId(); myNodePtr.i = getOwnNodeId();
ptrCheckGuard(myNodePtr, MAX_NDB_NODES, nodeRec); ptrCheckGuard(myNodePtr, MAX_NDB_NODES, nodeRec);
if (myNodePtr.p->phase != ZRUNNING) { if (myNodePtr.p->phase != ZRUNNING) {
...@@ -2791,6 +2863,7 @@ void Qmgr::failReport(Signal* signal, ...@@ -2791,6 +2863,7 @@ void Qmgr::failReport(Signal* signal,
cfailureNr = cprepareFailureNr; cfailureNr = cprepareFailureNr;
ctoFailureNr = 0; ctoFailureNr = 0;
ctoStatus = Q_ACTIVE; ctoStatus = Q_ACTIVE;
c_start.reset(); // Don't take over nodes being started
if (cnoCommitFailedNodes > 0) { if (cnoCommitFailedNodes > 0) {
jam(); jam();
/**----------------------------------------------------------------- /**-----------------------------------------------------------------
......
...@@ -450,12 +450,12 @@ NdbConnection::executeNoBlobs(ExecType aTypeOfExec, ...@@ -450,12 +450,12 @@ NdbConnection::executeNoBlobs(ExecType aTypeOfExec,
//------------------------------------------------------------------------ //------------------------------------------------------------------------
Ndb* tNdb = theNdb; Ndb* tNdb = theNdb;
Uint32 timeout = TransporterFacade::instance()->m_waitfor_timeout;
m_waitForReply = false; m_waitForReply = false;
executeAsynchPrepare(aTypeOfExec, NULL, NULL, abortOption); executeAsynchPrepare(aTypeOfExec, NULL, NULL, abortOption);
if (m_waitForReply){ if (m_waitForReply){
while (1) { while (1) {
int noOfComp = tNdb->sendPollNdb((3 * WAITFOR_RESPONSE_TIMEOUT), int noOfComp = tNdb->sendPollNdb(3 * timeout, 1, forceSend);
1, forceSend);
if (noOfComp == 0) { if (noOfComp == 0) {
/** /**
* This timeout situation can occur if NDB crashes. * This timeout situation can occur if NDB crashes.
......
...@@ -954,23 +954,25 @@ Ndb::pollCompleted(NdbConnection** aCopyArray) ...@@ -954,23 +954,25 @@ Ndb::pollCompleted(NdbConnection** aCopyArray)
void void
Ndb::check_send_timeout() Ndb::check_send_timeout()
{ {
Uint32 timeout = TransporterFacade::instance()->m_waitfor_timeout;
NDB_TICKS current_time = NdbTick_CurrentMillisecond(); NDB_TICKS current_time = NdbTick_CurrentMillisecond();
if (current_time - the_last_check_time > 1000) { if (current_time - the_last_check_time > 1000) {
the_last_check_time = current_time; the_last_check_time = current_time;
Uint32 no_of_sent = theNoOfSentTransactions; Uint32 no_of_sent = theNoOfSentTransactions;
for (Uint32 i = 0; i < no_of_sent; i++) { for (Uint32 i = 0; i < no_of_sent; i++) {
NdbConnection* a_con = theSentTransactionsArray[i]; NdbConnection* a_con = theSentTransactionsArray[i];
if ((current_time - a_con->theStartTransTime) > if ((current_time - a_con->theStartTransTime) > timeout)
WAITFOR_RESPONSE_TIMEOUT) { {
#ifdef VM_TRACE #ifdef VM_TRACE
a_con->printState(); a_con->printState();
Uint32 t1 = a_con->theTransactionId; Uint32 t1 = a_con->theTransactionId;
Uint32 t2 = a_con->theTransactionId >> 32; Uint32 t2 = a_con->theTransactionId >> 32;
ndbout_c("[%.8x %.8x]", t1, t2); ndbout_c("4012 [%.8x %.8x]", t1, t2);
abort(); //abort();
#endif #endif
a_con->theReleaseOnClose = true;
a_con->setOperationErrorCodeAbort(4012); a_con->setOperationErrorCodeAbort(4012);
a_con->theCommitStatus = NdbConnection::Aborted; a_con->theCommitStatus = NdbConnection::NeedAbort;
a_con->theCompletionStatus = NdbConnection::CompletedFailure; a_con->theCompletionStatus = NdbConnection::CompletedFailure;
a_con->handleExecuteCompletion(); a_con->handleExecuteCompletion();
remove_sent_list(i); remove_sent_list(i);
......
...@@ -567,6 +567,19 @@ TransporterFacade::init(Uint32 nodeId, const ndb_mgm_configuration* props) ...@@ -567,6 +567,19 @@ TransporterFacade::init(Uint32 nodeId, const ndb_mgm_configuration* props)
} }
#endif #endif
Uint32 timeout = 120000;
iter.first();
for (iter.first(); iter.valid(); iter.next())
{
Uint32 tmp1 = 0, tmp2 = 0;
iter.get(CFG_DB_TRANSACTION_CHECK_INTERVAL, &tmp1);
iter.get(CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT, &tmp2);
tmp1 += tmp2;
if (tmp1 > timeout)
timeout = tmp1;
}
m_waitfor_timeout = timeout;
if (!theTransporterRegistry->start_service(m_socket_server)){ if (!theTransporterRegistry->start_service(m_socket_server)){
ndbout_c("Unable to start theTransporterRegistry->start_service"); ndbout_c("Unable to start theTransporterRegistry->start_service");
DBUG_RETURN(false); DBUG_RETURN(false);
......
...@@ -172,6 +172,7 @@ private: ...@@ -172,6 +172,7 @@ private:
*/ */
public: public:
STATIC_CONST( MAX_NO_THREADS = 4711 ); STATIC_CONST( MAX_NO_THREADS = 4711 );
Uint32 m_waitfor_timeout; // in milli seconds...
private: private:
struct ThreadData { struct ThreadData {
......
...@@ -535,6 +535,52 @@ err: ...@@ -535,6 +535,52 @@ err:
return NDBT_FAILED; return NDBT_FAILED;
} }
int
runBug16772(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
if (restarter.getNumDbNodes() < 2)
{
ctx->stopTest();
return NDBT_OK;
}
int aliveNodeId = restarter.getRandomNotMasterNodeId(rand());
int deadNodeId = aliveNodeId;
while (deadNodeId == aliveNodeId)
deadNodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
if (restarter.insertErrorInNode(aliveNodeId, 930))
return NDBT_FAILED;
if (restarter.restartOneDbNode(deadNodeId,
/** initial */ false,
/** nostart */ true,
/** abort */ true))
return NDBT_FAILED;
if (restarter.waitNodesNoStart(&deadNodeId, 1))
return NDBT_FAILED;
if (restarter.startNodes(&deadNodeId, 1))
return NDBT_FAILED;
// It should now be hanging since we throw away NDB_FAILCONF
int ret = restarter.waitNodesStartPhase(&deadNodeId, 1, 3, 10);
// So this should fail...i.e it should not reach startphase 3
// Now send a NDB_FAILCONF for deadNo
int dump[] = { 7020, 323, 252, 0 };
dump[3] = deadNodeId;
if (restarter.dumpStateOneNode(aliveNodeId, dump, 4))
return NDBT_FAILED;
if (restarter.waitNodesStarted(&deadNodeId, 1))
return NDBT_FAILED;
return ret ? NDBT_OK : NDBT_FAILED;
}
NDBT_TESTSUITE(testNodeRestart); NDBT_TESTSUITE(testNodeRestart);
TESTCASE("NoLoad", TESTCASE("NoLoad",
...@@ -820,6 +866,10 @@ TESTCASE("Bug15685", ...@@ -820,6 +866,10 @@ TESTCASE("Bug15685",
STEP(runBug15685); STEP(runBug15685);
FINALIZER(runClearTable); FINALIZER(runClearTable);
} }
TESTCASE("Bug16772",
"Test bug with restarting before NF handling is complete"){
STEP(runBug16772);
}
NDBT_TESTSUITE_END(testNodeRestart); NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){ int main(int argc, const char** argv){
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define TIMEOUT (Uint32)3000 #define TIMEOUT (Uint32)3000
Uint32 g_org_timeout = 3000; Uint32 g_org_timeout = 3000;
Uint32 g_org_deadlock = 3000;
int int
setTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){ setTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){
...@@ -59,6 +60,60 @@ resetTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -59,6 +60,60 @@ resetTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK; return NDBT_OK;
} }
int
setDeadlockTimeout(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
int timeout = ctx->getProperty("TransactionDeadlockTimeout", TIMEOUT);
NdbConfig conf(GETNDB(step)->getNodeId()+1);
unsigned int nodeId = conf.getMasterNodeId();
if (!conf.getProperty(nodeId,
NODE_TYPE_DB,
CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT,
&g_org_deadlock))
return NDBT_FAILED;
g_err << "Setting timeout: " << timeout << endl;
int val[] = { DumpStateOrd::TcSetTransactionTimeout, timeout };
if(restarter.dumpStateAllNodes(val, 2) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
int
getDeadlockTimeout(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
Uint32 val = 0;
NdbConfig conf(GETNDB(step)->getNodeId()+1);
unsigned int nodeId = conf.getMasterNodeId();
if (!conf.getProperty(nodeId,
NODE_TYPE_DB,
CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT,
&val))
return NDBT_FAILED;
if (val < 120000)
val = 120000;
ctx->setProperty("TransactionDeadlockTimeout", 4*val);
return NDBT_OK;
}
int
resetDeadlockTimeout(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
int val[] = { DumpStateOrd::TcSetTransactionTimeout, g_org_deadlock };
if(restarter.dumpStateAllNodes(val, 2) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){ int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){
...@@ -374,6 +429,43 @@ int runBuddyTransNoTimeout(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -374,6 +429,43 @@ int runBuddyTransNoTimeout(NDBT_Context* ctx, NDBT_Step* step){
return result; return result;
} }
int
runError4012(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
int loops = ctx->getNumLoops();
int stepNo = step->getStepNo();
int timeout = ctx->getProperty("TransactionDeadlockTimeout", TIMEOUT);
HugoOperations hugoOps(*ctx->getTab());
Ndb* pNdb = GETNDB(step);
do{
// Commit transaction
CHECK(hugoOps.startTransaction(pNdb) == 0);
CHECK(hugoOps.pkUpdateRecord(pNdb, 0) == 0);
int ret = hugoOps.execute_NoCommit(pNdb);
if (ret == 0)
{
int sleep = timeout;
ndbout << "Sleeping for " << sleep << " milliseconds" << endl;
NdbSleep_MilliSleep(sleep);
// Expect that transaction has NOT timed-out
CHECK(hugoOps.execute_Commit(pNdb) == 0);
}
else
{
CHECK(ret == 4012);
}
} while(false);
hugoOps.closeTransaction(pNdb);
return result;
}
NDBT_TESTSUITE(testTimeout); NDBT_TESTSUITE(testTimeout);
TESTCASE("DontTimeoutTransaction", TESTCASE("DontTimeoutTransaction",
"Test that the transaction does not timeout "\ "Test that the transaction does not timeout "\
...@@ -465,6 +557,15 @@ TESTCASE("BuddyTransNoTimeout5", ...@@ -465,6 +557,15 @@ TESTCASE("BuddyTransNoTimeout5",
FINALIZER(resetTransactionTimeout); FINALIZER(resetTransactionTimeout);
FINALIZER(runClearTable); FINALIZER(runClearTable);
} }
TESTCASE("Error4012", ""){
TC_PROPERTY("TransactionDeadlockTimeout", 120000);
INITIALIZER(runLoadTable);
INITIALIZER(getDeadlockTimeout);
INITIALIZER(setDeadlockTimeout);
STEPS(runError4012, 2);
FINALIZER(runClearTable);
}
NDBT_TESTSUITE_END(testTimeout); NDBT_TESTSUITE_END(testTimeout);
int main(int argc, const char** argv){ int main(int argc, const char** argv){
......
...@@ -236,6 +236,10 @@ max-time: 500 ...@@ -236,6 +236,10 @@ max-time: 500
cmd: testTimeout cmd: testTimeout
args: -n TimeoutRandTransaction T1 args: -n TimeoutRandTransaction T1
max-time: 600
cmd: testTimeout
args: -n Error4012 T1
# SCAN TESTS # SCAN TESTS
# #
max-time: 500 max-time: 500
...@@ -446,6 +450,10 @@ max-time: 500 ...@@ -446,6 +450,10 @@ max-time: 500
cmd: testNodeRestart cmd: testNodeRestart
args: -n Bug15685 T1 args: -n Bug15685 T1
max-time: 500
cmd: testNodeRestart
args: -n Bug16772 T1
# OLD FLEX # OLD FLEX
max-time: 500 max-time: 500
cmd: flexBench cmd: flexBench
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment