summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-01-17 17:01:39 -0500
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-01-17 17:08:08 -0500
commit163249fdf57473baa969a5519456a5d7817bf40b (patch)
tree83b7bc281c3486e80538d722bf093dde980e5701 /jstests/noPassthroughWithMongod
parenta47e42994c06fc500bdcd0bf53d99e199ad5117c (diff)
downloadmongo-163249fdf57473baa969a5519456a5d7817bf40b.tar.gz
SERVER-38705 Remove jstests for retrying index builds on startup
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r--jstests/noPassthroughWithMongod/indexbg_restart_secondary_noretry.js95
1 files changed, 0 insertions, 95 deletions
diff --git a/jstests/noPassthroughWithMongod/indexbg_restart_secondary_noretry.js b/jstests/noPassthroughWithMongod/indexbg_restart_secondary_noretry.js
deleted file mode 100644
index 97bcaff5412..00000000000
--- a/jstests/noPassthroughWithMongod/indexbg_restart_secondary_noretry.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Starts a replica set, builds an index in background. Kills the secondary with a failpoint once
- * the index build starts. It should *not* build an index on the secondary on restart due to
- * `--noIndexBuildRetry` option being supplied.
- */
-
-// @tags: [requires_persistence, requires_journaling, requires_replication]
-(function() {
- 'use strict';
-
- // Assert that running `mongod` with `--noIndexBuildRetry` and `--replSet` does not startup.
- {
- // If code breaks the incompatibility between `--noIndexBuildRetry` and `--replSet`, using
- // `notAStorageEngine` will cause a failure later in execution that returns a different
- // exit code (100).
- var process = MongoRunner.runMongod({
- noIndexBuildRetry: "",
- replSet: "rs0",
- storageEngine: "notAStorageEngine",
- waitForConnect: false
- });
- var exitCode = waitProgram(process.pid);
- assert.eq(1, exitCode);
- }
-
- // Skip db hash check because secondary will have different number of indexes due to the
- // --noIndexBuildRetry command line option.
- TestData.skipCheckDBHashes = true;
-
- // Set up replica set.
- var replTest = new ReplSetTest({name: 'bgIndexNoRetry', nodes: 3});
- var nodenames = replTest.nodeList();
-
- var nodes = replTest.startSet();
- replTest.initiate({
- "_id": "bgIndexNoRetry",
- "members": [
- {"_id": 0, "host": nodenames[0]},
- {"_id": 1, "host": nodenames[1]},
- {"_id": 2, "host": nodenames[2], arbiterOnly: true}
- ]
- });
-
- var master = replTest.getPrimary();
- var second = replTest.getSecondary();
-
- var masterDB = master.getDB('bgIndexNoRetrySec');
- var secondDB = second.getDB('bgIndexNoRetrySec');
-
- var collectionName = 'jstests_bgsec';
-
- var size = 100;
-
- var masterColl = masterDB.getCollection(collectionName);
- var bulk = masterColl.initializeUnorderedBulkOp();
- for (var i = 0; i < size; ++i) {
- bulk.insert({i: i});
- }
- assert.writeOK(bulk.execute({j: true}));
- assert.eq(size, masterColl.count(), 'unexpected number of documents after bulk insert.');
-
- // Make sure the documents get replicated to the secondary.
- replTest.awaitReplication();
-
- assert.commandWorked(secondDB.adminCommand(
- {configureFailPoint: 'hangAfterStartingIndexBuildUnlocked', mode: 'alwaysOn'}));
- masterColl.createIndex({i: 1}, {background: true});
- masterDB.getLastError(2);
- assert.eq(2, masterColl.getIndexes().length);
-
- // Kill -9 and restart the secondary, after making sure all writes are durable.
- // Waiting for durable is important for both (A) the record that we started the index build so
- // it is rebuild on restart, and (B) the update to minvalid to show that we've already applied
- // the oplog entry so it isn't replayed. If (A) is present without (B), then there are two ways
- // that the index can be rebuilt on startup and this test is only for the one triggered by (A).
- secondDB.adminCommand({fsync: 1});
- replTest.stop(second, 9, {allowedExitCode: MongoRunner.EXIT_SIGKILL});
- replTest.start(
- second, {"noReplSet": true, "noIndexBuildRetry": ""}, /*restart*/ true, /*wait=*/false);
-
- // Make sure secondary comes back.
- assert.soon(function() {
- try {
- secondDB.isMaster(); // trigger a reconnect if needed
- return true;
- } catch (e) {
- return false;
- }
- }, "secondary didn't restart", 60000, 1000);
-
- var secondaryColl = secondDB.getCollection(collectionName);
-
- assert.neq(2, secondaryColl.getIndexes().length);
- replTest.stopSet();
-}());