fix bug in remove concurrency

This commit is contained in:
Dwight
2009-12-18 10:23:10 -05:00
parent 0d1a097017
commit 558bb8ccb8

View File

@@ -154,14 +154,39 @@ namespace mongo {
if ( ++nScanned % 128 == 0 ){
cc->updateLocation();
cc->setDoingDeletes( false );
/* a quick test that our temprelease is safe.
todo: make a YieldingCursor class
and then make the following code part of a unit test.
*/
const int test = 0;
static bool inEmpty = false;
if( test && !inEmpty ) {
inEmpty = true;
log() << "TEST: manipulate collection during remove" << endl;
if( test == 1 )
Helpers::emptyCollection(ns);
else if( test == 2 ) {
BSONObjBuilder b; string m;
dropCollection(ns, m, b);
}
else {
dropDatabase(ns);
}
}
/* yield */
{
dbtemprelease unlock;
}
if ( ClientCursor::find( id , false ) == 0 ){
cc.reset( 0 );
cc.release(); // has already been deleted elsewhere
break;
}
}
// this way we can avoid calling updateLocation() every time (expensive)
// as well as some other nuances handled
cc->setDoingDeletes( true );
DiskLoc rloc = cc->c->currLoc();