summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/disable_majority_reads_restart.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/disable_majority_reads_restart.js')
-rw-r--r--jstests/noPassthrough/disable_majority_reads_restart.js118
1 files changed, 59 insertions, 59 deletions
diff --git a/jstests/noPassthrough/disable_majority_reads_restart.js b/jstests/noPassthrough/disable_majority_reads_restart.js
index 596eabad052..0d21f0d07f3 100644
--- a/jstests/noPassthrough/disable_majority_reads_restart.js
+++ b/jstests/noPassthrough/disable_majority_reads_restart.js
@@ -5,78 +5,78 @@
* requires_wiredtiger]
*/
(function() {
- "use strict";
+"use strict";
- const dbName = "test";
- const collName = "coll";
+const dbName = "test";
+const collName = "coll";
- const rst = new ReplSetTest({nodes: 1});
- rst.startSet();
- rst.initiate();
+const rst = new ReplSetTest({nodes: 1});
+rst.startSet();
+rst.initiate();
- // Insert a document and ensure it is in the stable checkpoint by restarting.
- let coll = rst.getPrimary().getDB(dbName)[collName];
- assert.commandWorked(coll.insert({_id: 0}, {writeConcern: {w: "majority"}}));
- rst.stopSet(undefined, true);
- rst.startSet(undefined, true);
+// Insert a document and ensure it is in the stable checkpoint by restarting.
+let coll = rst.getPrimary().getDB(dbName)[collName];
+assert.commandWorked(coll.insert({_id: 0}, {writeConcern: {w: "majority"}}));
+rst.stopSet(undefined, true);
+rst.startSet(undefined, true);
- // Disable snapshotting on all members of the replica set so that further operations do not
- // enter the majority snapshot.
- assert.commandWorked(rst.getPrimary().adminCommand(
- {configureFailPoint: "disableSnapshotting", mode: "alwaysOn"}));
+// Disable snapshotting on all members of the replica set so that further operations do not
+// enter the majority snapshot.
+assert.commandWorked(
+ rst.getPrimary().adminCommand({configureFailPoint: "disableSnapshotting", mode: "alwaysOn"}));
- // Insert a document that will not be in a stable checkpoint.
- coll = rst.getPrimary().getDB(dbName)[collName];
- assert.commandWorked(coll.insert({_id: 1}));
+// Insert a document that will not be in a stable checkpoint.
+coll = rst.getPrimary().getDB(dbName)[collName];
+assert.commandWorked(coll.insert({_id: 1}));
- // Restart the node with enableMajorityReadConcern:false.
- rst.stopSet(undefined, true);
- rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"});
+// Restart the node with enableMajorityReadConcern:false.
+rst.stopSet(undefined, true);
+rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"});
- // Both inserts should be reflected in the data and the oplog.
- coll = rst.getPrimary().getDB(dbName)[collName];
- assert.eq([{_id: 0}, {_id: 1}], coll.find().sort({_id: 1}).toArray());
- let oplog = rst.getPrimary().getDB("local").oplog.rs;
- assert.eq(1, oplog.find({o: {_id: 0}}).itcount());
- assert.eq(1, oplog.find({o: {_id: 1}}).itcount());
+// Both inserts should be reflected in the data and the oplog.
+coll = rst.getPrimary().getDB(dbName)[collName];
+assert.eq([{_id: 0}, {_id: 1}], coll.find().sort({_id: 1}).toArray());
+let oplog = rst.getPrimary().getDB("local").oplog.rs;
+assert.eq(1, oplog.find({o: {_id: 0}}).itcount());
+assert.eq(1, oplog.find({o: {_id: 1}}).itcount());
- // Restart the node with enableMajorityReadConcern:false without adding any documents.
- rst.stopSet(undefined, true);
- rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"});
+// Restart the node with enableMajorityReadConcern:false without adding any documents.
+rst.stopSet(undefined, true);
+rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"});
- // Both inserts should still be reflected in the data and the oplog.
- coll = rst.getPrimary().getDB(dbName)[collName];
- assert.eq([{_id: 0}, {_id: 1}], coll.find().sort({_id: 1}).toArray());
- oplog = rst.getPrimary().getDB("local").oplog.rs;
- assert.eq(1, oplog.find({o: {_id: 0}}).itcount());
- assert.eq(1, oplog.find({o: {_id: 1}}).itcount());
+// Both inserts should still be reflected in the data and the oplog.
+coll = rst.getPrimary().getDB(dbName)[collName];
+assert.eq([{_id: 0}, {_id: 1}], coll.find().sort({_id: 1}).toArray());
+oplog = rst.getPrimary().getDB("local").oplog.rs;
+assert.eq(1, oplog.find({o: {_id: 0}}).itcount());
+assert.eq(1, oplog.find({o: {_id: 1}}).itcount());
- // Insert another document.
- assert.commandWorked(coll.insert({_id: 2}, {writeConcern: {w: "majority"}}));
+// Insert another document.
+assert.commandWorked(coll.insert({_id: 2}, {writeConcern: {w: "majority"}}));
- // Restart the node with enableMajorityReadConcern:false.
- rst.stopSet(undefined, true);
- rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"});
+// Restart the node with enableMajorityReadConcern:false.
+rst.stopSet(undefined, true);
+rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"});
- // All three inserts should be reflected in the data and the oplog.
- coll = rst.getPrimary().getDB(dbName)[collName];
- assert.eq([{_id: 0}, {_id: 1}, {_id: 2}], coll.find().sort({_id: 1}).toArray());
- oplog = rst.getPrimary().getDB("local").oplog.rs;
- assert.eq(1, oplog.find({o: {_id: 0}}).itcount());
- assert.eq(1, oplog.find({o: {_id: 1}}).itcount());
- assert.eq(1, oplog.find({o: {_id: 2}}).itcount());
+// All three inserts should be reflected in the data and the oplog.
+coll = rst.getPrimary().getDB(dbName)[collName];
+assert.eq([{_id: 0}, {_id: 1}, {_id: 2}], coll.find().sort({_id: 1}).toArray());
+oplog = rst.getPrimary().getDB("local").oplog.rs;
+assert.eq(1, oplog.find({o: {_id: 0}}).itcount());
+assert.eq(1, oplog.find({o: {_id: 1}}).itcount());
+assert.eq(1, oplog.find({o: {_id: 2}}).itcount());
- // Restart the node with enableMajorityReadConcern:true.
- rst.stopSet(undefined, true);
- rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"});
+// Restart the node with enableMajorityReadConcern:true.
+rst.stopSet(undefined, true);
+rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"});
- // All three inserts should still be reflected in the data and the oplog.
- coll = rst.getPrimary().getDB(dbName)[collName];
- assert.eq([{_id: 0}, {_id: 1}, {_id: 2}], coll.find().sort({_id: 1}).toArray());
- oplog = rst.getPrimary().getDB("local").oplog.rs;
- assert.eq(1, oplog.find({o: {_id: 0}}).itcount());
- assert.eq(1, oplog.find({o: {_id: 1}}).itcount());
- assert.eq(1, oplog.find({o: {_id: 2}}).itcount());
+// All three inserts should still be reflected in the data and the oplog.
+coll = rst.getPrimary().getDB(dbName)[collName];
+assert.eq([{_id: 0}, {_id: 1}, {_id: 2}], coll.find().sort({_id: 1}).toArray());
+oplog = rst.getPrimary().getDB("local").oplog.rs;
+assert.eq(1, oplog.find({o: {_id: 0}}).itcount());
+assert.eq(1, oplog.find({o: {_id: 1}}).itcount());
+assert.eq(1, oplog.find({o: {_id: 2}}).itcount());
- rst.stopSet();
+rst.stopSet();
})();