[SERVER-15161] RocksCursor::_reverseLocate() Should Seek to Last if can't seek to the key Created: 06/Sep/14  Updated: 28/Apr/15  Resolved: 08/Sep/14

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: 2.7.6
Fix Version/s: 2.7.7

Type: Bug Priority: Major - P3
Reporter: Siying Dong Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: community-team, pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-13635 Clean up the storage abstraction layer Closed
Related
is related to SERVER-15055 rocks: unit testjstests/core/apitest_... Closed
is related to SERVER-15085 rocks storage fails when restarting Closed
is related to SERVER-15057 RocksStorage: deadlock when dropping ... Closed
Tested
Operating System: ALL
Steps To Reproduce:

./mongod jstests/core/fts2.js

Sprint: Server 2.7.4, Server 2.7.5, Server 2.7.6
Participants:

 Description   

Reproduction:

scons --dbg=on --opt=on --cache --rocksdb --c+11 --libc+ --osx-version-min=10.7 --cpppath=$MYREPOS/rocksdb/include --libpath=$MYREPOS/rocksdb mongod mongo
buildscripts/smoke.py --storageEngine=rocksExperiment --continue-on-failure --mode=files jstests/core/fts2.js

014-09-08T10:31:32.931-0400 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:50244 #3 (1 connection now open)
/data/db/
2014-09-08T10:31:32.937-0400 I COMMANDS [conn3] CMD: drop test.text2
2014-09-08T10:31:32.937-0400 I STORAGE  [conn3] opening db: test
2014-09-08T10:31:32.967-0400 I INDEXING [conn3] build index on: test.text2 properties: { v: 1, key: { _fts: "text", _ftsx: 1 }, name: "x_text", ns: "test.text2", weights: { x: 10, y: 1 }, default_language: "english", language_override: "language", textIndexVersion: 2 }
2014-09-08T10:31:32.968-0400 I INDEXING [conn3] build index done.  scanned 2 total records. 0 secs
2014-09-08T10:31:32.969-0400 I -        [conn3] The text command will be removed in a future release.  Use the $text query operator instead.
assert: [[ 2 ]] != [[ ]] are not equal : A4
Error: [[ 2 ]] != [[ ]] are not equal : A4
    at Error (<anonymous>)
    at doassert (src/mongo/shell/assert.js:11:14)
    at Function.assert.eq (src/mongo/shell/assert.js:38:5)
    at /Users/benety/src/mongodb/mongo/jstests/core/fts2.js:16:8
2014-09-08T10:31:32.983-0400 I QUERY    Error: [[ 2 ]] != [[ ]] are not equal : A4
    at Error (<anonymous>)
    at doassert (src/mongo/shell/assert.js:11:14)
    at Function.assert.eq (src/mongo/shell/assert.js:38:5)
    at /Users/benety/src/mongodb/mongo/jstests/core/fts2.js:16:8 at src/mongo/shell/assert.js:13
failed to load: /Users/benety/src/mongodb/mongo/jstests/core/fts2.js

-----------
Original Description:

Currently, RocksCursor::_reverseLocate() works as following:

bool _reverseLocate( const BSONObj& key, const DiskLoc loc ) {
...
_iterator->Seek( keyData );
...
if ( !_iterator->Valid() ) { // seeking outside the range of the index
_iterator->SeekToFirst();
...
Which is wrong. When seeking to a RocksDB iterator returns not valid, it means the look-up key is larger than the largest key, so we should SeekToLast() instead of SeekToFirst().



 Comments   
Comment by Githook User [ 08/Sep/14 ]

Author:

{u'username': u'siying', u'name': u'sdong', u'email': u'siying.d@fb.com'}

Message: SERVER-15161 RocksCursor::_reverseLocate() Should Seek to Last if can't seek to the key

Closes #767

Signed-off-by: Benety Goh <benety@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/ce65b2c6197b87b6cfb2e32b4285d0114fff7101

Generated at Thu Feb 08 03:37:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.