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

Cursor can return objects out of order if updated during query ("legacy" readMode only)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.6.7, 2.8.0-rc5
    • Fix Version/s: 3.2.3, 3.3.0
    • Component/s: Querying
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Completed:
    • Steps To Reproduce:
      Hide

      var t = db.foo;                                                                                        
      t.drop();                                                                                              
      t.ensureIndex({a: 1, b: 1});                                                                           
      t.insert({a: 1, b: 3});                                                                                
      t.insert({a: 2, b: 2});                                                                                
      t.insert({a: 3, b: 1});                                                                                
                                                                                                             
      var cur = t.find({a: {$lt: 4}}).sort({b: -1}).batchSize(2);                                            
      printjson(cur.next());                                                                                 
      printjson(cur.next());                                                                                 
                                                                                                             
      t.update({b: 1}, {$set: {b: 4}});                                                                      
                                                                                                             
      printjson(cur.next());  // prints {a: 3, b: 4}, which is out of order

      Show
      var t = db.foo; t.drop(); t.ensureIndex({a: 1, b: 1}); t.insert({a: 1, b: 3}); t.insert({a: 2, b: 2}); t.insert({a: 3, b: 1}); var cur = t.find({a: {$lt: 4}}).sort({b: -1}).batchSize(2); printjson(cur.next()); printjson(cur.next()); t.update({b: 1}, {$set: {b: 4}}); printjson(cur.next()); // prints {a: 3, b: 4}, which is out of order
    • Sprint:
      QuInt A (10/12/15), QuInt B (11/02/15), QuInt C (11/23/15), QuInt E (01/11/16)

      Description

      Happens on 2.6.7, and 2.8.rc6, both WT and MMAPV1. See steps to reproduce.

      This bug is specific to --readMode "legacy"; it will not happen with --readMode "commands" (i.e. if you have a 3.2 server and an updated-for-3.2 driver).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: