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

findAndModify doesn't honour MaxTimeMS

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.5.5
    • Component/s: Write Ops
    • ALL
    • Hide

      In the shell

      t = db.find_and_modify;
      t.drop();
      
      // fill db
      for(var i=1; i<=10000; i++) {
          t.insert({b:i, c:false, d:0});
      }
      
      // Ensure we aren't simulating this.
      t.getDB().adminCommand({configureFailPoint: "maxTimeAlwaysTimeOut", mode: "off"}).ok;
       
      t.find({a:1}).maxTimeMS(1);
      // error: { "$err" : "operation exceeded time limit", "code" : 50 }
      
      t.findAndModify({query:{a:1}, remove:1, maxTimeMS: 1});
      // null
      
      // Test again
      t.find({a:1}).maxTimeMS(1);
      // error: { "$err" : "operation exceeded time limit", "code" : 50 }
      
      Show
      In the shell t = db.find_and_modify; t.drop(); // fill db for ( var i=1; i<=10000; i++) { t.insert({b:i, c: false , d:0}); } // Ensure we aren't simulating this . t.getDB().adminCommand({configureFailPoint: "maxTimeAlwaysTimeOut" , mode: "off" }).ok; t.find({a:1}).maxTimeMS(1); // error: { "$err" : "operation exceeded time limit" , "code" : 50 } t.findAndModify({query:{a:1}, remove:1, maxTimeMS: 1}); // null // Test again t.find({a:1}).maxTimeMS(1); // error: { "$err" : "operation exceeded time limit" , "code" : 50 }

      Testing on 2.5.6-pre calling {findAndModify} with {maxTimeMS} can take longer than the set duration. Also when doing an equivalent query in a {find} it throws a {operation exceeded time limit} error.

            Assignee:
            victor.hooi Victor Hooi
            Reporter:
            ross@mongodb.com Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: