Commit 9b775965 authored by joreland@mysql.com's avatar joreland@mysql.com

ndb -

Fix bug in bug fix in FastScheduler
  remove possibility of endless loop
  resulting in APZJobBuffer overflow due to statistics reporting
parent 7d1af16c
...@@ -85,7 +85,7 @@ FastScheduler::activateSendPacked() ...@@ -85,7 +85,7 @@ FastScheduler::activateSendPacked()
void void
FastScheduler::doJob() FastScheduler::doJob()
{ {
Uint32 init_loopCount = 0; Uint32 loopCount = 0;
Uint32 TminLoops = getBOccupancy() + EXTRA_SIGNALS_PER_DO_JOB; Uint32 TminLoops = getBOccupancy() + EXTRA_SIGNALS_PER_DO_JOB;
Uint32 TloopMax = (Uint32)globalData.loopMax; Uint32 TloopMax = (Uint32)globalData.loopMax;
if (TminLoops < TloopMax) { if (TminLoops < TloopMax) {
...@@ -94,10 +94,9 @@ FastScheduler::doJob() ...@@ -94,10 +94,9 @@ FastScheduler::doJob()
if (TloopMax < MIN_NUMBER_OF_SIG_PER_DO_JOB) { if (TloopMax < MIN_NUMBER_OF_SIG_PER_DO_JOB) {
TloopMax = MIN_NUMBER_OF_SIG_PER_DO_JOB; TloopMax = MIN_NUMBER_OF_SIG_PER_DO_JOB;
}//if }//if
do{
Uint32 loopCount = init_loopCount;
register Uint32 tHighPrio = globalData.highestAvailablePrio;
register Signal* signal = getVMSignals(); register Signal* signal = getVMSignals();
register Uint32 tHighPrio= globalData.highestAvailablePrio;
do{
while ((tHighPrio < LEVEL_IDLE) && (loopCount < TloopMax)) { while ((tHighPrio < LEVEL_IDLE) && (loopCount < TloopMax)) {
// signal->garbage_register(); // signal->garbage_register();
// To ensure we find bugs quickly // To ensure we find bugs quickly
...@@ -155,24 +154,27 @@ FastScheduler::doJob() ...@@ -155,24 +154,27 @@ FastScheduler::doJob()
}//if }//if
loopCount++; loopCount++;
}//while }//while
if (globalData.sendPackedActivated == 1) { sendPacked();
Uint32 t1 = theDoJobTotalCounter; tHighPrio = globalData.highestAvailablePrio;
Uint32 t2 = theDoJobCallCounter; if(getBOccupancy() > MAX_OCCUPANCY)
t1 += (loopCount - init_loopCount); {
t2++; if(loopCount != TloopMax)
theDoJobTotalCounter = t1; abort();
theDoJobCallCounter = t2; assert( loopCount == TloopMax );
if (t2 == 8192) { TloopMax += 512;
reportDoJobStatistics(t1 >> 13); }
} while ((getBOccupancy() > MAX_OCCUPANCY) ||
((loopCount < TloopMax) &&
(tHighPrio < LEVEL_IDLE)));
theDoJobCallCounter ++;
theDoJobTotalCounter += loopCount;
if (theDoJobCallCounter == 8192) {
reportDoJobStatistics(theDoJobTotalCounter >> 13);
theDoJobCallCounter = 0; theDoJobCallCounter = 0;
theDoJobTotalCounter = 0; theDoJobTotalCounter = 0;
}//if }//if
}//if
init_loopCount = loopCount;
sendPacked();
} while ((getBOccupancy() > MAX_OCCUPANCY) ||
((init_loopCount < TloopMax) &&
(globalData.highestAvailablePrio < LEVEL_IDLE)));
}//FastScheduler::doJob() }//FastScheduler::doJob()
void FastScheduler::sendPacked() void FastScheduler::sendPacked()
......
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