[SERVER-5581] assertion when clearing the query pattern for an unsatisfiable query (2.0 only, already fixed in 2.1) Created: 12/Apr/12  Updated: 11/Jul/16  Resolved: 16/May/12

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.0.4
Fix Version/s: 2.0.6

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Aaron Staple
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

If an attempt is made to clear the recorded index for the query plan of an unsatisfiable query, an assertion is raised because in 2.0 a query pattern cannot be generated for an unsatisfiable query.

In 2.1 a query pattern can be generated for an unsatisfiable query, so the issue no longer exists in 2.1.

t = db.t;
t.drop();
 
t.ensureIndex( { a:1 } );
t.ensureIndex( { b:1 } );
 
for( i = 0; i < 25; ++i ) {
    t.save( { a:0, b:'' } );
}
big = new Array( 1000000 ).toString();
for( i = 0; i < 50; ++i ) {
    t.save( { a:[1,3], b:big } );
}
 
// Record the a:1 index for the query pattern for { a: { $lt:1 } }, { b:1 }.                      
assert.eq( 'BtreeCursor a_1', t.find( { a:{ $lt:1 } } ).sort( { b:1 } ).explain().cursor );
 
// The multikey query pattern for this query will match that of the previous query.               
// The a:1 index will be retried for this query but fail because an in memory sort must           
// be performed on a larger data set.  This causes the single key query pattern for               
// { a:{ $lt:2, $gt:2 } }, { b:1 } to be cleared.                                                 
assert.lt( -1, t.find( { a:{ $lt:2, $gt:2 } } ).sort( { b:1 } ).itcount() );



 Comments   
Comment by auto [ 15/May/12 ]

Author:

{u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-5581 (backport only)

Only attempt to clear a query's pattern if the query is satisfiable for the specified index type.
Branch: v2.0
https://github.com/mongodb/mongo/commit/ee64e77c32287a174ceb4e51c626b21ce80ccc85

Generated at Thu Feb 08 03:09:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.