summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/indexbg_killop_apply_ops.js
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-11-28 23:19:56 -0500
committerBenety Goh <benety@mongodb.com>2018-11-28 23:19:56 -0500
commit41c44d02cf39ef581888bed68c547e4ed9b5a323 (patch)
treeeef10e598833c21ec66524cb9d52ed96043097d5 /jstests/noPassthrough/indexbg_killop_apply_ops.js
parent03e13f90426a82a97cbb0f926385e09904519259 (diff)
downloadmongo-41c44d02cf39ef581888bed68c547e4ed9b5a323.tar.gz
SERVER-37729 background index builds on secondaries cannot be interrupted by killOp
Diffstat (limited to 'jstests/noPassthrough/indexbg_killop_apply_ops.js')
-rw-r--r--jstests/noPassthrough/indexbg_killop_apply_ops.js18
1 files changed, 5 insertions, 13 deletions
diff --git a/jstests/noPassthrough/indexbg_killop_apply_ops.js b/jstests/noPassthrough/indexbg_killop_apply_ops.js
index 6867efb1a23..093a6590a83 100644
--- a/jstests/noPassthrough/indexbg_killop_apply_ops.js
+++ b/jstests/noPassthrough/indexbg_killop_apply_ops.js
@@ -52,23 +52,19 @@
// When the index build starts, find its op id.
const opId = IndexBuildTest.waitForIndexBuildToStart(testDB);
- // Kill the index build.
+ // Kill the index build. This should have no effect.
assert.commandWorked(testDB.killOp(opId));
// Wait for the index build to stop.
- try {
- IndexBuildTest.waitForIndexBuildToStop(testDB);
- } finally {
- IndexBuildTest.resumeIndexBuilds(primary);
- }
+ IndexBuildTest.resumeIndexBuilds(primary);
+ IndexBuildTest.waitForIndexBuildToStop(testDB);
// Expect successful createIndex command invocation in parallel shell because applyOps returns
// immediately after starting the background index build in a separate thread.
createIdx();
- // Check that no new index has been created. This verifies that the index build was aborted
- // rather than successfully completed.
- IndexBuildTest.assertIndexes(coll, 1, ['_id_']);
+ // Check that index was created on the primary despite the attempted killOp().
+ IndexBuildTest.assertIndexes(coll, 2, ['_id_', 'a_1']);
// Check that a new index has been created on the secondary.
// This is due to the createIndexes command being replicated to the secondary before the primary
@@ -79,9 +75,5 @@
const secondaryColl = secondaryDB.getCollection(coll.getName());
IndexBuildTest.assertIndexes(secondaryColl, 2, ['_id_', 'a_1']);
- // Index 'a_1' was aborted on the primary, resulting in a different set of indexes on the
- // secondary compared to the primary. Therefore, we skip the dbhash checking while tearing down
- // the replica set test fixture.
- TestData.skipCheckDBHashes = true;
rst.stopSet();
})();