summaryrefslogtreecommitdiff
path: root/jstests/core/profile_update.js
diff options
context:
space:
mode:
authorJames Wahlin <james.wahlin@10gen.com>2016-04-22 12:17:34 -0400
committerJames Wahlin <james.wahlin@10gen.com>2016-04-25 10:57:33 -0400
commit506876412086623fdcc51dbec5dfcbe49c5361d7 (patch)
tree89ffa758ef7dab48646b6979e155f6e8982f08c8 /jstests/core/profile_update.js
parentfdef84d6f3dec1f97228c4dbddd34b4dac34d4a5 (diff)
downloadmongo-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.js22
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
+})();