diff options
author | James Wahlin <james.wahlin@10gen.com> | 2016-04-22 12:17:34 -0400 |
---|---|---|
committer | James Wahlin <james.wahlin@10gen.com> | 2016-04-25 10:57:33 -0400 |
commit | 506876412086623fdcc51dbec5dfcbe49c5361d7 (patch) | |
tree | 89ffa758ef7dab48646b6979e155f6e8982f08c8 /jstests/core/profile_update.js | |
parent | fdef84d6f3dec1f97228c4dbddd34b4dac34d4a5 (diff) | |
download | mongo-506876412086623fdcc51dbec5dfcbe49c5361d7.tar.gz |
SERVER-23271 Add MMAPv1 profiler test for 'nmoved'
Diffstat (limited to 'jstests/core/profile_update.js')
-rw-r--r-- | jstests/core/profile_update.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/jstests/core/profile_update.js b/jstests/core/profile_update.js index 23478df4149..454bb5c22ed 100644 --- a/jstests/core/profile_update.js +++ b/jstests/core/profile_update.js @@ -69,8 +69,9 @@ } assert.commandWorked(coll.createIndex({a: 1})); - coll.update({_id: "new value", a: 4}, {$inc: {b: 1}}, {upsert: true}); + assert.writeOK(coll.update({_id: "new value", a: 4}, {$inc: {b: 1}}, {upsert: true})); profileObj = getLatestProfilerEntry(testDB); + assert.eq(profileObj.query, {_id: "new value", a: 4}, tojson(profileObj)); assert.eq(profileObj.updateobj, {$inc: {b: 1}}, tojson(profileObj)); assert.eq(profileObj.keysExamined, 0, tojson(profileObj)); @@ -81,6 +82,23 @@ assert.eq(profileObj.upsert, true, tojson(profileObj)); // + // Confirm 'nmoved' for MMAPv1. + // + if (db.serverStatus().storageEngine.name === "mmapv1") { + coll.drop(); + assert.writeOK(coll.insert({_id: 1})); + + assert.writeOK(coll.update({_id: 1}, {$set: {b: new Array(128).toString()}})); + profileObj = getLatestProfilerEntry(testDB); + + assert.eq(profileObj.keysInserted, 1, tojson(profileObj)); + assert.eq(profileObj.keysDeleted, 1, tojson(profileObj)); + assert.eq(profileObj.nMatched, 1, tojson(profileObj)); + assert.eq(profileObj.nModified, 1, tojson(profileObj)); + assert.eq(profileObj.nmoved, 1, tojson(profileObj)); + } + + // // Confirm "fromMultiPlanner" metric. // coll.drop(); @@ -94,4 +112,4 @@ profileObj = getLatestProfilerEntry(testDB); assert.eq(profileObj.fromMultiPlanner, true, tojson(profileObj)); -})();
\ No newline at end of file +})(); |