summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/filemd5_kill_during_yield.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/filemd5_kill_during_yield.js')
-rw-r--r--jstests/noPassthrough/filemd5_kill_during_yield.js86
1 files changed, 43 insertions, 43 deletions
diff --git a/jstests/noPassthrough/filemd5_kill_during_yield.js b/jstests/noPassthrough/filemd5_kill_during_yield.js
index 250b6f23696..e2f74bcb1ce 100644
--- a/jstests/noPassthrough/filemd5_kill_during_yield.js
+++ b/jstests/noPassthrough/filemd5_kill_during_yield.js
@@ -2,47 +2,47 @@
// up the PlanExecutor without crashing the server. This test was designed to reproduce
// SERVER-35361.
(function() {
- "use strict";
-
- const conn = MongoRunner.runMongod();
- assert.neq(null, conn);
- const db = conn.getDB("test");
- db.fs.chunks.drop();
- assert.writeOK(db.fs.chunks.insert({files_id: 1, n: 0, data: new BinData(0, "64string")}));
- assert.writeOK(db.fs.chunks.insert({files_id: 1, n: 1, data: new BinData(0, "test")}));
- db.fs.chunks.ensureIndex({files_id: 1, n: 1});
-
- const kFailPointName = "waitInFilemd5DuringManualYield";
- assert.commandWorked(db.adminCommand({configureFailPoint: kFailPointName, mode: "alwaysOn"}));
-
- const failingMD5Shell =
- startParallelShell(() => assert.commandFailedWithCode(
- db.runCommand({filemd5: 1, root: "fs"}), ErrorCodes.Interrupted),
- conn.port);
-
- // Wait for filemd5 to manually yield and hang.
- let opId;
- assert.soon(
- () => {
- const filter = {ns: "test.fs.chunks", "command.filemd5": 1, msg: kFailPointName};
- const result =
- db.getSiblingDB("admin").aggregate([{$currentOp: {}}, {$match: filter}]).toArray();
-
- if (result.length === 1) {
- opId = result[0].opid;
-
- return true;
- }
-
- return false;
- },
- () => "Failed to find operation in currentOp() output: " +
- tojson(db.currentOp({"ns": coll.getFullName()})));
-
- // Kill the operation, then disable the failpoint so the command recognizes it's been killed.
- assert.commandWorked(db.killOp(opId));
- assert.commandWorked(db.adminCommand({configureFailPoint: kFailPointName, mode: "off"}));
-
- failingMD5Shell();
- MongoRunner.stopMongod(conn);
+"use strict";
+
+const conn = MongoRunner.runMongod();
+assert.neq(null, conn);
+const db = conn.getDB("test");
+db.fs.chunks.drop();
+assert.writeOK(db.fs.chunks.insert({files_id: 1, n: 0, data: new BinData(0, "64string")}));
+assert.writeOK(db.fs.chunks.insert({files_id: 1, n: 1, data: new BinData(0, "test")}));
+db.fs.chunks.ensureIndex({files_id: 1, n: 1});
+
+const kFailPointName = "waitInFilemd5DuringManualYield";
+assert.commandWorked(db.adminCommand({configureFailPoint: kFailPointName, mode: "alwaysOn"}));
+
+const failingMD5Shell =
+ startParallelShell(() => assert.commandFailedWithCode(db.runCommand({filemd5: 1, root: "fs"}),
+ ErrorCodes.Interrupted),
+ conn.port);
+
+// Wait for filemd5 to manually yield and hang.
+let opId;
+assert.soon(
+ () => {
+ const filter = {ns: "test.fs.chunks", "command.filemd5": 1, msg: kFailPointName};
+ const result =
+ db.getSiblingDB("admin").aggregate([{$currentOp: {}}, {$match: filter}]).toArray();
+
+ if (result.length === 1) {
+ opId = result[0].opid;
+
+ return true;
+ }
+
+ return false;
+ },
+ () => "Failed to find operation in currentOp() output: " +
+ tojson(db.currentOp({"ns": coll.getFullName()})));
+
+// Kill the operation, then disable the failpoint so the command recognizes it's been killed.
+assert.commandWorked(db.killOp(opId));
+assert.commandWorked(db.adminCommand({configureFailPoint: kFailPointName, mode: "off"}));
+
+failingMD5Shell();
+MongoRunner.stopMongod(conn);
}());