summaryrefslogtreecommitdiff
path: root/jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:20:35 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-27 11:02:23 -0400
commit134a4083953270e8a11430395357fb70a29047ad (patch)
treedd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js
parent1e46b5049003f427047e723ea5fab15b5a9253ca (diff)
downloadmongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js')
-rw-r--r--jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js106
1 files changed, 52 insertions, 54 deletions
diff --git a/jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js b/jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js
index 87d5d5c8b29..5d0d962cda8 100644
--- a/jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js
+++ b/jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js
@@ -6,58 +6,56 @@
* @tags: [requires_document_locking]
*/
(function() {
- "use strict";
-
- load("jstests/libs/check_log.js");
-
- function assertWriteConcernTimeout(result) {
- assert.writeErrorWithCode(result, ErrorCodes.WriteConcernFailed);
- assert(result.hasWriteConcernError(), tojson(result));
- assert(result.getWriteConcernError().errInfo.wtimeout, tojson(result));
- }
-
- const rst = new ReplSetTest({name: "writes_wait_for_all_durable", nodes: 1});
- rst.startSet();
- rst.initiate();
-
- const primary = rst.getPrimary();
- const dbName = "test";
- const collName = "majority_writes_wait_for_all_durable";
- const testDB = primary.getDB(dbName);
- const testColl = testDB[collName];
-
- TestData.dbName = dbName;
- TestData.collName = collName;
-
- testDB.runCommand({drop: collName, writeConcern: {w: "majority"}});
- assert.commandWorked(testDB.createCollection(collName, {writeConcern: {w: "majority"}}));
-
- assert.commandWorked(testDB.adminCommand({
- configureFailPoint: "hangAfterCollectionInserts",
- mode: "alwaysOn",
- data: {collectionNS: testColl.getFullName(), first_id: "b"}
- }));
-
- jsTestLog(
- "Insert a document to hang before the insert completes to hold back the all durable timestamp.");
- const joinHungWrite = startParallelShell(() => {
- assert.commandWorked(
- db.getSiblingDB(TestData.dbName)[TestData.collName].insert({_id: "b"}));
- }, primary.port);
- jsTestLog("Checking that the log contains fail point enabled.");
- checkLog.contains(
- testDB.getMongo(),
- "hangAfterCollectionInserts fail point enabled for " + testColl.getFullName());
-
- try {
- jsTest.log("Do a write with majority write concern that should time out.");
- assertWriteConcernTimeout(
- testColl.insert({_id: 0}, {writeConcern: {w: "majority", wtimeout: 2 * 1000}}));
- } finally {
- assert.commandWorked(
- primary.adminCommand({configureFailPoint: 'hangAfterCollectionInserts', mode: 'off'}));
- }
-
- joinHungWrite();
- rst.stopSet();
+"use strict";
+
+load("jstests/libs/check_log.js");
+
+function assertWriteConcernTimeout(result) {
+ assert.writeErrorWithCode(result, ErrorCodes.WriteConcernFailed);
+ assert(result.hasWriteConcernError(), tojson(result));
+ assert(result.getWriteConcernError().errInfo.wtimeout, tojson(result));
+}
+
+const rst = new ReplSetTest({name: "writes_wait_for_all_durable", nodes: 1});
+rst.startSet();
+rst.initiate();
+
+const primary = rst.getPrimary();
+const dbName = "test";
+const collName = "majority_writes_wait_for_all_durable";
+const testDB = primary.getDB(dbName);
+const testColl = testDB[collName];
+
+TestData.dbName = dbName;
+TestData.collName = collName;
+
+testDB.runCommand({drop: collName, writeConcern: {w: "majority"}});
+assert.commandWorked(testDB.createCollection(collName, {writeConcern: {w: "majority"}}));
+
+assert.commandWorked(testDB.adminCommand({
+ configureFailPoint: "hangAfterCollectionInserts",
+ mode: "alwaysOn",
+ data: {collectionNS: testColl.getFullName(), first_id: "b"}
+}));
+
+jsTestLog(
+ "Insert a document to hang before the insert completes to hold back the all durable timestamp.");
+const joinHungWrite = startParallelShell(() => {
+ assert.commandWorked(db.getSiblingDB(TestData.dbName)[TestData.collName].insert({_id: "b"}));
+}, primary.port);
+jsTestLog("Checking that the log contains fail point enabled.");
+checkLog.contains(testDB.getMongo(),
+ "hangAfterCollectionInserts fail point enabled for " + testColl.getFullName());
+
+try {
+ jsTest.log("Do a write with majority write concern that should time out.");
+ assertWriteConcernTimeout(
+ testColl.insert({_id: 0}, {writeConcern: {w: "majority", wtimeout: 2 * 1000}}));
+} finally {
+ assert.commandWorked(
+ primary.adminCommand({configureFailPoint: 'hangAfterCollectionInserts', mode: 'off'}));
+}
+
+joinHungWrite();
+rst.stopSet();
})(); \ No newline at end of file