summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2020-03-10 16:46:05 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-13 18:13:40 +0000
commit60f731403d2cebe001c697111a565d5033942660 (patch)
tree9077baf53439f29cfb40d98de07058fd9aa4155b
parente0b6f8e2cae371ddaddd4dc1bd7463664d7b3583 (diff)
downloadmongo-60f731403d2cebe001c697111a565d5033942660.tar.gz
SERVER-46368 Remove indexbg_shutdown.js
(cherry picked from commit 4f64636b0da40d33662d7160a98f8a48fc5aa2fa)
-rw-r--r--jstests/noPassthrough/indexbg_shutdown.js168
1 files changed, 0 insertions, 168 deletions
diff --git a/jstests/noPassthrough/indexbg_shutdown.js b/jstests/noPassthrough/indexbg_shutdown.js
deleted file mode 100644
index 30d4e543fff..00000000000
--- a/jstests/noPassthrough/indexbg_shutdown.js
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * Starts a replica set, builds an index in background,
- * shuts down a secondary while it's building that index, and confirms that the secondary
- * shuts down cleanly, without an fassert.
- * Also confirms that killOp has no effect on the background index build on the secondary.
- *
- * @tags: [
- * requires_replication,
- * ]
- */
-
-(function() {
-"use strict";
-
-load("jstests/libs/logv2_helpers.js");
-load('jstests/noPassthrough/libs/index_build.js');
-
-var dbname = 'bgIndexSec';
-var collection = 'bgIndexShutdown';
-var size = 100;
-
-// Set up replica set
-const replTest = new ReplSetTest({
- nodes: [
- {},
- {
- // Disallow elections on secondary.
- rsConfig: {
- priority: 0,
- votes: 0,
- },
- slowms: 30000, // Don't log slow operations on secondary. See SERVER-44821.
- },
- ]
-});
-const nodes = replTest.startSet();
-replTest.initiate();
-
-var master = replTest.getPrimary();
-var second = replTest.getSecondary();
-
-var secondaryId = replTest.getNodeId(second);
-
-var masterDB = master.getDB(dbname);
-var secondDB = second.getDB(dbname);
-
-masterDB.dropDatabase();
-jsTest.log("creating test data " + size + " documents");
-const masterColl = masterDB.getCollection(collection);
-var bulk = masterColl.initializeUnorderedBulkOp();
-for (var i = 0; i < size; ++i) {
- bulk.insert({i: i, j: i * i});
-}
-assert.commandWorked(bulk.execute());
-
-IndexBuildTest.pauseIndexBuilds(second);
-
-jsTest.log("Starting background indexing");
-// Using a write concern to wait for the background index build to finish on the primary node
-// and be started on the secondary node (but not completed, as the oplog entry is written before
-// the background index build finishes).
-const indexSpecs = [
- {key: {i: -1, j: -1}, name: 'ij1', background: true},
- {key: {i: -1, j: 1}, name: 'ij2', background: true},
- {key: {i: 1, j: -1}, name: 'ij3', background: true},
- {key: {i: 1, j: 1}, name: 'ij4', background: true}
-];
-
-assert.commandWorked(masterDB.runCommand({
- createIndexes: collection,
- indexes: indexSpecs,
-}));
-const indexes = masterColl.getIndexes();
-// Number of indexes passed to createIndexes plus one for the _id index.
-assert.eq(indexSpecs.length + 1, indexes.length, tojson(indexes));
-
-// Wait for index builds to start on the secondary.
-const opId = IndexBuildTest.waitForIndexBuildToStart(secondDB);
-jsTestLog('Index builds started on secondary. Op ID of one of the builds: ' + opId);
-
-// Kill the index build. This should have no effect.
-assert.commandWorked(secondDB.killOp(opId));
-
-// There should be a message for each index we tried to create.
-if (isJsonLog(second)) {
- checkLog.containsJson(second, 20384, {
- ns: masterColl.getFullName(),
- descriptor: (desc) => {
- return desc.name === 'ij1';
- },
- });
- checkLog.containsJson(second, 20384, {
- ns: masterColl.getFullName(),
- descriptor: (desc) => {
- return desc.name === 'ij2';
- },
- });
- checkLog.containsJson(second, 20384, {
- ns: masterColl.getFullName(),
- descriptor: (desc) => {
- return desc.name === 'ij3';
- },
- });
- checkLog.containsJson(second, 20384, {
- ns: masterColl.getFullName(),
- descriptor: (desc) => {
- return desc.name === 'ij4';
- },
- });
-} else {
- checkLog.containsWithCount(
- second,
- new RegExp(
- `(index build: starting on ${
- masterColl
- .getFullName()} properties: \\{ v: 2, key: \\{ i:|index build: starting on .*"ns":"${
- masterColl.getFullName()}".*"descriptor":"\\{ v: 2, key: \\{ i)`),
- indexSpecs.length);
-}
-jsTest.log("Restarting secondary to retry replication");
-
-// Secondary should restart cleanly.
-assert.commandWorked(second.adminCommand(
- {configureFailPoint: 'leaveIndexBuildUnfinishedForShutdown', mode: 'alwaysOn'}));
-IndexBuildTest.resumeIndexBuilds(second);
-second = replTest.restart(secondaryId, {}, /*wait=*/true);
-
-// There should again be a message for each index we tried to create, because the server
-// restarts the interrupted index build upon process startup. Note, the RAMLog is reset on
-// restart, so there should just be one set of messages in the RAMLog after restart, even though
-// the message was logged twice in total.
-if (isJsonLog(second)) {
- checkLog.containsJson(second, 20384, {
- ns: masterColl.getFullName(),
- descriptor: (desc) => {
- return desc.name === 'ij1';
- },
- });
- checkLog.containsJson(second, 20384, {
- ns: masterColl.getFullName(),
- descriptor: (desc) => {
- return desc.name === 'ij2';
- },
- });
- checkLog.containsJson(second, 20384, {
- ns: masterColl.getFullName(),
- descriptor: (desc) => {
- return desc.name === 'ij3';
- },
- });
- checkLog.containsJson(second, 20384, {
- ns: masterColl.getFullName(),
- descriptor: (desc) => {
- return desc.name === 'ij4';
- },
- });
-} else {
- checkLog.containsWithCount(
- replTest.getSecondary(),
- new RegExp(
- `(index build: starting on ${
- masterColl
- .getFullName()} properties: \\{ v: 2, key: \\{ i:|index build: starting on .*"ns":"${
- masterColl.getFullName()}".*"descriptor":"\\{ v: 2, key: \\{ i)`),
- indexSpecs.length);
-}
-replTest.stopSet();
-}());