summaryrefslogtreecommitdiff
path: root/src/mongo/db/btree.h
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2012-10-10 13:33:07 -0700
committerAaron <aaron@10gen.com>2012-10-23 16:36:46 -0700
commit40020f6e56381b1fc6533aa3e85cf01f568ccaea (patch)
tree0b0e70e78dfe7355b71bc60f934bdd0d4b79b8b8 /src/mongo/db/btree.h
parent2b049cb181d18870a26b2dbce4927d6de5e7c418 (diff)
downloadmongo-40020f6e56381b1fc6533aa3e85cf01f568ccaea.tar.gz
SERVER-1752 Within BtreeCursor::currentMatches(), filter keys that do not match the FieldRangeVector's index bounds.
Diffstat (limited to 'src/mongo/db/btree.h')
-rw-r--r--src/mongo/db/btree.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/btree.h b/src/mongo/db/btree.h
index 63010f8caf7..147ff56c601 100644
--- a/src/mongo/db/btree.h
+++ b/src/mongo/db/btree.h
@@ -1097,6 +1097,8 @@ namespace mongo {
virtual CoveredIndexMatcher *matcher() const { return _matcher.get(); }
+ virtual bool currentMatches( MatchDetails* details = 0 );
+
virtual void setMatcher( shared_ptr< CoveredIndexMatcher > matcher ) { _matcher = matcher; }
virtual const Projection::KeyOnly *keyFieldsOnly() const { return _keyFieldsOnly.get(); }
@@ -1122,7 +1124,16 @@ namespace mongo {
virtual bool skipUnusedKeys() = 0;
bool skipOutOfRangeKeysAndCheckEnd();
+
+ /**
+ * Attempt to locate the next btree key matching _bounds. This may mean advancing to the
+ * next successive key in the btree, or skipping to a new position in the btree. If an
+ * internal iteration cutoff is reached before a matching key is found, then the search for
+ * a matching key will be aborted, leaving the cursor pointing at a key that is not within
+ * bounds.
+ */
void skipAndCheck();
+
void checkEnd();
/** selective audits on construction */
@@ -1159,6 +1170,10 @@ namespace mongo {
DiskLoc locAtKeyOfs;
shared_ptr< FieldRangeVector > _bounds;
auto_ptr< FieldRangeVectorIterator > _boundsIterator;
+ bool _boundsMustMatch; // If iteration is aborted before a key matching _bounds is
+ // identified, the cursor may be left pointing at a key that is not
+ // within bounds (_bounds->matchesKey( currKey() ) may be false).
+ // _boundsMustMatch will be set to false accordingly.
shared_ptr< CoveredIndexMatcher > _matcher;
shared_ptr<Projection::KeyOnly> _keyFieldsOnly;
bool _independentFieldRanges;