diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-01-17 17:01:39 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-14 18:08:18 +0000 |
commit | e204b1d5f90096cf0c35456d3377a4c6376db2f4 (patch) | |
tree | afb8db28a87d042a20bf38626232754e46798f7e /jstests/noPassthroughWithMongod | |
parent | 59745ff53a12a06ccdf73dd0f6eef3bdf118a902 (diff) | |
download | mongo-e204b1d5f90096cf0c35456d3377a4c6376db2f4.tar.gz |
SERVER-40883 Remove jstests for retrying index builds on startup
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r-- | jstests/noPassthroughWithMongod/indexbg_restart_secondary_noretry.js | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/jstests/noPassthroughWithMongod/indexbg_restart_secondary_noretry.js b/jstests/noPassthroughWithMongod/indexbg_restart_secondary_noretry.js deleted file mode 100644 index 6742ed871cc..00000000000 --- a/jstests/noPassthroughWithMongod/indexbg_restart_secondary_noretry.js +++ /dev/null @@ -1,109 +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'; - -load('jstests/noPassthrough/libs/index_build.js'); - -// 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(); - -// This test requires index builds to start on the createIndexes oplog entry and expects -// index builds to be interrupted when the primary steps down. -if (IndexBuildTest.supportsTwoPhaseIndexBuild(master)) { - jsTestLog('Two phase index builds not supported, skipping test.'); - replTest.stopSet(); - return; -} - -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.commandWorked(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(); -}()); |