Merge dl145s.mysql.com:/data/bk/team_tree_merge/CLEAN/mysql-4.1

into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-4.1-opt
This commit is contained in:
gkodinov@dl145s.mysql.com 2006-09-15 11:43:28 +02:00
commit 325f820909
17 changed files with 332 additions and 65 deletions

19
BUILD/compile-ndb-autotest Executable file
View File

@ -0,0 +1,19 @@
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_configs="$max_configs --with-ndb-test --with-ndb-ccflags='-DERROR_INSERT'"
if [ "$full_debug" ]
then
extra_flags="$debug_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$debug_configs $extra_configs"
else
extra_flags="$fast_cflags"
fi
extra_flags="$extra_flags $max_cflags -g"
. "$path/FINISH.sh"

View File

@ -445,7 +445,7 @@ public:
/** /**
* Interpreted program instruction: * Interpreted program instruction:
* Substract RegSource1 from RegSource2 and put the result in RegDest. * Substract RegSource2 from RegSource1 and put the result in RegDest.
* *
* @param RegSource1 First register. * @param RegSource1 First register.
* @param RegSource2 Second register. * @param RegSource2 Second register.

View File

@ -6,7 +6,7 @@ Next DBTUP 4014
Next DBLQH 5043 Next DBLQH 5043
Next DBDICT 6006 Next DBDICT 6006
Next DBDIH 7174 Next DBDIH 7174
Next DBTC 8037 Next DBTC 8038
Next CMVMI 9000 Next CMVMI 9000
Next BACKUP 10022 Next BACKUP 10022
Next DBUTIL 11002 Next DBUTIL 11002
@ -281,6 +281,7 @@ ABORT OF TCKEYREQ
8032: No free TC records any more 8032: No free TC records any more
8037 : Invalid schema version in TCINDXREQ
CMVMI CMVMI
----- -----

View File

@ -8338,6 +8338,7 @@ Dbdih::resetReplicaSr(TabRecordPtr tabPtr){
} }
replicaPtr.i = nextReplicaPtrI; replicaPtr.i = nextReplicaPtrI;
}//while }//while
updateNodeInfo(fragPtr);
} }
} }

View File

@ -6435,6 +6435,7 @@ void Dblqh::execACC_ABORTCONF(Signal* signal)
* A NORMAL EVENT DURING CREATION OF A FRAGMENT. WE NOW NEED TO CONTINUE * A NORMAL EVENT DURING CREATION OF A FRAGMENT. WE NOW NEED TO CONTINUE
* WITH NORMAL COMMIT PROCESSING. * WITH NORMAL COMMIT PROCESSING.
* ---------------------------------------------------------------------- */ * ---------------------------------------------------------------------- */
regTcPtr->totSendlenAi = regTcPtr->totReclenAi;
if (regTcPtr->currTupAiLen == regTcPtr->totReclenAi) { if (regTcPtr->currTupAiLen == regTcPtr->totReclenAi) {
jam(); jam();
regTcPtr->abortState = TcConnectionrec::ABORT_IDLE; regTcPtr->abortState = TcConnectionrec::ABORT_IDLE;
@ -12508,6 +12509,20 @@ void Dblqh::lastWriteInFileLab(Signal* signal)
void Dblqh::writePageZeroLab(Signal* signal) void Dblqh::writePageZeroLab(Signal* signal)
{ {
if (logPartPtr.p->logPartState == LogPartRecord::FILE_CHANGE_PROBLEM)
{
if (logPartPtr.p->firstLogQueue == RNIL)
{
jam();
logPartPtr.p->logPartState = LogPartRecord::IDLE;
}
else
{
jam();
logPartPtr.p->logPartState = LogPartRecord::ACTIVE;
}
}
logFilePtr.p->fileChangeState = LogFileRecord::NOT_ONGOING; logFilePtr.p->fileChangeState = LogFileRecord::NOT_ONGOING;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* IT COULD HAVE ARRIVED PAGE WRITES TO THE CURRENT FILE WHILE WE WERE */ /* IT COULD HAVE ARRIVED PAGE WRITES TO THE CURRENT FILE WHILE WE WERE */

View File

@ -718,7 +718,7 @@ public:
// Index data // Index data
bool isIndexOp; // Used to mark on-going TcKeyReq as indx table access Uint8 isIndexOp; // Used to mark on-going TcKeyReq as indx table access
bool indexOpReturn; bool indexOpReturn;
UintR noIndexOp; // No outstanding index ops UintR noIndexOp; // No outstanding index ops
@ -806,7 +806,7 @@ public:
UintR savedState[LqhKeyConf::SignalLength]; UintR savedState[LqhKeyConf::SignalLength];
// Index data // Index data
bool isIndexOp; // Used to mark on-going TcKeyReq as index table access Uint8 isIndexOp; // Used to mark on-going TcKeyReq as index table access
UintR indexOp; UintR indexOp;
UintR currentIndexId; UintR currentIndexId;
UintR attrInfoLen; UintR attrInfoLen;

View File

@ -1757,8 +1757,7 @@ void Dbtc::execKEYINFO(Signal* signal)
apiConnectptr.i = signal->theData[0]; apiConnectptr.i = signal->theData[0];
tmaxData = 20; tmaxData = 20;
if (apiConnectptr.i >= capiConnectFilesize) { if (apiConnectptr.i >= capiConnectFilesize) {
jam(); TCKEY_abort(signal, 18);
warningHandlerLab(signal);
return; return;
}//if }//if
ptrAss(apiConnectptr, apiConnectRecord); ptrAss(apiConnectptr, apiConnectRecord);
@ -1767,9 +1766,7 @@ void Dbtc::execKEYINFO(Signal* signal)
compare_transid2 = apiConnectptr.p->transid[1] ^ signal->theData[2]; compare_transid2 = apiConnectptr.p->transid[1] ^ signal->theData[2];
compare_transid1 = compare_transid1 | compare_transid2; compare_transid1 = compare_transid1 | compare_transid2;
if (compare_transid1 != 0) { if (compare_transid1 != 0) {
jam(); TCKEY_abort(signal, 19);
printState(signal, 10);
sendSignalErrorRefuseLab(signal);
return; return;
}//if }//if
switch (apiConnectptr.p->apiConnectstate) { switch (apiConnectptr.p->apiConnectstate) {
@ -2467,7 +2464,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
Uint32 TstartFlag = tcKeyReq->getStartFlag(Treqinfo); Uint32 TstartFlag = tcKeyReq->getStartFlag(Treqinfo);
Uint32 TexecFlag = TcKeyReq::getExecuteFlag(Treqinfo); Uint32 TexecFlag = TcKeyReq::getExecuteFlag(Treqinfo);
bool isIndexOp = regApiPtr->isIndexOp; Uint8 isIndexOp = regApiPtr->isIndexOp;
bool isIndexOpReturn = regApiPtr->indexOpReturn; bool isIndexOpReturn = regApiPtr->indexOpReturn;
regApiPtr->isIndexOp = false; // Reset marker regApiPtr->isIndexOp = false; // Reset marker
regApiPtr->m_exec_flag |= TexecFlag; regApiPtr->m_exec_flag |= TexecFlag;
@ -3210,7 +3207,7 @@ void Dbtc::sendlqhkeyreq(Signal* signal,
sig1 = regCachePtr->fragmentid + (regTcPtr->tcNodedata[1] << 16); sig1 = regCachePtr->fragmentid + (regTcPtr->tcNodedata[1] << 16);
sig2 = regApiPtr->transid[0]; sig2 = regApiPtr->transid[0];
sig3 = regApiPtr->transid[1]; sig3 = regApiPtr->transid[1];
sig4 = regApiPtr->ndbapiBlockref; sig4 = (regTcPtr->isIndexOp == 2) ? reference() : regApiPtr->ndbapiBlockref;
sig5 = regTcPtr->clientData; sig5 = regTcPtr->clientData;
sig6 = regCachePtr->scanInfo; sig6 = regCachePtr->scanInfo;
@ -8551,6 +8548,7 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
// left over from simple/dirty read // left over from simple/dirty read
} else { } else {
jam(); jam();
jamLine(transP->apiConnectstate);
errCode = ZSTATE_ERROR; errCode = ZSTATE_ERROR;
goto SCAN_TAB_error_no_state_change; goto SCAN_TAB_error_no_state_change;
} }
@ -11915,14 +11913,18 @@ void Dbtc::readIndexTable(Signal* signal,
opType == ZREAD ? ZREAD : ZREAD_EX); opType == ZREAD ? ZREAD : ZREAD_EX);
TcKeyReq::setAIInTcKeyReq(tcKeyRequestInfo, 1); // Allways send one AttrInfo TcKeyReq::setAIInTcKeyReq(tcKeyRequestInfo, 1); // Allways send one AttrInfo
TcKeyReq::setExecutingTrigger(tcKeyRequestInfo, 0); TcKeyReq::setExecutingTrigger(tcKeyRequestInfo, 0);
BlockReference originalReceiver = regApiPtr->ndbapiBlockref;
regApiPtr->ndbapiBlockref = reference(); // Send result to me
tcKeyReq->senderData = indexOp->indexOpId; tcKeyReq->senderData = indexOp->indexOpId;
indexOp->indexOpState = IOS_INDEX_ACCESS; indexOp->indexOpState = IOS_INDEX_ACCESS;
regApiPtr->executingIndexOp = regApiPtr->accumulatingIndexOp; regApiPtr->executingIndexOp = regApiPtr->accumulatingIndexOp;
regApiPtr->accumulatingIndexOp = RNIL; regApiPtr->accumulatingIndexOp = RNIL;
regApiPtr->isIndexOp = true; regApiPtr->isIndexOp = 2;
if (ERROR_INSERTED(8037))
{
ndbout_c("shifting index version");
tcKeyReq->tableSchemaVersion = ~(Uint32)indexOp->tcIndxReq.indexSchemaVersion;
}
Uint32 remainingKey = indexOp->keyInfo.getSize(); Uint32 remainingKey = indexOp->keyInfo.getSize();
bool moreKeyData = indexOp->keyInfo.first(keyIter); bool moreKeyData = indexOp->keyInfo.first(keyIter);
// *********** KEYINFO in TCKEYREQ *********** // *********** KEYINFO in TCKEYREQ ***********
@ -11941,21 +11943,13 @@ void Dbtc::readIndexTable(Signal* signal,
ndbassert(TcKeyReq::getDirtyFlag(tcKeyRequestInfo) == 0); ndbassert(TcKeyReq::getDirtyFlag(tcKeyRequestInfo) == 0);
ndbassert(TcKeyReq::getSimpleFlag(tcKeyRequestInfo) == 0); ndbassert(TcKeyReq::getSimpleFlag(tcKeyRequestInfo) == 0);
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength); EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
/**
* "Fool" TC not to start commiting transaction since it always will
* have one outstanding lqhkeyreq
* This is later decreased when the index read is complete
*/
regApiPtr->lqhkeyreqrec++;
/**
* Remember ptr to index read operation
* (used to set correct save point id on index operation later)
*/
indexOp->indexReadTcConnect = regApiPtr->lastTcConnect;
jamEntry(); jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
goto err;
}
// *********** KEYINFO *********** // *********** KEYINFO ***********
if (moreKeyData) { if (moreKeyData) {
jam(); jam();
@ -11975,6 +11969,10 @@ void Dbtc::readIndexTable(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal, EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + KeyInfo::DataLength); KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry(); jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
goto err;
}
dataPos = 0; dataPos = 0;
dataPtr = (Uint32 *) &keyInfo->keyData; dataPtr = (Uint32 *) &keyInfo->keyData;
} }
@ -11985,10 +11983,32 @@ void Dbtc::readIndexTable(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal, EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + dataPos); KeyInfo::HeaderLength + dataPos);
jamEntry(); jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
goto err;
}
} }
} }
regApiPtr->ndbapiBlockref = originalReceiver; // reset original receiver /**
* "Fool" TC not to start commiting transaction since it always will
* have one outstanding lqhkeyreq
* This is later decreased when the index read is complete
*/
regApiPtr->lqhkeyreqrec++;
/**
* Remember ptr to index read operation
* (used to set correct save point id on index operation later)
*/
indexOp->indexReadTcConnect = regApiPtr->lastTcConnect;
done:
return;
err:
jam();
goto done;
} }
/** /**
@ -12039,7 +12059,7 @@ void Dbtc::executeIndexOperation(Signal* signal,
tcKeyReq->transId2 = regApiPtr->transid[1]; tcKeyReq->transId2 = regApiPtr->transid[1];
tcKeyReq->senderData = tcIndxReq->senderData; // Needed for TRANSID_AI to API tcKeyReq->senderData = tcIndxReq->senderData; // Needed for TRANSID_AI to API
indexOp->indexOpState = IOS_INDEX_OPERATION; indexOp->indexOpState = IOS_INDEX_OPERATION;
regApiPtr->isIndexOp = true; regApiPtr->isIndexOp = 1;
regApiPtr->executingIndexOp = indexOp->indexOpId;; regApiPtr->executingIndexOp = indexOp->indexOpId;;
regApiPtr->noIndexOp++; // Increase count regApiPtr->noIndexOp++; // Increase count
@ -12112,9 +12132,16 @@ void Dbtc::executeIndexOperation(Signal* signal,
const Uint32 currSavePointId = regApiPtr->currSavePointId; const Uint32 currSavePointId = regApiPtr->currSavePointId;
regApiPtr->currSavePointId = tmp.p->savePointId; regApiPtr->currSavePointId = tmp.p->savePointId;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength); EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
regApiPtr->currSavePointId = currSavePointId; regApiPtr->currSavePointId = currSavePointId;
jamEntry();
// *********** KEYINFO *********** // *********** KEYINFO ***********
if (moreKeyData) { if (moreKeyData) {
jam(); jam();
@ -12135,6 +12162,13 @@ void Dbtc::executeIndexOperation(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal, EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + KeyInfo::DataLength); KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry(); jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPos = 0; dataPos = 0;
dataPtr = (Uint32 *) &keyInfo->keyData; dataPtr = (Uint32 *) &keyInfo->keyData;
} }
@ -12145,6 +12179,12 @@ void Dbtc::executeIndexOperation(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal, EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + dataPos); KeyInfo::HeaderLength + dataPos);
jamEntry(); jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
} }
} }
@ -12174,6 +12214,13 @@ void Dbtc::executeIndexOperation(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_ATTRINFO, signal, EXECUTE_DIRECT(DBTC, GSN_ATTRINFO, signal,
AttrInfo::HeaderLength + AttrInfo::DataLength); AttrInfo::HeaderLength + AttrInfo::DataLength);
jamEntry(); jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
attrInfoPos = 0; attrInfoPos = 0;
dataPtr = (Uint32 *) &attrInfo->attrData; dataPtr = (Uint32 *) &attrInfo->attrData;
} }
@ -12573,9 +12620,16 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
const Uint32 currSavePointId = regApiPtr->currSavePointId; const Uint32 currSavePointId = regApiPtr->currSavePointId;
regApiPtr->currSavePointId = opRecord->savePointId; regApiPtr->currSavePointId = opRecord->savePointId;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength); EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
regApiPtr->currSavePointId = currSavePointId; regApiPtr->currSavePointId = currSavePointId;
tcConnectptr.p->currentIndexId = indexData->indexId; tcConnectptr.p->currentIndexId = indexData->indexId;
jamEntry();
// *********** KEYINFO *********** // *********** KEYINFO ***********
if (moreKeyData) { if (moreKeyData) {
@ -12605,6 +12659,12 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength); KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry(); jamEntry();
#endif #endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &keyInfo->keyData; dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0; dataPos = 0;
} }
@ -12640,6 +12700,13 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength); KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry(); jamEntry();
#endif #endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &keyInfo->keyData; dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0; dataPos = 0;
} }
@ -12657,6 +12724,11 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
KeyInfo::HeaderLength + dataPos); KeyInfo::HeaderLength + dataPos);
jamEntry(); jamEntry();
#endif #endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
} }
} }
@ -12692,6 +12764,12 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
AttrInfo::HeaderLength + AttrInfo::DataLength); AttrInfo::HeaderLength + AttrInfo::DataLength);
jamEntry(); jamEntry();
#endif #endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &attrInfo->attrData; dataPtr = (Uint32 *) &attrInfo->attrData;
attrInfoPos = 0; attrInfoPos = 0;
} }
@ -12728,6 +12806,12 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
AttrInfo::HeaderLength + AttrInfo::DataLength); AttrInfo::HeaderLength + AttrInfo::DataLength);
jamEntry(); jamEntry();
#endif #endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &attrInfo->attrData; dataPtr = (Uint32 *) &attrInfo->attrData;
attrInfoPos = 0; attrInfoPos = 0;
} }
@ -12873,9 +12957,16 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
const Uint32 currSavePointId = regApiPtr->currSavePointId; const Uint32 currSavePointId = regApiPtr->currSavePointId;
regApiPtr->currSavePointId = opRecord->savePointId; regApiPtr->currSavePointId = opRecord->savePointId;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength); EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
regApiPtr->currSavePointId = currSavePointId; regApiPtr->currSavePointId = currSavePointId;
tcConnectptr.p->currentIndexId = indexData->indexId; tcConnectptr.p->currentIndexId = indexData->indexId;
jamEntry();
// *********** KEYINFO *********** // *********** KEYINFO ***********
if (moreKeyData) { if (moreKeyData) {
@ -12906,6 +12997,12 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength); KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry(); jamEntry();
#endif #endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &keyInfo->keyData; dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0; dataPos = 0;
} }
@ -12942,6 +13039,12 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength); KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry(); jamEntry();
#endif #endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &keyInfo->keyData; dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0; dataPos = 0;
} }

View File

@ -1111,14 +1111,16 @@ Dbtup::updateStartLab(Signal* signal,
regOperPtr->pageOffset, regOperPtr->pageOffset,
&cinBuffer[0], &cinBuffer[0],
regOperPtr->attrinbufLen); regOperPtr->attrinbufLen);
if (retValue == -1) {
tupkeyErrorLab(signal);
return -1;
}//if
} else { } else {
jam(); jam();
retValue = interpreterStartLab(signal, pagePtr, regOperPtr->pageOffset); retValue = interpreterStartLab(signal, pagePtr, regOperPtr->pageOffset);
}//if }//if
if (retValue == -1) {
tupkeyErrorLab(signal);
return -1;
}//if
ndbrequire(regOperPtr->tupVersion != ZNIL); ndbrequire(regOperPtr->tupVersion != ZNIL);
pagePtr->pageWord[regOperPtr->pageOffset + 1] = regOperPtr->tupVersion; pagePtr->pageWord[regOperPtr->pageOffset + 1] = regOperPtr->tupVersion;
if (regTabPtr->checksumIndicator) { if (regTabPtr->checksumIndicator) {

View File

@ -184,24 +184,28 @@ void Dbtup::allocConsPages(Uint32 noOfPagesToAllocate,
/* PROPER AMOUNT OF PAGES WERE NOT FOUND. FIND AS MUCH AS */ /* PROPER AMOUNT OF PAGES WERE NOT FOUND. FIND AS MUCH AS */
/* POSSIBLE. */ /* POSSIBLE. */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
for (Uint32 j = firstListToCheck; (Uint32)~j; j--) { if (firstListToCheck)
{
ljam(); ljam();
if (cfreepageList[j] != RNIL) { for (Uint32 j = firstListToCheck - 1; (Uint32)~j; j--) {
ljam(); ljam();
if (cfreepageList[j] != RNIL) {
ljam();
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* SOME AREA WAS FOUND, ALLOCATE ALL OF IT. */ /* SOME AREA WAS FOUND, ALLOCATE ALL OF IT. */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
allocPageRef = cfreepageList[j]; allocPageRef = cfreepageList[j];
removeCommonArea(allocPageRef, j); removeCommonArea(allocPageRef, j);
noOfPagesAllocated = 1 << j; noOfPagesAllocated = 1 << j;
findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated, findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated,
noOfPagesToAllocate); noOfPagesToAllocate);
findFreeRightNeighbours(allocPageRef, noOfPagesAllocated, findFreeRightNeighbours(allocPageRef, noOfPagesAllocated,
noOfPagesToAllocate); noOfPagesToAllocate);
return; return;
}//if }//if
}//for }//for
}
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* NO FREE AREA AT ALL EXISTED. RETURN ZERO PAGES */ /* NO FREE AREA AT ALL EXISTED. RETURN ZERO PAGES */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */

View File

@ -177,13 +177,12 @@ void Ndbcntr::execSYSTEM_ERROR(Signal* signal)
"the state of a fragment scan was out of sync.", "the state of a fragment scan was out of sync.",
killingNode); killingNode);
break; break;
case SystemError::CopyFragRefError: case SystemError::CopyFragRefError:
BaseString::snprintf(buf, sizeof(buf), BaseString::snprintf(buf, sizeof(buf),
"Node %d killed this node because " "Killed by node %d as "
"it could not copy a fragment during node restart. " "copyfrag failed, error: %u",
"Copy fragment error code: %u.", killingNode, data1);
killingNode, data1);
break; break;
default: default:
@ -2037,6 +2036,11 @@ void Ndbcntr::execSET_VAR_REQ(Signal* signal) {
void Ndbcntr::updateNodeState(Signal* signal, const NodeState& newState) const{ void Ndbcntr::updateNodeState(Signal* signal, const NodeState& newState) const{
NodeStateRep * const stateRep = (NodeStateRep *)&signal->theData[0]; NodeStateRep * const stateRep = (NodeStateRep *)&signal->theData[0];
if (newState.startLevel == NodeState::SL_STARTED)
{
CRASH_INSERTION(1000);
}
stateRep->nodeState = newState; stateRep->nodeState = newState;
stateRep->nodeState.masterNodeId = cmasterNodeId; stateRep->nodeState.masterNodeId = cmasterNodeId;
stateRep->nodeState.setNodeGroup(c_nodeGroup); stateRep->nodeState.setNodeGroup(c_nodeGroup);
@ -2827,7 +2831,7 @@ void Ndbcntr::Missra::sendNextSTTOR(Signal* signal){
cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB); cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
} }
} }
signal->theData[0] = EventReport::NDBStartCompleted; signal->theData[0] = EventReport::NDBStartCompleted;
signal->theData[1] = NDB_VERSION; signal->theData[1] = NDB_VERSION;
cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB); cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);

View File

@ -504,6 +504,8 @@ int NdbScanOperation::nextResult(bool fetchAllowed, bool forceSend)
idx = m_current_api_receiver; idx = m_current_api_receiver;
last = m_api_receivers_count; last = m_api_receivers_count;
Uint32 timeout = tp->m_waitfor_timeout;
do { do {
if(theError.code){ if(theError.code){
@ -531,7 +533,7 @@ int NdbScanOperation::nextResult(bool fetchAllowed, bool forceSend)
*/ */
theNdb->theImpl->theWaiter.m_node = nodeId; theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); int return_code = theNdb->receiveResponse(3*timeout);
if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) { if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) {
continue; continue;
} else { } else {
@ -1372,6 +1374,7 @@ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed,
return -1; return -1;
Uint32 seq = theNdbCon->theNodeSequence; Uint32 seq = theNdbCon->theNodeSequence;
Uint32 nodeId = theNdbCon->theDBnode; Uint32 nodeId = theNdbCon->theDBnode;
Uint32 timeout = tp->m_waitfor_timeout;
if(seq == tp->getNodeSequence(nodeId) && if(seq == tp->getNodeSequence(nodeId) &&
!send_next_scan_ordered(s_idx, forceSend)){ !send_next_scan_ordered(s_idx, forceSend)){
Uint32 tmp = m_sent_receivers_count; Uint32 tmp = m_sent_receivers_count;
@ -1379,7 +1382,7 @@ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed,
while(m_sent_receivers_count > 0 && !theError.code){ while(m_sent_receivers_count > 0 && !theError.code){
theNdb->theImpl->theWaiter.m_node = nodeId; theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); int return_code = theNdb->receiveResponse(3*timeout);
if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) { if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) {
continue; continue;
} }
@ -1520,6 +1523,8 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
return -1; return -1;
} }
Uint32 timeout = tp->m_waitfor_timeout;
/** /**
* Wait for outstanding * Wait for outstanding
*/ */
@ -1527,7 +1532,7 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
{ {
theNdb->theImpl->theWaiter.m_node = nodeId; theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); int return_code = theNdb->receiveResponse(3*timeout);
switch(return_code){ switch(return_code){
case 0: case 0:
break; break;
@ -1597,7 +1602,7 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
{ {
theNdb->theImpl->theWaiter.m_node = nodeId; theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); int return_code = theNdb->receiveResponse(3*timeout);
switch(return_code){ switch(return_code){
case 0: case 0:
break; break;

View File

@ -1201,6 +1201,48 @@ int runLQHKEYREF(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK; return NDBT_OK;
} }
int
runBug21384(NDBT_Context* ctx, NDBT_Step* step)
{
Ndb* pNdb = GETNDB(step);
HugoTransactions hugoTrans(*ctx->getTab());
NdbRestarter restarter;
int loops = ctx->getNumLoops();
const int rows = ctx->getNumRecords();
const int batchsize = ctx->getProperty("BatchSize", 50);
while (loops--)
{
if(restarter.insertErrorInAllNodes(8037) != 0)
{
g_err << "Failed to error insert(8037)" << endl;
return NDBT_FAILED;
}
if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize) == 0)
{
g_err << "Index succeded (it should have failed" << endl;
return NDBT_FAILED;
}
if(restarter.insertErrorInAllNodes(0) != 0)
{
g_err << "Failed to error insert(0)" << endl;
return NDBT_FAILED;
}
if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize) != 0){
g_err << "Index read failed" << endl;
return NDBT_FAILED;
}
}
return NDBT_OK;
}
NDBT_TESTSUITE(testIndex); NDBT_TESTSUITE(testIndex);
TESTCASE("CreateAll", TESTCASE("CreateAll",
"Test that we can create all various indexes on each table\n" "Test that we can create all various indexes on each table\n"
@ -1507,6 +1549,16 @@ TESTCASE("UniqueNull",
FINALIZER(createPkIndex_Drop); FINALIZER(createPkIndex_Drop);
FINALIZER(runClearTable); FINALIZER(runClearTable);
} }
TESTCASE("Bug21384",
"Test that unique indexes and nulls"){
TC_PROPERTY("LoggedIndexes", (unsigned)0);
INITIALIZER(runClearTable);
INITIALIZER(createPkIndex);
INITIALIZER(runLoadTable);
STEP(runBug21384);
FINALIZER(createPkIndex_Drop);
FINALIZER(runClearTable);
}
NDBT_TESTSUITE_END(testIndex); NDBT_TESTSUITE_END(testIndex);
int main(int argc, const char** argv){ int main(int argc, const char** argv){

View File

@ -1121,6 +1121,46 @@ int runClearTable(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK; return NDBT_OK;
} }
int
runBug21536(NDBT_Context* ctx, NDBT_Step* step)
{
NdbRestarter restarter;
const Uint32 nodeCount = restarter.getNumDbNodes();
if(nodeCount != 2){
g_info << "Bug21536 - 2 nodes to test" << endl;
return NDBT_OK;
}
int node1 = restarter.getDbNodeId(rand() % nodeCount);
int node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());
if (node1 == -1 || node2 == -1)
return NDBT_OK;
int result = NDBT_OK;
do {
CHECK(restarter.restartOneDbNode(node1, false, true, true) == 0);
CHECK(restarter.waitNodesNoStart(&node1, 1) == 0);
CHECK(restarter.insertErrorInNode(node1, 1000) == 0);
int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
CHECK(restarter.dumpStateOneNode(node1, val2, 2) == 0);
CHECK(restarter.startNodes(&node1, 1) == 0);
restarter.waitNodesStartPhase(&node1, 1, 3, 120);
CHECK(restarter.waitNodesNoStart(&node1, 1) == 0);
CHECK(restarter.restartOneDbNode(node2, true, true, true) == 0);
CHECK(restarter.waitNodesNoStart(&node2, 1) == 0);
CHECK(restarter.startNodes(&node1, 1) == 0);
CHECK(restarter.waitNodesStarted(&node1, 1) == 0);
CHECK(restarter.startNodes(&node2, 1) == 0);
CHECK(restarter.waitClusterStarted() == 0);
} while(0);
g_info << "Bug21536 finished" << endl;
return result;
}
NDBT_TESTSUITE(testSystemRestart); NDBT_TESTSUITE(testSystemRestart);
TESTCASE("SR1", TESTCASE("SR1",
@ -1287,6 +1327,13 @@ TESTCASE("Bug18385",
STEP(runBug18385); STEP(runBug18385);
FINALIZER(runClearTable); FINALIZER(runClearTable);
} }
TESTCASE("Bug21536",
"Perform partition system restart with other nodes with higher GCI"){
INITIALIZER(runWaitStarted);
INITIALIZER(runClearTable);
STEP(runBug21536);
FINALIZER(runClearTable);
}
NDBT_TESTSUITE_END(testSystemRestart); NDBT_TESTSUITE_END(testSystemRestart);
int main(int argc, const char** argv){ int main(int argc, const char** argv){

View File

@ -474,6 +474,10 @@ max-time: 1000
cmd: testNodeRestart cmd: testNodeRestart
args: -n Bug20185 T1 args: -n Bug20185 T1
max-time: 1000
cmd: testIndex
args: -n Bug21384
# OLD FLEX # OLD FLEX
max-time: 500 max-time: 500
cmd: flexBench cmd: flexBench

View File

@ -409,12 +409,17 @@ shutdown the MySQL server and restart it.", log_name, errno);
int MYSQL_LOG::get_current_log(LOG_INFO* linfo) int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
{ {
pthread_mutex_lock(&LOCK_log); pthread_mutex_lock(&LOCK_log);
strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name)-1); int ret = raw_get_current_log(linfo);
linfo->pos = my_b_tell(&log_file);
pthread_mutex_unlock(&LOCK_log); pthread_mutex_unlock(&LOCK_log);
return 0; return ret;
} }
int MYSQL_LOG::raw_get_current_log(LOG_INFO* linfo)
{
strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name)-1);
linfo->pos = my_b_tell(&log_file);
return 0;
}
/* /*
Move all data up in a file in an filename index file Move all data up in a file in an filename index file

View File

@ -177,6 +177,7 @@ public:
bool need_mutex); bool need_mutex);
int find_next_log(LOG_INFO* linfo, bool need_mutex); int find_next_log(LOG_INFO* linfo, bool need_mutex);
int get_current_log(LOG_INFO* linfo); int get_current_log(LOG_INFO* linfo);
int raw_get_current_log(LOG_INFO* linfo);
uint next_file_id(); uint next_file_id();
inline bool is_open() { return log_type != LOG_CLOSED; } inline bool is_open() { return log_type != LOG_CLOSED; }
inline char* get_index_fname() { return index_file_name;} inline char* get_index_fname() { return index_file_name;}

View File

@ -1359,10 +1359,14 @@ int show_binlogs(THD* thd)
MYSQL_TYPE_LONGLONG)); MYSQL_TYPE_LONGLONG));
if (protocol->send_fields(&field_list, 1)) if (protocol->send_fields(&field_list, 1))
DBUG_RETURN(1); DBUG_RETURN(1);
pthread_mutex_lock(mysql_bin_log.get_log_lock());
mysql_bin_log.lock_index(); mysql_bin_log.lock_index();
index_file=mysql_bin_log.get_index_file(); index_file=mysql_bin_log.get_index_file();
mysql_bin_log.get_current_log(&cur); mysql_bin_log.raw_get_current_log(&cur); // dont take mutex
pthread_mutex_unlock(mysql_bin_log.get_log_lock()); // lockdep, OK
cur_dir_len= dirname_length(cur.log_file_name); cur_dir_len= dirname_length(cur.log_file_name);
reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0); reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0);