File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -154,14 +154,39 @@ namespace mongo {
154154 if ( ++nScanned % 128 == 0 ){
155155 cc->updateLocation ();
156156 cc->setDoingDeletes ( false );
157+
158+ /* a quick test that our temprelease is safe.
159+ todo: make a YieldingCursor class
160+ and then make the following code part of a unit test.
161+ */
162+ const int test = 0 ;
163+ static bool inEmpty = false ;
164+ if ( test && !inEmpty ) {
165+ inEmpty = true ;
166+ log () << " TEST: manipulate collection during remove" << endl;
167+ if ( test == 1 )
168+ Helpers::emptyCollection (ns);
169+ else if ( test == 2 ) {
170+ BSONObjBuilder b; string m;
171+ dropCollection (ns, m, b);
172+ }
173+ else {
174+ dropDatabase (ns);
175+ }
176+ }
177+
178+ /* yield */
157179 {
158180 dbtemprelease unlock;
159181 }
160182 if ( ClientCursor::find ( id , false ) == 0 ){
161- cc.reset ( 0 );
183+ cc.release (); // has already been deleted elsewhere
162184 break ;
163185 }
164186 }
187+
188+ // this way we can avoid calling updateLocation() every time (expensive)
189+ // as well as some other nuances handled
165190 cc->setDoingDeletes ( true );
166191
167192 DiskLoc rloc = cc->c ->currLoc ();
You can’t perform that action at this time.
0 commit comments