[SERVER-37284] ndeleted:0 is logged/profiled when the number of deleted documents is not known Created: 24/Sep/18  Updated: 29/Oct/23  Resolved: 13/Dec/18

Status: Closed
Project: Core Server
Component/s: Logging, Write Ops
Affects Version/s: None
Fix Version/s: 4.0.6

Type: Bug Priority: Minor - P4
Reporter: David Storch Assignee: Backlog - Query Team (Inactive)
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Query
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

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
Participants:

 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.



 Comments   
Comment by Githook User [ 13/Dec/18 ]

Author:

{'username': 'bLamarche413', 'email': 'thesisiwbl@gmail.com', 'name': 'Brigitte Lamarche'}

Message: SERVER-37284 Do not log/profile ndeleted when the number of deleted documents is not known
Branch: master
https://github.com/mongodb/mongo/commit/5beb7c7b1b6534e7b3d570ddc775a1fa7094dbb0

Generated at Thu Feb 08 04:45:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.