[SERVER-14171] nscanned and nscannedObjects misreported for update() operations using BasicCursor Created: 05/Jun/14  Updated: 05/Jun/14  Resolved: 05/Jun/14

Status: Closed
Project: Core Server
Component/s: Logging
Affects Version/s: 2.6.1
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Norman Graham Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-13764 debug mechanisms report incorrect nsc... Closed
Operating System: ALL
Steps To Reproduce:

var tdb = db.getSiblingDB("updateLogTest")
var coll = tdb.getCollection("c");
 
coll.drop();
for (var i = 0; i < 1000; i++) coll.insert({val:i});
 
tdb.setProfilingLevel(0);
tdb.system.profile.drop();
tdb.setProfilingLevel(2,0);
tdb.adminCommand({setParameter:1, logLevel:1});
 
coll.find({val:999});
coll.update({val:999}, {$set: {val:1000}});
 
tdb.adminCommand({setParameter:1, logLevel:0});
tdb.setProfilingLevel(0,100);
 
var spQuery = tdb.system.profile.findOne({ns:"updateLogTest.c", op:"query"});
var spUpdate = tdb.system.profile.findOne({ns:"updateLogTest.c", op:"update"});
 
assert.eq(1000, spQuery.nscanned);
assert.eq(1000, spQuery.nscannedObjects);
assert.eq(1000, spUpdate.nscanned);        // fails, nscanned == 1
assert.eq(1000, spUpdate.nscannedObjects); // fails, nscannedObjects == 1

Participants:

 Description   

update() reports nscanned = 1 and nscannedObjects = 1 when scanning 1000 documents to find the update target. find() reports nscanned = 1000 and nscannedObjects = 1000 for the identical query.

The error appears in the system.profile collection and in the mongod log.


Generated at Thu Feb 08 03:34:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.