mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
cleaning cursor test and added assert
This commit is contained in:
parent
690970bae1
commit
7a83a6fb21
19
db/query.cpp
19
db/query.cpp
@ -162,6 +162,7 @@ namespace mongo {
|
||||
|
||||
bool justOne = justOneOrig;
|
||||
bool canYield = !god && !creal->matcher()->docMatcher().atomic();
|
||||
|
||||
do {
|
||||
if ( canYield && ! cc->yieldSometimes() ){
|
||||
cc.release(); // has already been deleted elsewhere
|
||||
@ -655,17 +656,17 @@ namespace mongo {
|
||||
}
|
||||
|
||||
virtual void recoverFromYield() {
|
||||
++_nYields;
|
||||
_nYields++;
|
||||
|
||||
if ( _findingStartCursor.get() ) {
|
||||
_findingStartCursor->recoverFromYield();
|
||||
} else {
|
||||
if ( !ClientCursor::recoverFromYield( _yieldData ) ) {
|
||||
_c.reset();
|
||||
_cc.reset();
|
||||
_so.reset();
|
||||
massert( 13338, "cursor dropped during query", false );
|
||||
// TODO maybe we want to prevent recording the winning plan as well?
|
||||
}
|
||||
}
|
||||
else if ( ! ClientCursor::recoverFromYield( _yieldData ) ) {
|
||||
_c.reset();
|
||||
_cc.reset();
|
||||
_so.reset();
|
||||
massert( 13338, "cursor dropped during query", false );
|
||||
// TODO maybe we want to prevent recording the winning plan as well?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,13 +14,15 @@ function run( n , atomic ){
|
||||
join = startParallelShell( "sleep(50); db.cursora.remove( {" + ( atomic ? "$atomic:true" : "" ) + "} ); db.getLastError();" );
|
||||
|
||||
start = new Date()
|
||||
num = t.find( function(){ num = 2; for ( var x=0; x<1000; x++ ) num += 2; return num > 0; } ).sort( { _id : -1 } ).limit(n).itcount()
|
||||
ex = t.find( function(){ num = 2; for ( var x=0; x<1000; x++ ) num += 2; return num > 0; } ).sort( { _id : -1 } ).explain()
|
||||
num = ex.n
|
||||
end = new Date()
|
||||
|
||||
|
||||
join()
|
||||
|
||||
print( "num: " + num + " time:" + ( end.getTime() - start.getTime() ) )
|
||||
assert.eq( 0 , t.count() , "after remove" )
|
||||
assert.lt( 0 , ex.nYields , "not enough yields" )
|
||||
if ( n == num )
|
||||
print( "warning: shouldn't have counted all n: " + n + " num: " + num );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user