diff options
author | Aaron <aaron@10gen.com> | 2010-08-18 11:42:58 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-08-18 11:42:58 -0700 |
commit | fe7a8dfaf48e167a5cfeed4aa1b27ae803623688 (patch) | |
tree | f370905997c9e2edec477d7e53517bf3341546fb /db/btreecursor.cpp | |
parent | fef8cb5de84145b5eee7281d41e351832af02633 (diff) | |
download | mongo-fe7a8dfaf48e167a5cfeed4aa1b27ae803623688.tar.gz |
SERVER-726 optimize exclusive bounds
Diffstat (limited to 'db/btreecursor.cpp')
-rw-r--r-- | db/btreecursor.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/db/btreecursor.cpp b/db/btreecursor.cpp index 77e86a37e09..a69bd27a785 100644 --- a/db/btreecursor.cpp +++ b/db/btreecursor.cpp @@ -64,10 +64,12 @@ namespace mongo { massert( 13384, "BtreeCursor FieldRangeVector constructor doesn't accept special indexes", !_spec.getType() ); audit(); startKey = bounds_->startKey(); - bool found; _boundsIterator->advance( startKey ); // handles initialization - bucket = indexDetails.head.btree()-> - locate(indexDetails, indexDetails.head, startKey, _ordering, keyOfs, found, direction > 0 ? minDiskLoc : maxDiskLoc, direction); + _boundsIterator->prepDive(); + pair< DiskLoc, int > noBestParent; + bucket = indexDetails.head; + keyOfs = 0; + indexDetails.head.btree()->customLocate( bucket, keyOfs, startKey, 0, false, _boundsIterator->cmp(), _boundsIterator->inc(), _ordering, direction, noBestParent ); skipAndCheck(); DEV assert( dups.size() == 0 ); } @@ -128,7 +130,7 @@ namespace mongo { return false; } ++_nscanned; - advanceTo( currKeyNode().key, ret, _boundsIterator->cmp() ); + advanceTo( currKeyNode().key, ret, _boundsIterator->after(), _boundsIterator->cmp(), _boundsIterator->inc() ); return true; } @@ -174,8 +176,8 @@ namespace mongo { } } - void BtreeCursor::advanceTo( const BSONObj &keyBegin, int keyBeginLen, const vector< const BSONElement * > &keyEnd) { - bucket.btree()->advanceTo( indexDetails, bucket, keyOfs, keyBegin, keyBeginLen, keyEnd, _ordering, direction ); + void BtreeCursor::advanceTo( const BSONObj &keyBegin, int keyBeginLen, bool afterKey, const vector< const BSONElement * > &keyEnd, const vector< bool > &keyEndInclusive) { + bucket.btree()->advanceTo( bucket, keyOfs, keyBegin, keyBeginLen, afterKey, keyEnd, keyEndInclusive, _ordering, direction ); } bool BtreeCursor::advance() { |