summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/index_bounds.cpp
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-10-08 20:55:44 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-10-09 11:02:54 -0400
commit655e78b8742ddaa860b8fb1cee4edc4368ac09ca (patch)
tree81a5e9d66dd023613c71dac58d6b8ded599e6834 /src/mongo/db/query/index_bounds.cpp
parent3c831f3014fe9502a1ec78afce0448757bf7d7f7 (diff)
downloadmongo-655e78b8742ddaa860b8fb1cee4edc4368ac09ca.tar.gz
SERVER-10471 fix bounds checker bug
Diffstat (limited to 'src/mongo/db/query/index_bounds.cpp')
-rw-r--r--src/mongo/db/query/index_bounds.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mongo/db/query/index_bounds.cpp b/src/mongo/db/query/index_bounds.cpp
index 31b396e218f..23fb74d388a 100644
--- a/src/mongo/db/query/index_bounds.cpp
+++ b/src/mongo/db/query/index_bounds.cpp
@@ -317,8 +317,22 @@ namespace mongo {
}
// Field number 'firstNonContainedField' of the index key is before its current interval.
- // Tell the caller to move forward to the start of the current interval.
if (BEHIND == orientation) {
+ // It's behind our current interval, but our current interval could be wrong. Start all
+ // intervals from firstNonContainedField to the right over...
+ for (size_t i = firstNonContainedField; i < _curInterval.size(); ++i) {
+ _curInterval[i] = 0;
+ }
+
+ // ...and try again.
+ if (!findLeftmostProblem(keyValues, &firstNonContainedField, &orientation)) {
+ return VALID;
+ }
+ }
+
+ // Field number 'firstNonContainedField' of the index key is before all current intervals.
+ if (BEHIND == orientation) {
+ // Tell the caller to move forward to the start of the current interval.
*keyEltsToUse = firstNonContainedField;
*movePastKeyElts = false;