Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SERVER-4327 allow dummy table scans in notablescan mode

  • Loading branch information...
commit 2bd1aeb2996b7cba38218b3daddf04b12245b98d 1 parent baa097c
@astaple astaple authored
Showing with 13 additions and 8 deletions.
  1. +13 −4 jstests/notablescan.js
  2. +0 −4 src/mongo/db/queryoptimizer.cpp
View
17 jstests/notablescan.js
@@ -6,15 +6,24 @@ t.drop();
try {
assert.commandWorked( db._adminCommand( { setParameter:1, notablescan:true } ) );
// commented lines are SERVER-2222
-// assert.throws( function() { t.find( {a:1} ).toArray(); } );
+ if ( 0 ) { // SERVER-2222
+ assert.throws( function() { t.find( {a:1} ).toArray(); } );
+ }
t.save( {a:1} );
-// assert.throws( function() { t.count( {a:1} ); } );
-// assert.throws( function() { t.find( {} ).toArray(); } );
+ if ( 0 ) { // SERVER-2222
+ assert.throws( function() { t.count( {a:1} ); } );
+ assert.throws( function() { t.find( {} ).toArray(); } );
+ }
+ assert.eq( 1, t.find( {} ).itcount() ); // SERVER-274
assert.throws( function() { t.find( {a:1} ).toArray(); } );
assert.throws( function() { t.find( {a:1} ).hint( {$natural:1} ).toArray(); } );
t.ensureIndex( {a:1} );
assert.eq( 0, t.find( {a:1,b:1} ).itcount() );
- assert.eq( 1, t.find( {a:1,b:null} ).itcount() );
+ assert.eq( 1, t.find( {a:1,b:null} ).itcount() );
+
+ // SERVER-4327
+ assert.eq( 0, t.find( {a:{$in:[]}} ).itcount() );
+ assert.eq( 0, t.find( {a:{$in:[]},b:0} ).itcount() );
} finally {
// We assume notablescan was false before this test started and restore that
// expected value.
View
4 src/mongo/db/queryoptimizer.cpp
@@ -204,10 +204,6 @@ namespace mongo {
}
if ( _impossible ) {
- // TODO We might want to allow this dummy table scan even in no table
- // scan mode, since it won't scan anything.
- if ( _frs.nNontrivialRanges() )
- checkTableScanAllowed( _frs.ns() );
return shared_ptr<Cursor>( new BasicCursor( DiskLoc() ) );
}
Please sign in to comment.
Something went wrong with that request. Please try again.