Commit 5e154e57 authored by joreland@mysql.com's avatar joreland@mysql.com

Bug#3847

parent ba1fb581
...@@ -560,7 +560,6 @@ public: ...@@ -560,7 +560,6 @@ public:
UintR scanLocalFragid; UintR scanLocalFragid;
UintR scanSchemaVersion; UintR scanSchemaVersion;
Uint32 fragPtrI; Uint32 fragPtrI;
UintR scanSearchCondFalseCount;
UintR scanStoredProcId; UintR scanStoredProcId;
ScanState scanState; ScanState scanState;
UintR scanTcrec; UintR scanTcrec;
......
...@@ -2064,8 +2064,6 @@ void Dblqh::execTIME_SIGNAL(Signal* signal) ...@@ -2064,8 +2064,6 @@ void Dblqh::execTIME_SIGNAL(Signal* signal)
<< " scanLocalFragid="<<TscanPtr.p->scanLocalFragid << " scanLocalFragid="<<TscanPtr.p->scanLocalFragid
<< endl; << endl;
ndbout << " scanSchemaVersion="<<TscanPtr.p->scanSchemaVersion ndbout << " scanSchemaVersion="<<TscanPtr.p->scanSchemaVersion
<< " scanSearchCondFalseCount="<<
TscanPtr.p->scanSearchCondFalseCount
<< " scanStoredProcId="<<TscanPtr.p->scanStoredProcId << " scanStoredProcId="<<TscanPtr.p->scanStoredProcId
<< " scanTcrec="<<TscanPtr.p->scanTcrec << " scanTcrec="<<TscanPtr.p->scanTcrec
<< endl; << endl;
...@@ -7099,14 +7097,26 @@ void Dblqh::scanLockReleasedLab(Signal* signal) ...@@ -7099,14 +7097,26 @@ void Dblqh::scanLockReleasedLab(Signal* signal)
sendScanFragConf(signal, ZFALSE); sendScanFragConf(signal, ZFALSE);
} else { } else {
jam(); jam();
/*
We came here after releasing locks after receiving SCAN_NEXTREQ from TC. We only
come here when scanHoldLock == ZTRUE
*/
continueScanNextReqLab(signal); continueScanNextReqLab(signal);
}//if }//if
} else { } else if (scanptr.p->scanReleaseCounter < scanptr.p->scanCompletedOperations) {
ndbrequire(scanptr.p->scanReleaseCounter <=
scanptr.p->scanCompletedOperations);
jam(); jam();
scanptr.p->scanReleaseCounter++; scanptr.p->scanReleaseCounter++;
scanReleaseLocksLab(signal); scanReleaseLocksLab(signal);
} else {
jam();
/*
We come here when we have been scanning for a long time and not been able
to find scanConcurrentOperations records to return. We needed to release
the record we didn't want, but now we are returning all found records to
the API.
*/
scanptr.p->scanState = ScanRecord::WAIT_SCAN_NEXTREQ;
sendScanFragConf(signal, ZFALSE);
}//if }//if
}//Dblqh::scanLockReleasedLab() }//Dblqh::scanLockReleasedLab()
...@@ -8000,28 +8010,28 @@ void Dblqh::scanTupkeyRefLab(Signal* signal) ...@@ -8000,28 +8010,28 @@ void Dblqh::scanTupkeyRefLab(Signal* signal)
scanReleaseLocksLab(signal); scanReleaseLocksLab(signal);
return; return;
}//if }//if
Uint32 time_passed= tcConnectptr.p->tcTimer - cLqhTimeOutCount;
if (scanptr.p->scanCompletedOperations > 0) {
if (time_passed > 1) {
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* WE NEED TO ENSURE THAT WE DO NOT SEARCH FOR THE NEXT TUPLE FOR A * WE NEED TO ENSURE THAT WE DO NOT SEARCH FOR THE NEXT TUPLE FOR A
* LONG TIME WHILE WE KEEP A LOCK ON A FOUND TUPLE. WE RATHER REPORT * LONG TIME WHILE WE KEEP A LOCK ON A FOUND TUPLE. WE RATHER REPORT
* THE FOUND TUPLE IF FOUND TUPLES ARE RARE. WE SELECT 20 TUPLES * THE FOUND TUPLE IF FOUND TUPLES ARE RARE. If more than 10 ms passed we
* WHICH SHOULD BE ROUGHLY 10 MS OF LOCK HOLD TIME. * send the found tuples to the API.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
scanptr.p->scanSearchCondFalseCount++; scanptr.p->scanReleaseCounter = scanptr.p->scanCompletedOperations + 1;
#if 0 scanReleaseLocksLab(signal);
// MASV Uncomment this feature since it forgets
// to release on operation record in DBACC
// This is the quick fix and should be changed in
// the future
if (scanptr.p->scanSearchCondFalseCount > 20) {
if (scanptr.p->scanCompletedOperations > 0) {
jam();
scanptr.p->scanState = ScanRecord::WAIT_SCAN_NEXTREQ;
sendScanFragConf(signal, ZFALSE);
return; return;
}//if }
}//if } else {
#endif if (time_passed > 10) {
jam();
signal->theData[0]= scanptr.i;
signal->theData[1]= tcConnectptr.p->transid[0];
signal->theData[2]= tcConnectptr.p->transid[1];
execSCAN_HBREP(signal);
}
}
scanptr.p->scanFlag = NextScanReq::ZSCAN_NEXT_ABORT; scanptr.p->scanFlag = NextScanReq::ZSCAN_NEXT_ABORT;
scanNextLoopLab(signal); scanNextLoopLab(signal);
}//Dblqh::scanTupkeyRefLab() }//Dblqh::scanTupkeyRefLab()
...@@ -8179,7 +8189,6 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) ...@@ -8179,7 +8189,6 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq)
scanptr.p->scanLockMode = scanLockMode; scanptr.p->scanLockMode = scanLockMode;
scanptr.p->readCommitted = readCommitted; scanptr.p->readCommitted = readCommitted;
scanptr.p->rangeScan = idx; scanptr.p->rangeScan = idx;
scanptr.p->scanSearchCondFalseCount = 0;
scanptr.p->scanState = ScanRecord::SCAN_FREE; scanptr.p->scanState = ScanRecord::SCAN_FREE;
scanptr.p->scanFlag = ZFALSE; scanptr.p->scanFlag = ZFALSE;
scanptr.p->scanLocalref[0] = 0; scanptr.p->scanLocalref[0] = 0;
...@@ -8480,7 +8489,6 @@ void Dblqh::sendKeyinfo20(Signal* signal, ...@@ -8480,7 +8489,6 @@ void Dblqh::sendKeyinfo20(Signal* signal,
* ------------------------------------------------------------------------ */ * ------------------------------------------------------------------------ */
void Dblqh::sendScanFragConf(Signal* signal, Uint32 scanCompleted) void Dblqh::sendScanFragConf(Signal* signal, Uint32 scanCompleted)
{ {
scanptr.p->scanSearchCondFalseCount = 0;
scanptr.p->scanTcWaiting = ZFALSE; scanptr.p->scanTcWaiting = ZFALSE;
ScanFragConf * conf = (ScanFragConf*)&signal->theData[0]; ScanFragConf * conf = (ScanFragConf*)&signal->theData[0];
...@@ -17956,11 +17964,10 @@ Dblqh::execDUMP_STATE_ORD(Signal* signal) ...@@ -17956,11 +17964,10 @@ Dblqh::execDUMP_STATE_ORD(Signal* signal)
sp.p->scanAiLength, sp.p->scanAiLength,
sp.p->scanCompletedOperations, sp.p->scanCompletedOperations,
sp.p->scanConcurrentOperations); sp.p->scanConcurrentOperations);
infoEvent(" errCnt=%d, localFid=%d, schV=%d, searcCondFalseC=%d", infoEvent(" errCnt=%d, localFid=%d, schV=%d",
sp.p->scanErrorCounter, sp.p->scanErrorCounter,
sp.p->scanLocalFragid, sp.p->scanLocalFragid,
sp.p->scanSchemaVersion, sp.p->scanSchemaVersion);
sp.p->scanSearchCondFalseCount);
infoEvent(" stpid=%d, flag=%d, lhold=%d, lmode=%d, num=%d", infoEvent(" stpid=%d, flag=%d, lhold=%d, lmode=%d, num=%d",
sp.p->scanStoredProcId, sp.p->scanStoredProcId,
sp.p->scanFlag, sp.p->scanFlag,
......
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