From 655e78b8742ddaa860b8fb1cee4edc4368ac09ca Mon Sep 17 00:00:00 2001 From: Hari Khalsa Date: Tue, 8 Oct 2013 20:55:44 -0400 Subject: SERVER-10471 fix bounds checker bug --- src/mongo/db/query/index_bounds.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/mongo/db/query/index_bounds.cpp') 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; -- cgit v1.2.1