Commit 52f9ee10 authored by joreland@mysql.com's avatar joreland@mysql.com

bug#4586 testSystemRestart -n SR_FULLDB

keep acc from shrinking/expanding when less than one page per fragment
is left.

This makes ACC not shrink so that one get out of pages during 
log execution in SR (which crashes badly)
parent f851b03a
...@@ -1564,6 +1564,8 @@ private: ...@@ -1564,6 +1564,8 @@ private:
Uint32 c_errorInsert3000_TableId; Uint32 c_errorInsert3000_TableId;
Uint32 cSrUndoRecords[5]; Uint32 cSrUndoRecords[5];
Uint32 c_no_fragment_allocated;
}; };
#endif #endif
...@@ -599,6 +599,7 @@ void Dbacc::ndbrestart1Lab(Signal* signal) ...@@ -599,6 +599,7 @@ void Dbacc::ndbrestart1Lab(Signal* signal)
for (Uint32 tmp = 0; tmp < ZMAX_UNDO_VERSION; tmp++) { for (Uint32 tmp = 0; tmp < ZMAX_UNDO_VERSION; tmp++) {
csrVersList[tmp] = RNIL; csrVersList[tmp] = RNIL;
}//for }//for
c_no_fragment_allocated = 0;
return; return;
}//Dbacc::ndbrestart1Lab() }//Dbacc::ndbrestart1Lab()
...@@ -1360,6 +1361,8 @@ void Dbacc::releaseDirIndexResources(Signal* signal, FragmentrecPtr regFragPtr) ...@@ -1360,6 +1361,8 @@ void Dbacc::releaseDirIndexResources(Signal* signal, FragmentrecPtr regFragPtr)
void Dbacc::releaseFragRecord(Signal* signal, FragmentrecPtr regFragPtr) void Dbacc::releaseFragRecord(Signal* signal, FragmentrecPtr regFragPtr)
{ {
ndbrequire(c_no_fragment_allocated > 0);
c_no_fragment_allocated--;
regFragPtr.p->nextfreefrag = cfirstfreefrag; regFragPtr.p->nextfreefrag = cfirstfreefrag;
cfirstfreefrag = regFragPtr.i; cfirstfreefrag = regFragPtr.i;
initFragGeneral(regFragPtr); initFragGeneral(regFragPtr);
...@@ -6349,25 +6352,26 @@ void Dbacc::execEXPANDCHECK2(Signal* signal) ...@@ -6349,25 +6352,26 @@ void Dbacc::execEXPANDCHECK2(Signal* signal)
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
return; return;
}//if }//if
if (fragrecptr.p->firstOverflowRec == RNIL) { if (cfirstfreepage == RNIL) {
jam(); if ((cfreepage + c_no_fragment_allocated) >= cpagesize) {
allocOverflowPage(signal);
if (tresult > ZLIMIT_OF_ERROR) {
jam(); jam();
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
/* WE COULD NOT ALLOCATE ANY OVERFLOW PAGE. THUS WE HAVE TO STOP*/ /* WE HAVE TO STOP THE EXPAND PROCESS SINCE THERE ARE NO FREE */
/* THE EXPAND SINCE WE CANNOT GUARANTEE ITS COMPLETION. */ /* PAGES. THIS MEANS THAT WE COULD BE FORCED TO CRASH SINCE WE */
/* CANNOT COMPLETE THE EXPAND. TO AVOID THE CRASH WE EXIT HERE. */
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
return; return;
}//if }//if
}//if }//if
if (cfirstfreepage == RNIL) {
if (cfreepage >= cpagesize) { if (fragrecptr.p->firstOverflowRec == RNIL) {
jam();
allocOverflowPage(signal);
if (tresult > ZLIMIT_OF_ERROR) {
jam(); jam();
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
/* WE HAVE TO STOP THE EXPAND PROCESS SINCE THERE ARE NO FREE */ /* WE COULD NOT ALLOCATE ANY OVERFLOW PAGE. THUS WE HAVE TO STOP*/
/* PAGES. THIS MEANS THAT WE COULD BE FORCED TO CRASH SINCE WE */ /* THE EXPAND SINCE WE CANNOT GUARANTEE ITS COMPLETION. */
/* CANNOT COMPLETE THE EXPAND. TO AVOID THE CRASH WE EXIT HERE. */
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
return; return;
}//if }//if
...@@ -6933,16 +6937,8 @@ void Dbacc::execSHRINKCHECK2(Signal* signal) ...@@ -6933,16 +6937,8 @@ void Dbacc::execSHRINKCHECK2(Signal* signal)
}//if }//if
}//if }//if
}//if }//if
if (fragrecptr.p->firstOverflowRec == RNIL) {
jam();
allocOverflowPage(signal);
if (tresult > ZLIMIT_OF_ERROR) {
jam();
return;
}//if
}//if
if (cfirstfreepage == RNIL) { if (cfirstfreepage == RNIL) {
if (cfreepage >= cpagesize) { if (cfreepage + c_no_fragment_allocated >= cpagesize) {
jam(); jam();
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
/* WE HAVE TO STOP THE SHRINK PROCESS SINCE THERE ARE NO FREE */ /* WE HAVE TO STOP THE SHRINK PROCESS SINCE THERE ARE NO FREE */
...@@ -6952,6 +6948,14 @@ void Dbacc::execSHRINKCHECK2(Signal* signal) ...@@ -6952,6 +6948,14 @@ void Dbacc::execSHRINKCHECK2(Signal* signal)
return; return;
}//if }//if
}//if }//if
if (fragrecptr.p->firstOverflowRec == RNIL) {
jam();
allocOverflowPage(signal);
if (tresult > ZLIMIT_OF_ERROR) {
jam();
return;
}//if
}//if
if (checkScanShrink(signal) == 1) { if (checkScanShrink(signal) == 1) {
jam(); jam();
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
...@@ -12771,6 +12775,7 @@ void Dbacc::seizeDirrange(Signal* signal) ...@@ -12771,6 +12775,7 @@ void Dbacc::seizeDirrange(Signal* signal)
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
void Dbacc::seizeFragrec(Signal* signal) void Dbacc::seizeFragrec(Signal* signal)
{ {
c_no_fragment_allocated++;
fragrecptr.i = cfirstfreefrag; fragrecptr.i = cfirstfreefrag;
ptrCheckGuard(fragrecptr, cfragmentsize, fragmentrec); ptrCheckGuard(fragrecptr, cfragmentsize, fragmentrec);
cfirstfreefrag = fragrecptr.p->nextfreefrag; cfirstfreefrag = fragrecptr.p->nextfreefrag;
......
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