summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/libs
diff options
context:
space:
mode:
authorGregory Noma <gregory.noma@gmail.com>2020-08-24 13:25:12 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-24 20:10:51 +0000
commit9a73ca0618f9eafcf5883fae84e8d6824ee29204 (patch)
tree1f4e6d1c8ebd049ab3c253a496da5d3adf539f6f /jstests/noPassthrough/libs
parentce6cfc30df7f5545e19a2cdf84b94777eaa3b4de (diff)
downloadmongo-9a73ca0618f9eafcf5883fae84e8d6824ee29204.tar.gz
SERVER-50431 Clean up persisted Sorter data if resuming index build fails
Diffstat (limited to 'jstests/noPassthrough/libs')
-rw-r--r--jstests/noPassthrough/libs/index_build.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/jstests/noPassthrough/libs/index_build.js b/jstests/noPassthrough/libs/index_build.js
index d7ccc2d3a01..618d3ec7edd 100644
--- a/jstests/noPassthrough/libs/index_build.js
+++ b/jstests/noPassthrough/libs/index_build.js
@@ -549,6 +549,12 @@ const ResumableIndexBuildTest = class {
const coll = primary.getDB(dbName).getCollection(collName);
const indexName = "resumable_index_build";
+ // Create and drop an index so that the Sorter file name used by the index build
+ // interrupted for shutdown is not the same as the Sorter file name used when the index
+ // build is restarted.
+ assert.commandWorked(coll.createIndex({unused: 1}));
+ assert.commandWorked(coll.dropIndex({unused: 1}));
+
const awaitCreateIndex = ResumableIndexBuildTest.createIndexWithSideWrites(
rst, function(collName, indexSpec, indexName) {
assert.commandFailedWithCode(
@@ -565,8 +571,8 @@ const ResumableIndexBuildTest = class {
primary,
coll,
indexName,
- "hangIndexBuildBeforeWaitingUntilMajorityOpTime",
- {} /* failPointData */,
+ "hangIndexBuildDuringBulkLoadPhase",
+ {iteration: 0},
false /* shouldComplete */,
failpointAfterStartup);
@@ -586,9 +592,13 @@ const ResumableIndexBuildTest = class {
ResumableIndexBuildTest.checkIndexes(
rst, dbName, collName, indexName, postIndexBuildInserts);
- // If we fail after parsing, any remaining internal idents will only be cleaned up after
- // another restart.
if (!failWhileParsing) {
+ // Ensure that the persisted Sorter data was cleaned up after failing to resume. This
+ // cleanup does not occur if parsing failed.
+ assert.eq(listFiles(primary.dbpath + "/_tmp").length, 0);
+
+ // If we fail after parsing, any remaining internal idents will only be cleaned up
+ // after another restart.
clearRawMongoProgramOutput();
rst.stop(primary);
rst.start(primary, {noCleanData: true});