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

write conflict on single-update isn't being retried

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.8.0-rc0
    • Component/s: Storage
    • ALL
    • Hide

      repro script / jstest that runs two threads that update the same document:

      load('jstests/libs/parallelTester.js');
      
      db.foo.drop();
      db.foo.insert({});
      assert.eq(1, db.foo.count());
      
      var t0 = new ScopedThread(function() {
          for (var i=0; i<100; ++i) {
              var res = db.foo.update({}, { $inc: { x: 1 } });
              assert.eq(1, res.nModified, res);
          }
          return 'ok';
      });
      
      
      t0.start();
      
      for (var i=0; i<100; ++i) {
          var res = db.foo.update({}, { $inc: { y: 1 } });
          assert.eq(1, res.nModified, res);
      }
      
      t0.join();
      
      Show
      repro script / jstest that runs two threads that update the same document: load( 'jstests/libs/parallelTester.js' ); db.foo.drop(); db.foo.insert({}); assert .eq(1, db.foo.count()); var t0 = new ScopedThread(function() { for ( var i=0; i<100; ++i) { var res = db.foo.update({}, { $inc: { x: 1 } }); assert .eq(1, res.nModified, res); } return 'ok' ; }); t0.start(); for ( var i=0; i<100; ++i) { var res = db.foo.update({}, { $inc: { y: 1 } }); assert .eq(1, res.nModified, res); } t0.join();

      When using WiredTiger, if a WriteConflictException happens with a single update, the operation returns nModified: 0 to the client, and the document is not updated.

            Assignee:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Reporter:
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: