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

Some index intersection plans return internal data instead of the correct result set.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.4, 2.7.4
    • Affects Version/s: 2.6.3
    • Component/s: Querying
    • None
    • ALL
    • Hide

      To examine:

      1. ssh ubuntu@54.77.0.143 (pw: #######)
      (this is standard AWS EC2 instance with Ubuntu Server 14.04 LTS and mongo 2.6.3 installed from official repositories)
      2. run ./restart.sh located in /home/ubuntu
      3. after cca 1 minute, the script should end, you can ignore its output
      4. run mongo shell
      5. 'use mongoProviderTest'
      6. run this query:

      db.getCollection('__clean_random_history').find({$query: {$or: [{$and: [{version: {$gt: 1}}, {before: {$gt: {}}}, {"before.a": "hello"}]}, {$and: [{version: {$gt: 1}}, {after: {$gt: {}}}, {"after.a": "hello"}]}], version: {$gt: 1}}, $orderby: {version: 1}})
      

      Each document in the output should look like

      {"":1234}

      which is clearly wrong. Restart mongodb service to see the proper output.

      additional notes:

      • it is probably not matter of this specific installation, it fails on several different machines running different flavors of linux
      • this EC2 instance was created solely for demonstrating this bug, you are sudoer, feel free to play with it as you want
      • the restart.sh script only runs more sophisticated code written in Dart language. You should probably be able to reproduce this bug also on other machines: copy the appropriate files, install Dart SDK and run it. Note that even though Dart and mongoDart (connector library) are involved, this bug clearly cannot be blamed on them; no client should have the possibility to get the DB to inconsistent state.
      Show
      To examine: 1. ssh ubuntu@54.77.0.143 (pw: #######) (this is standard AWS EC2 instance with Ubuntu Server 14.04 LTS and mongo 2.6.3 installed from official repositories) 2. run ./restart.sh located in /home/ubuntu 3. after cca 1 minute, the script should end, you can ignore its output 4. run mongo shell 5. 'use mongoProviderTest' 6. run this query: db.getCollection( '__clean_random_history' ).find({$query: {$or: [{$and: [{version: {$gt: 1}}, {before: {$gt: {}}}, { "before.a" : "hello" }]}, {$and: [{version: {$gt: 1}}, {after: {$gt: {}}}, { "after.a" : "hello" }]}], version: {$gt: 1}}, $orderby: {version: 1}}) Each document in the output should look like {"":1234} which is clearly wrong. Restart mongodb service to see the proper output. additional notes: it is probably not matter of this specific installation, it fails on several different machines running different flavors of linux this EC2 instance was created solely for demonstrating this bug, you are sudoer, feel free to play with it as you want the restart.sh script only runs more sophisticated code written in Dart language. You should probably be able to reproduce this bug also on other machines: copy the appropriate files, install Dart SDK and run it. Note that even though Dart and mongoDart (connector library) are involved, this bug clearly cannot be blamed on them; no client should have the possibility to get the DB to inconsistent state.

      Issue Status as of Jul 24, 2014

      ISSUE SUMMARY
      A logical bug in the query execution code would under certain circumstances output internal representations instead of the actual result documents.

      USER IMPACT
      The scope is very narrow and can only occur on complex queries when an index intersection plan is chosen. If returned documents look like {"":1234} (or any other number) this is an indication that this bug may be triggered.

      WORKAROUNDS
      N/A

      AFFECTED VERSIONS
      All production release versions from 2.6.0 to 2.6.3 are affected by this issue.

      FIX VERSION
      The fix is included in the 2.6.4 production release.

      RESOLUTION DETAILS
      Correctly handle hash intersections with fetched and non-fetched data.

      Original description

      After making some queries, mongo gets to inconsistent state: for some specific query it gives the response such as

      {"":1234}

      which is not a proper document (for example _id is missing). The bug vanishes when restarting mongodb server.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            tomas.kulich@gmail.com Tomas Kulich
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: