From f73a9645f68107d856bc882ad9e3fcdb0ee2f2ed Mon Sep 17 00:00:00 2001 From: Benety Goh Date: Fri, 27 Mar 2020 14:58:15 -0400 Subject: SERVER-46621 add test for ns field for index build db.currentOp() entry --- jstests/noPassthrough/indexbg_killop_primary.js | 12 +++++++++++- jstests/noPassthrough/indexbg_killop_secondary.js | 7 ++++++- 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)); -- cgit v1.2.1