diff options
author | David Percy <david.percy@mongodb.com> | 2020-01-22 18:12:37 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2020-01-22 18:12:37 +0000 |
commit | 774c1e4a2f312e5e9470a551158ba175e0a25885 (patch) | |
tree | 7287c39384f970771b9f7cb03a87d151e8291eb6 /jstests | |
parent | 6c37d35e995c98009a87bff79ad9c2f3ff2800e5 (diff) | |
download | mongo-774c1e4a2f312e5e9470a551158ba175e0a25885.tar.gz |
SERVER-45508 Fix crash when planning collated sort within multi point interval
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/index_sort_within_multiple_point_ranges.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/jstests/core/index_sort_within_multiple_point_ranges.js b/jstests/core/index_sort_within_multiple_point_ranges.js new file mode 100644 index 00000000000..bbf175e9d9e --- /dev/null +++ b/jstests/core/index_sort_within_multiple_point_ranges.js @@ -0,0 +1,24 @@ +/* + * This is a regression test for SERVER-45508, which was an invariant failure in the query planner. + * + * Previously the invariant would be triggered only when all of these happen together: + * - an index with a collation exists + * - the query planner chooses index bounds with more than one point range + * - the point ranges are indexed in descending order + * - more than one index can satisfy the query + * - the query asks for a sort within each point range + * @tags: [assumes_no_implicit_collection_creation_after_drop] + */ +(function() { +'use strict'; + +const coll = db.collation_multi_point_range; +coll.drop(); +assert.commandWorked(db.createCollection(coll.getName(), {collation: {locale: 'fr'}})); +assert.commandWorked(coll.createIndex({x: -1})); +assert.commandWorked(coll.createIndex({x: -1, y: 1})); +coll.insert({x: 2, y: 99}); + +assert.commandWorked(coll.find({x: {$in: [2, 5]}}).sort({y: 1}).explain()); +assert.eq(1, coll.find({x: {$in: [2, 5]}}).sort({y: 1}).itcount()); +})(); |