summaryrefslogtreecommitdiff
path: root/jstests/disk
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@10gen.com>2020-02-21 15:45:37 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-21 21:42:36 +0000
commit693d22ed23eca46967a92ce55fc6aa2c6121977b (patch)
treec77b31d36a1a79b668200c986d7046a40b82c867 /jstests/disk
parentc74cd423afc868ac8f0bd9635e38cf0f9dced2e2 (diff)
downloadmongo-693d22ed23eca46967a92ce55fc6aa2c6121977b.tar.gz
Revert "SERVER-39714 Drop unfinished indexes on modified collections during repair when run on a replica set node"
This reverts commit 2ab8c98d285b3cf9481dc34fe77e1a019615f0ad.
Diffstat (limited to 'jstests/disk')
-rw-r--r--jstests/disk/repair_unfinished_indexes.js95
1 files changed, 0 insertions, 95 deletions
diff --git a/jstests/disk/repair_unfinished_indexes.js b/jstests/disk/repair_unfinished_indexes.js
deleted file mode 100644
index 3b895cfbdd4..00000000000
--- a/jstests/disk/repair_unfinished_indexes.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * This test shuts down a replica set during a two-phase index build. The test corrupts a WiredTiger
- * collection file and expects that --repair salvages the data and drops the unfinished index.
- *
- * @tags: [requires_wiredtiger, requires_replication]
- */
-
-(function() {
-
-load('jstests/disk/libs/wt_file_helper.js');
-load('jstests/noPassthrough/libs/index_build.js');
-
-const dbName = "repair_unfinished_indexes";
-const collName = "test";
-
-const replSet = new ReplSetTest({nodes: 2});
-replSet.startSet();
-replSet.initiate();
-
-const primary = replSet.getPrimary();
-const primaryDB = primary.getDB(dbName);
-
-if (!IndexBuildTest.supportsTwoPhaseIndexBuild(primary)) {
- jsTestLog('Two phase index builds not supported, skipping test.');
- rst.stopSet();
- return;
-}
-
-const secondary = replSet.getSecondary();
-const secondaryDB = secondary.getDB(dbName);
-const secondaryPort = secondary.port;
-const secondaryDbpath = secondary.dbpath;
-
-const primaryColl = primaryDB.getCollection(collName);
-
-assert.commandWorked(primaryColl.insert({_id: 0, a: 1}));
-
-jsTestLog("Starting index build on primary and pausing before completion");
-IndexBuildTest.pauseIndexBuilds(primary);
-const createIdx = IndexBuildTest.startIndexBuild(primary, primaryColl.getFullName(), {a: 1});
-
-jsTestLog("Waiting for secondary to start the index build");
-IndexBuildTest.waitForIndexBuildToStart(secondaryDB);
-
-const secondaryCollUri = getUriForColl(secondaryDB[collName]);
-replSet.stop(secondary);
-
-// Confirm that the secondary node leaves the index as unfinished.
-(function startAsStandalone() {
- jsTestLog("Starting secondary as standalone");
- const mongod = startMongodOnExistingPath(secondaryDbpath);
- IndexBuildTest.assertIndexes(mongod.getDB(dbName).getCollection(collName),
- 2,
- ["_id_"],
- ["a_1"],
- {includeBuildUUIDs: true});
- MongoRunner.stopMongod(mongod);
-})();
-
-const exitCode = createIdx({checkExitSuccess: false});
-assert.neq(0, exitCode, 'expected shell to exit abnormally due to shutdown');
-
-const secondaryCollFile = secondaryDbpath + "/" + secondaryCollUri + ".wt";
-jsTestLog("Corrupting secondary collection file: " + secondaryCollFile);
-corruptFile(secondaryCollFile);
-assertRepairSucceeds(secondaryDbpath, secondaryPort);
-
-// Importantly, confirm that the secondary node dropped the unfinished index.
-(function startAsStandaloneAfterRepair() {
- jsTestLog("Starting secondary as standalone after repair");
- const mongod = startMongodOnExistingPath(secondaryDbpath);
- IndexBuildTest.assertIndexes(
- mongod.getDB(dbName).getCollection(collName), 1, ["_id_"], [], {includeBuildUUIDs: true});
- MongoRunner.stopMongod(mongod);
-})();
-
-// The secondary may not be reintroduced because data was modified.
-assertErrorOnStartupWhenStartingAsReplSet(
- secondaryDbpath, secondaryPort, replSet.getReplSetConfig()._id);
-
-(function reSyncSecondary() {
- jsTestLog("Wiping dbpath and re-syncing secondary");
- const newSecondary = assertStartInReplSet(
- replSet, secondary, true /* cleanData */, true /* expectResync */, function(node) {});
-
- IndexBuildTest.resumeIndexBuilds(primary);
- IndexBuildTest.waitForIndexBuildToStop(primaryDB);
- IndexBuildTest.waitForIndexBuildToStop(newSecondary.getDB(dbName));
- IndexBuildTest.assertIndexes(primaryColl, 2, ["_id_", "a_1"]);
- IndexBuildTest.assertIndexes(
- newSecondary.getDB(dbName).getCollection(collName), 2, ["_id_", "a_1"]);
-})();
-
-replSet.stopSet();
-})();