Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-15161

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

    • ALL
    • Hide

      ./mongod jstests/core/fts2.js

      Show
      ./mongod jstests/core/fts2.js
    • Server 2.7.4, Server 2.7.5, Server 2.7.6

      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().

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            sdong Siying Dong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: