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

ndeleted:0 is logged/profiled when the number of deleted documents is not known

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.6
    • Component/s: Logging, Write Ops
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Run this from one shell:

      (function() {
          "use strict";
       
          db.c.drop();
          for (let i = 0; i < 100; i++) {
              assert.commandWorked(db.c.insert({a: 1}));
          }
          assert.commandWorked(db.c.createIndex({a: 1}));
       
          assert.commandWorked(db.setLogLevel(1));
       
          db.c.remove({$where: "sleep(1000);", a: 1});
      }());
      

      Then use db.currentOp() and db.killOp() to kill the multi-delete operation from another shell.

      Show
      Run this from one shell: (function() { "use strict";   db.c.drop(); for (let i = 0; i < 100; i++) { assert.commandWorked(db.c.insert({a: 1})); } assert.commandWorked(db.c.createIndex({a: 1}));   assert.commandWorked(db.setLogLevel(1));   db.c.remove({$where: "sleep(1000);", a: 1}); }()); Then use db.currentOp() and db.killOp() to kill the multi-delete operation from another shell.
    • Sprint:
      Query 2018-12-17, Query 2018-12-31

      Description

      The ndeleted stat is filled out twice. First, we set it to zero at the beginning of a delete op:

      https://github.com/mongodb/mongo/blob/9f54046049edc156b38bacb3d4d7d78b60ab213b/src/mongo/db/ops/write_ops_exec.cpp#L740

      Then, we set it to the actual number of deleted documents at the end:

      https://github.com/mongodb/mongo/blob/9f54046049edc156b38bacb3d4d7d78b60ab213b/src/mongo/db/ops/write_ops_exec.cpp#L780

      Setting the statistic to zero has the adverse consequence of causing the system to log/profile ndeleted:0 when the actual number of deleted documents is unknown. I believe this line of code is superfluous and can be removed.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: