Skip to content

Commit

Permalink
if someone else advances my cursor be safe SERVER-494
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Dec 17, 2009
1 parent e7eb18f commit 6909e14
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion db/query.cpp
Expand Up @@ -145,12 +145,21 @@ namespace mongo {
cc->ns = ns;
cc->liveForever();
cc->setDoingDeletes( true );

CursorId id = cc->cursorid;

do {

if ( nDeleted % 100 == 99 ){
cc->updateLocation();
cc->setDoingDeletes( false );
dbtemprelease unlock;
{
dbtemprelease unlock;
}
if ( ClientCursor::find( id , false ) == 0 ){
cc.reset( 0 );
break;
}
}
cc->setDoingDeletes( true );

Expand Down Expand Up @@ -191,6 +200,10 @@ namespace mongo {

} while ( cc->c->ok() );

if ( ClientCursor::find( id , false ) == 0 ){
cc.reset( 0 );
}

return nDeleted;
}

Expand Down

0 comments on commit 6909e14

Please sign in to comment.