summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2020-03-27 14:58:15 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-27 19:31:45 +0000
commitf73a9645f68107d856bc882ad9e3fcdb0ee2f2ed (patch)
tree005c953b4d2ce165a561079bbf08e1fba6aff790
parentb70908c4898c4b02d8c70df3f796fa3e8cfe5bdd (diff)
downloadmongo-f73a9645f68107d856bc882ad9e3fcdb0ee2f2ed.tar.gz
SERVER-46621 add test for ns field for index build db.currentOp() entry
-rw-r--r--jstests/noPassthrough/indexbg_killop_primary.js12
-rw-r--r--jstests/noPassthrough/indexbg_killop_secondary.js7
2 files changed, 17 insertions, 2 deletions
diff --git a/jstests/noPassthrough/indexbg_killop_primary.js b/jstests/noPassthrough/indexbg_killop_primary.js
index 9c11825822c..ca0d7e9bbe0 100644
--- a/jstests/noPassthrough/indexbg_killop_primary.js
+++ b/jstests/noPassthrough/indexbg_killop_primary.js
@@ -36,7 +36,17 @@ const createIdx =
// When the index build starts, find its op id.
const opId = IndexBuildTest.waitForIndexBuildToScanCollection(testDB, coll.getName(), 'a_1');
-IndexBuildTest.assertIndexBuildCurrentOpContents(testDB, opId);
+IndexBuildTest.assertIndexBuildCurrentOpContents(testDB, opId, (op) => {
+ jsTestLog('Inspecting db.currentOp() entry for index build: ' + tojson(op));
+ assert.eq(
+ undefined,
+ op.connectionId,
+ 'Was expecting IndexBuildsCoordinator op; found db.currentOp() for connection thread instead: ' +
+ tojson(op));
+ assert.eq('',
+ op.ns,
+ 'Unexpected ns field value in db.currentOp() result for index build: ' + tojson(op));
+});
// Kill the index builder thread.
assert.commandWorked(testDB.killOp(opId));
diff --git a/jstests/noPassthrough/indexbg_killop_secondary.js b/jstests/noPassthrough/indexbg_killop_secondary.js
index 9499278c35f..3628243108f 100644
--- a/jstests/noPassthrough/indexbg_killop_secondary.js
+++ b/jstests/noPassthrough/indexbg_killop_secondary.js
@@ -39,7 +39,12 @@ const createIdx =
const secondaryDB = secondary.getDB(testDB.getName());
const opId = IndexBuildTest.waitForIndexBuildToStart(secondaryDB);
-IndexBuildTest.assertIndexBuildCurrentOpContents(secondaryDB, opId);
+IndexBuildTest.assertIndexBuildCurrentOpContents(secondaryDB, opId, (op) => {
+ jsTestLog('Inspecting db.currentOp() entry for index build: ' + tojson(op));
+ assert.eq('',
+ op.ns,
+ 'Unexpected ns field value in db.currentOp() result for index build: ' + tojson(op));
+});
// Kill the index build. This should have no effect.
assert.commandWorked(secondaryDB.killOp(opId));