[SERVER-23081] keyUpdates not set on MMAPv1 document move Created: 11/Mar/16  Updated: 06/Dec/22  Resolved: 27/Apr/16

Status: Closed
Project: Core Server
Component/s: Diagnostics, Querying
Affects Version/s: 3.3.2
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: James Wahlin Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-7897 keyUpdates not updated on array/multi... Closed
related to SERVER-23272 Remove misleading/not useful diagnost... Closed
is related to SERVER-17862 Unify stats reporting for log/profile... Closed
is related to SERVER-23271 Add metrics to track index key additi... Closed
Assigned Teams:
Query
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var getLatestProfileDoc = function() {
    return db.system.profile.find().sort({ts: -1}).limit(1).next();
}
 
// Confirm test is run against MMAPv1
use admin;
assert.eq(db.runCommand({ getCmdLineOpts: 1 }).parsed.storage.engine, "mmapv1");
 
 
db.test.drop();
db.test.ensureIndex({a: 1});
 
db.test.insert({a: 1, b: 1});
 
// In place document update
db.setProfilingLevel(2);
db.test.update({}, {$inc: {a: 1}});
db.setProfilingLevel(0);
var profileDoc = getLatestProfileDoc();
assert(!profileDoc.nmoved);
assert.eq(profileDoc.keyUpdates, 1, tojson(profileDoc)); 
 
// Update that triggers document move
db.setProfilingLevel(2);
db.test.update({}, {$inc: {a: 1}, $set: {c: Array(1024).toString()}});
db.setProfilingLevel(0);
var profileDoc = getLatestProfileDoc();
assert.eq(profileDoc.nmoved, 1, tojson(profileDoc));
assert.eq(profileDoc.keyUpdates, 1, tojson(profileDoc));

Participants:

 Description   

CurOp.OpDebug contains a "keyUpdates" metric that is meant to track the # of index changes for a given document update. For the MMAPv1 storage engine, keyUpdates is only updated when a document is updated in place and not when a document has to be moved on disk. This metric should include key updates on document move.



 Comments   
Comment by James Wahlin [ 27/Apr/16 ]

'keyUpdates' has been removed under SERVER-23272.

Comment by James Wahlin [ 11/Mar/16 ]

I think we should expand to cover all index modifications across read/update/delete operations. Without a true count it is hard to use this metric to gauge impact on performance.

Comment by David Storch [ 11/Mar/16 ]

The other strange thing about this metric is that it just counts the number of keys inserted due to an update. It does not reflect the following:

  • Keys removed due to an update.
  • Keys inserted due to an insert.
  • Keys removed due to a delete.

While we're at it, should we expand the meaning of keyUpdates to cover these cases?

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