summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/resumable_index_build_initialized.js
diff options
context:
space:
mode:
authorGregory Noma <gregory.noma@gmail.com>2020-08-13 09:59:32 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-13 14:51:56 +0000
commit424f10ec4bc7b333bd682c7490fc6147688fd0ec (patch)
treefaeab7774de8a984f101c1cb6acbb84d61ccb345 /jstests/noPassthrough/resumable_index_build_initialized.js
parent5be60b26dd703f8360157d074de889d0495cab6a (diff)
downloadmongo-424f10ec4bc7b333bd682c7490fc6147688fd0ec.tar.gz
SERVER-49409 Enable resuming index builds from the collection scan phase
Diffstat (limited to 'jstests/noPassthrough/resumable_index_build_initialized.js')
-rw-r--r--jstests/noPassthrough/resumable_index_build_initialized.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/jstests/noPassthrough/resumable_index_build_initialized.js b/jstests/noPassthrough/resumable_index_build_initialized.js
new file mode 100644
index 00000000000..354bb332452
--- /dev/null
+++ b/jstests/noPassthrough/resumable_index_build_initialized.js
@@ -0,0 +1,28 @@
+/**
+ * Tests that resumable index build state is written to disk upon clean shutdown when an index
+ * build has been initialized but has not yet begun the collection scan phase.
+ *
+ * @tags: [
+ * requires_persistence,
+ * requires_replication,
+ * ]
+ */
+(function() {
+"use strict";
+
+load("jstests/noPassthrough/libs/index_build.js");
+
+const dbName = "test";
+const failPointName = "hangIndexBuildBeforeWaitingUntilMajorityOpTime";
+
+const rst = new ReplSetTest({nodes: 1});
+rst.startSet();
+rst.initiate();
+
+const coll = rst.getPrimary().getDB(dbName).getCollection(jsTestName());
+assert.commandWorked(coll.insert({a: 1}));
+
+ResumableIndexBuildTest.run(rst, dbName, coll.getName(), {a: 1}, failPointName, {});
+
+rst.stopSet();
+})(); \ No newline at end of file