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

The 'keyUpdates' metric only reflects the last document updated when performing a multi-update

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.11, 3.2.4, 3.3.4
    • Component/s: Diagnostics, Querying
    • Labels:
      None
    • Query
    • ALL
    • Hide
      db.test.drop();
      db.test.createIndex({a: 1})
      for (var j=0; j < 10; ++j) { db.test.insert({a: j}); }
      db.setProfilingLevel(2);
      db.test.update({a: {$gte: 0}}, {$inc: {a: 1}}, {multi: true});
      var profileDoc = db.system.profile.find().sort({$natural: -1}).next();
      assert.eq(10, profileDoc.keyUpdates, tojson(profileDoc));
      
      Show
      db.test.drop(); db.test.createIndex({a: 1}) for ( var j=0; j < 10; ++j) { db.test.insert({a: j}); } db.setProfilingLevel(2); db.test.update({a: {$gte: 0}}, {$inc: {a: 1}}, {multi: true }); var profileDoc = db.system.profile.find().sort({$natural: -1}).next(); assert .eq(10, profileDoc.keyUpdates, tojson(profileDoc));

      The OpDebug::keyUpdates metric is zeroed out on every call to Collection::updateDocument.

      https://github.com/mongodb/mongo/blob/r3.3.4/src/mongo/db/catalog/collection.cpp#L628-L629

      This metric will be removed for 3.4 under SERVER-23272 but we may want to consider backporting a fix to previous releases.

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            james.wahlin@mongodb.com James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: