summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoustafa Maher <m.maher@10gen.com>2021-04-29 01:19:06 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-29 23:07:54 +0000
commit0d97b041970929e7e56caa42ee8837cec92d2264 (patch)
tree3508368450bd271faed556cfb298624da9cb9543
parent15fb9ff89f2074704735c0a8629d0013b530747b (diff)
downloadmongo-0d97b041970929e7e56caa42ee8837cec92d2264.tar.gz
SERVER-55703 Update getDefaultRWConcern
-rw-r--r--jstests/replsets/agg_write_concern_zero_batch_size.js4
-rw-r--r--jstests/replsets/apply_ops_wc.js6
-rw-r--r--jstests/replsets/avg_num_catchup_ops.js4
-rw-r--r--jstests/replsets/await_replication_timeout.js5
-rw-r--r--jstests/replsets/awaitdata_getmore_new_last_committed_optime.js3
-rw-r--r--jstests/replsets/catchup.js4
-rw-r--r--jstests/replsets/catchup_takeover_one_high_priority.js3
-rw-r--r--jstests/replsets/chaining_removal.js5
-rw-r--r--jstests/replsets/check_replicated_data_hashes_inconsistent_state.js4
-rw-r--r--jstests/replsets/clean_shutdown_oplog_state.js3
-rw-r--r--jstests/replsets/collate_id.js4
-rw-r--r--jstests/replsets/collection_clone_resume_after_network_error.js5
-rw-r--r--jstests/replsets/commit_transaction_recovery.js4
-rw-r--r--jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js5
-rw-r--r--jstests/replsets/dont_read_oplog_hole_on_step_up.js4
-rw-r--r--jstests/replsets/drain.js5
-rw-r--r--jstests/replsets/drop_databases_two_phase.js3
-rw-r--r--jstests/replsets/force_reconfig_skips_oplog_commitment.js3
-rw-r--r--jstests/replsets/fsync_lock_read_secondaries.js4
-rw-r--r--jstests/replsets/index_delete.js4
-rw-r--r--jstests/replsets/initial_sync_commit_prepared_transaction.js4
-rw-r--r--jstests/replsets/initial_sync_drop_collection.js4
-rw-r--r--jstests/replsets/initial_sync_during_stepdown.js4
-rw-r--r--jstests/replsets/initial_sync_fails_when_source_removed.js4
-rw-r--r--jstests/replsets/initial_sync_fails_when_source_resyncs.js4
-rw-r--r--jstests/replsets/initial_sync_fcv.js3
-rw-r--r--jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp.js4
-rw-r--r--jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js4
-rw-r--r--jstests/replsets/initial_sync_oplog_hole.js4
-rw-r--r--jstests/replsets/initial_sync_rename_collection.js4
-rw-r--r--jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js5
-rw-r--r--jstests/replsets/initial_sync_survives_network_error.js4
-rw-r--r--jstests/replsets/initial_sync_survives_restart.js5
-rw-r--r--jstests/replsets/initial_sync_uuid_not_found.js4
-rw-r--r--jstests/replsets/interrupted_batch_insert.js4
-rw-r--r--jstests/replsets/libs/prepare_standalone_replication_recovery.js4
-rw-r--r--jstests/replsets/libs/rollback_test.js4
-rw-r--r--jstests/replsets/libs/rollback_test_deluxe.js4
-rw-r--r--jstests/replsets/libs/tenant_migration_recipient_sync_source.js5
-rw-r--r--jstests/replsets/libs/two_phase_drops.js5
-rw-r--r--jstests/replsets/linearizable_read_concern.js10
-rw-r--r--jstests/replsets/log_secondary_oplog_application.js4
-rw-r--r--jstests/replsets/maintenance_non-blocking.js4
-rw-r--r--jstests/replsets/maxSyncSourceLagSecs.js9
-rw-r--r--jstests/replsets/new_sync_source_in_quiesce_mode.js4
-rw-r--r--jstests/replsets/no_chaining.js5
-rw-r--r--jstests/replsets/no_progress_updates_during_initial_sync.js4
-rw-r--r--jstests/replsets/node_restarts_no_oplog_entry_at_stable.js4
-rw-r--r--jstests/replsets/nodes_eventually_sync_from_closer_data_center.js6
-rw-r--r--jstests/replsets/nodes_in_primarys_datacenter_dont_sync_across_datacenters.js6
-rw-r--r--jstests/replsets/noop_writes_wait_for_write_concern_fcv.js3
-rw-r--r--jstests/replsets/prepare_prepared_transaction_wc_timeout.js4
-rw-r--r--jstests/replsets/prepare_transaction_index_build.js4
-rw-r--r--jstests/replsets/read_committed.js4
-rw-r--r--jstests/replsets/read_committed_after_rollback.js4
-rw-r--r--jstests/replsets/read_committed_lookup.js11
-rw-r--r--jstests/replsets/read_committed_on_secondary.js5
-rw-r--r--jstests/replsets/read_committed_stale_history.js5
-rw-r--r--jstests/replsets/read_committed_with_catalog_changes.js4
-rw-r--r--jstests/replsets/read_concern_majority_getmore_secondaries.js4
-rw-r--r--jstests/replsets/reconfig_only_counts_voting_nodes_for_oplog_commitment.js4
-rw-r--r--jstests/replsets/reconfig_waits_for_oplog_commitment_condition.js4
-rw-r--r--jstests/replsets/reconfig_waits_for_oplog_commitment_condition_when_leaving_force.js4
-rw-r--r--jstests/replsets/reconstruct_prepared_transactions_initial_sync.js4
-rw-r--r--jstests/replsets/reconstruct_prepared_transactions_initial_sync_change_oldest_active_txn_timestamp.js5
-rw-r--r--jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js3
-rw-r--r--jstests/replsets/reconstruct_prepared_transactions_initial_sync_on_oplog_seed.js4
-rw-r--r--jstests/replsets/recover_multiple_prepared_transactions_startup.js4
-rw-r--r--jstests/replsets/recover_prepared_transactions_startup_secondary_application.js4
-rw-r--r--jstests/replsets/recovery_after_clean_shutdown_but_not_all_writes_in_snapshot.js5
-rw-r--r--jstests/replsets/replSetGetStatus_new_term_oplog_entry_fields.js4
-rw-r--r--jstests/replsets/resync_majority_member.js4
-rw-r--r--jstests/replsets/rollback_ddl_op_sequences.js6
-rw-r--r--jstests/replsets/rollback_transaction_table.js4
-rw-r--r--jstests/replsets/rollback_views.js4
-rw-r--r--jstests/replsets/secondarydelaysecs_sync_source.js6
-rw-r--r--jstests/replsets/secondarydelaysecs_waits_for_writes.js6
-rw-r--r--jstests/replsets/server8070.js4
-rw-r--r--jstests/replsets/server_status_metrics.js4
-rw-r--r--jstests/replsets/speculative_read_transaction.js3
-rw-r--r--jstests/replsets/speculative_transaction.js3
-rw-r--r--jstests/replsets/standalone_replication_recovery_idempotent.js4
-rw-r--r--jstests/replsets/step_down_during_draining.js5
-rw-r--r--jstests/replsets/step_down_during_draining2.js5
-rw-r--r--jstests/replsets/step_down_during_draining3.js5
-rw-r--r--jstests/replsets/stepdown.js4
-rw-r--r--jstests/replsets/stepdown_catch_up_opt.js4
-rw-r--r--jstests/replsets/stepdown_killop.js4
-rw-r--r--jstests/replsets/stepdown_long_wait_time.js3
-rw-r--r--jstests/replsets/stepup.js4
-rw-r--r--jstests/replsets/tenant_migration_cloning_uses_read_concern_majority.js5
-rw-r--r--jstests/replsets/tenant_migration_donor_rollback_recovery.js5
-rw-r--r--jstests/replsets/tenant_migration_recipient_rollback_recovery.js4
-rw-r--r--jstests/replsets/transaction_table_oplog_replay.js4
-rw-r--r--jstests/replsets/update_commit_point_from_sync_source_ignores_term.js4
-rw-r--r--jstests/replsets/write_concern_after_stepdown.js6
-rw-r--r--jstests/replsets/write_concern_after_stepdown_and_stepup.js6
97 files changed, 422 insertions, 8 deletions
diff --git a/jstests/replsets/agg_write_concern_zero_batch_size.js b/jstests/replsets/agg_write_concern_zero_batch_size.js
index 4119a73d5bd..0942ec8cfff 100644
--- a/jstests/replsets/agg_write_concern_zero_batch_size.js
+++ b/jstests/replsets/agg_write_concern_zero_batch_size.js
@@ -12,6 +12,10 @@ const rst = new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0}}]});
rst.startSet();
rst.initiate();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(rst.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const testDB = rst.getPrimary().getDB("test");
const source = testDB.agg_write_concern_zero_batch_size;
const target = testDB.agg_write_concern_zero_batch_size_target;
diff --git a/jstests/replsets/apply_ops_wc.js b/jstests/replsets/apply_ops_wc.js
index 7ca6eb97f58..ef8d1585831 100644
--- a/jstests/replsets/apply_ops_wc.js
+++ b/jstests/replsets/apply_ops_wc.js
@@ -25,6 +25,12 @@ var testDB = "applyOps-wc-test";
// Get test collection.
var primary = replTest.getPrimary();
+
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
+
var db = primary.getDB(testDB);
var coll = db.apply_ops_wc;
diff --git a/jstests/replsets/avg_num_catchup_ops.js b/jstests/replsets/avg_num_catchup_ops.js
index 13bf84da5aa..f9d077eb99e 100644
--- a/jstests/replsets/avg_num_catchup_ops.js
+++ b/jstests/replsets/avg_num_catchup_ops.js
@@ -17,6 +17,10 @@ const rst = new ReplSetTest(
rst.startSet();
rst.initiateWithHighElectionTimeout();
rst.awaitSecondaryNodes();
+
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(rst.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
rst.awaitReplication();
const testNode = rst.getSecondaries()[0];
diff --git a/jstests/replsets/await_replication_timeout.js b/jstests/replsets/await_replication_timeout.js
index 6b2d7547eac..a4d1acc8d43 100644
--- a/jstests/replsets/await_replication_timeout.js
+++ b/jstests/replsets/await_replication_timeout.js
@@ -13,6 +13,11 @@ var testDB = primary.getDB('test');
const collName = 'foo';
var testColl = testDB.getCollection(collName);
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
+
// Insert a document and implicitly create the collection.
let resetCollection = function(w) {
assert.commandWorked(
diff --git a/jstests/replsets/awaitdata_getmore_new_last_committed_optime.js b/jstests/replsets/awaitdata_getmore_new_last_committed_optime.js
index 4d17389c209..1e0e77d7157 100644
--- a/jstests/replsets/awaitdata_getmore_new_last_committed_optime.js
+++ b/jstests/replsets/awaitdata_getmore_new_last_committed_optime.js
@@ -30,6 +30,9 @@ const secondaries = replSet.getSecondaries();
const secondary = secondaries[0];
const primaryDB = primary.getDB(dbName);
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
// Create capped collection on primary and allow it to be committed.
assert.commandWorked(primaryDB.createCollection(collName, {capped: true, size: 2048}));
diff --git a/jstests/replsets/catchup.js b/jstests/replsets/catchup.js
index 7ab31e4d76c..c9372e964a3 100644
--- a/jstests/replsets/catchup.js
+++ b/jstests/replsets/catchup.js
@@ -25,6 +25,10 @@ rst.awaitSecondaryNodes();
var primary = rst.getPrimary();
var primaryColl = primary.getDB("test").coll;
+// The default WC is majority and this test can't test catchup properly if it used majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Set verbosity for replication on all nodes.
var verbosity = {
"setParameter": 1,
diff --git a/jstests/replsets/catchup_takeover_one_high_priority.js b/jstests/replsets/catchup_takeover_one_high_priority.js
index 0f5e3d76ac3..a7d49c2a153 100644
--- a/jstests/replsets/catchup_takeover_one_high_priority.js
+++ b/jstests/replsets/catchup_takeover_one_high_priority.js
@@ -35,6 +35,9 @@ replSet.initiateWithAnyNodeAsPrimary({
// Wait until node 2 becomes primary.
replSet.waitForState(2, ReplSetTest.State.PRIMARY, replSet.kDefaultTimeoutMS);
jsTestLog('node 2 is now primary');
+// The default WC is majority and this test can't test catchup properly if it used majority writes.
+assert.commandWorked(replSet.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
replSet.awaitReplication();
replSet.waitForConfigReplication(nodes[2]);
diff --git a/jstests/replsets/chaining_removal.js b/jstests/replsets/chaining_removal.js
index 5244f653071..71d0a5b9aab 100644
--- a/jstests/replsets/chaining_removal.js
+++ b/jstests/replsets/chaining_removal.js
@@ -23,6 +23,11 @@ replTest.initiate({
});
replTest.awaitNodesAgreeOnPrimary(replTest.kDefaultTimeoutMS, nodes, nodes[0]);
var primary = replTest.getPrimary();
+// The default WC is majority and stopServerReplication could prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
replTest.awaitReplication();
// When setting up chaining on slow machines, we do not want slow writes or delayed heartbeats
diff --git a/jstests/replsets/check_replicated_data_hashes_inconsistent_state.js b/jstests/replsets/check_replicated_data_hashes_inconsistent_state.js
index b72014b36f0..e0abb94b7db 100644
--- a/jstests/replsets/check_replicated_data_hashes_inconsistent_state.js
+++ b/jstests/replsets/check_replicated_data_hashes_inconsistent_state.js
@@ -21,6 +21,10 @@ const primaryDB1 = primary.getDB("db1");
const primaryDB2 = primary.getDB("db2");
const collName = "testColl";
+// The default WC is majority and godinsert command on a secondary is incompatible with wc:majority.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const secondary = rst.getSecondary();
const secondaryDB = secondary.getDB("db0");
diff --git a/jstests/replsets/clean_shutdown_oplog_state.js b/jstests/replsets/clean_shutdown_oplog_state.js
index 45969b4c17b..153c2aa3a63 100644
--- a/jstests/replsets/clean_shutdown_oplog_state.js
+++ b/jstests/replsets/clean_shutdown_oplog_state.js
@@ -31,6 +31,9 @@ rst.initiate(conf);
var primary = rst.getPrimary(); // Waits for PRIMARY state.
var secondary = rst.nodes[1];
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
// Stop replication on the secondary.
stopServerReplication(secondary);
diff --git a/jstests/replsets/collate_id.js b/jstests/replsets/collate_id.js
index e51a0ffcb88..9b0d77843b1 100644
--- a/jstests/replsets/collate_id.js
+++ b/jstests/replsets/collate_id.js
@@ -32,6 +32,10 @@ var secondary = replTest.getSecondary();
var secondaryDB = secondary.getDB("test");
var secondaryColl = secondaryDB.collate_id;
+// The default WC is majority and rsSyncApplyStop failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
// Stop the secondary from syncing. This will ensure that the writes on the primary get applied
// on the secondary in a large batch.
assert.commandWorked(
diff --git a/jstests/replsets/collection_clone_resume_after_network_error.js b/jstests/replsets/collection_clone_resume_after_network_error.js
index 3ce47ef8b1f..0544cce129d 100644
--- a/jstests/replsets/collection_clone_resume_after_network_error.js
+++ b/jstests/replsets/collection_clone_resume_after_network_error.js
@@ -44,6 +44,11 @@ rst.initiate();
const primary = rst.getPrimary();
const primaryDb = primary.getDB("test");
+
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Add some data to be cloned.
assert.commandWorked(primaryDb.test.insert([
/* first network error here */
diff --git a/jstests/replsets/commit_transaction_recovery.js b/jstests/replsets/commit_transaction_recovery.js
index cdd2c49a830..c3ccae74baf 100644
--- a/jstests/replsets/commit_transaction_recovery.js
+++ b/jstests/replsets/commit_transaction_recovery.js
@@ -15,6 +15,10 @@ replTest.startSet();
replTest.initiate();
let primary = replTest.getPrimary();
+// The default WC is majority and disableSnapshotting failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
const dbName = "test";
const collName = "commit_transaction_recovery";
diff --git a/jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js b/jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js
index 25d6bb767ee..0375a0ee05f 100644
--- a/jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js
+++ b/jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js
@@ -25,6 +25,11 @@ config.settings = {
};
rst.initiate(config);
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(rst.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+rst.awaitReplication();
+
const nodeA = rst.nodes[0];
const nodeB = rst.nodes[1];
const nodeC = rst.nodes[2];
diff --git a/jstests/replsets/dont_read_oplog_hole_on_step_up.js b/jstests/replsets/dont_read_oplog_hole_on_step_up.js
index eff887799a1..1c0130c0017 100644
--- a/jstests/replsets/dont_read_oplog_hole_on_step_up.js
+++ b/jstests/replsets/dont_read_oplog_hole_on_step_up.js
@@ -29,6 +29,10 @@ const nodes = rst.startSet();
// take so much time that the second cannot succeed.
rst.initiate();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(rst.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const oldPrimary = nodes[0];
const newPrimary = nodes[1];
const secondary = rst.add({rsConfig: {priority: 0}});
diff --git a/jstests/replsets/drain.js b/jstests/replsets/drain.js
index e65a0b1baae..315a16f1c56 100644
--- a/jstests/replsets/drain.js
+++ b/jstests/replsets/drain.js
@@ -28,6 +28,11 @@ replSet.initiate({
var primary = replSet.getPrimary();
var secondary = replSet.getSecondary();
+// The default WC is majority and rsSyncApplyStop failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Do an initial insert to prevent the secondary from going into recovery
var numDocuments = 20;
var bulk = primary.getDB("foo").foo.initializeUnorderedBulkOp();
diff --git a/jstests/replsets/drop_databases_two_phase.js b/jstests/replsets/drop_databases_two_phase.js
index 156fd78a927..c3cb8ead592 100644
--- a/jstests/replsets/drop_databases_two_phase.js
+++ b/jstests/replsets/drop_databases_two_phase.js
@@ -56,6 +56,9 @@ replTest.awaitReplication();
var primary = replTest.getPrimary();
var secondary = replTest.getSecondary();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
var dbToDrop = primary.getDB(dbNameToDrop);
var collNameToDrop = "collectionToDrop";
diff --git a/jstests/replsets/force_reconfig_skips_oplog_commitment.js b/jstests/replsets/force_reconfig_skips_oplog_commitment.js
index 518fbba41ad..15d82d42a15 100644
--- a/jstests/replsets/force_reconfig_skips_oplog_commitment.js
+++ b/jstests/replsets/force_reconfig_skips_oplog_commitment.js
@@ -19,6 +19,9 @@ rst.initiate();
const primary = rst.getPrimary();
const secondary = rst.getSecondary();
const coll = primary.getDB(dbName)[collName];
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
// This makes the test run faster.
assert.commandWorked(secondary.adminCommand(
diff --git a/jstests/replsets/fsync_lock_read_secondaries.js b/jstests/replsets/fsync_lock_read_secondaries.js
index c409b632f7b..f830c01306f 100644
--- a/jstests/replsets/fsync_lock_read_secondaries.js
+++ b/jstests/replsets/fsync_lock_read_secondaries.js
@@ -33,6 +33,10 @@ var nodes = replTest.startSet();
replTest.initiate();
var primary = replTest.getPrimary();
+// The default WC is majority and fsyncLock will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
var ret = primary.getDB("admin").fsyncLock();
if (!ret.ok) {
assert.commandFailedWithCode(ret, ErrorCodes.CommandNotSupported);
diff --git a/jstests/replsets/index_delete.js b/jstests/replsets/index_delete.js
index cd45ef84089..314cd439024 100644
--- a/jstests/replsets/index_delete.js
+++ b/jstests/replsets/index_delete.js
@@ -37,6 +37,10 @@ var secondDB = second.getDB(dbName);
var size = 100;
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Make sure that the index build does not terminate on the secondary.
assert.commandWorked(
secondDB.adminCommand({configureFailPoint: 'hangAfterStartingIndexBuild', mode: 'alwaysOn'}));
diff --git a/jstests/replsets/initial_sync_commit_prepared_transaction.js b/jstests/replsets/initial_sync_commit_prepared_transaction.js
index bf5cbc546e7..a9ce04f469d 100644
--- a/jstests/replsets/initial_sync_commit_prepared_transaction.js
+++ b/jstests/replsets/initial_sync_commit_prepared_transaction.js
@@ -29,6 +29,10 @@ replTest.initiate(config);
const primary = replTest.getPrimary();
let secondary = replTest.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const dbName = "test";
const collName = "initial_sync_commit_prepared_transaction";
const testDB = primary.getDB(dbName);
diff --git a/jstests/replsets/initial_sync_drop_collection.js b/jstests/replsets/initial_sync_drop_collection.js
index 4adfad01d18..9d82c45265f 100644
--- a/jstests/replsets/initial_sync_drop_collection.js
+++ b/jstests/replsets/initial_sync_drop_collection.js
@@ -27,6 +27,10 @@ var primaryColl = primaryDB[collName];
var secondaryColl = secondaryDB[collName];
var nss = primaryColl.getFullName();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// This function adds data to the collection, restarts the secondary node with the given
// parameters and setting the given failpoint, waits for the failpoint to be hit,
// drops the collection, then disables the failpoint. It then optionally waits for the
diff --git a/jstests/replsets/initial_sync_during_stepdown.js b/jstests/replsets/initial_sync_during_stepdown.js
index d09060d492d..342d57d141d 100644
--- a/jstests/replsets/initial_sync_during_stepdown.js
+++ b/jstests/replsets/initial_sync_during_stepdown.js
@@ -27,6 +27,10 @@ var secondaryColl = secondaryDB[collName];
var dbNss = primaryDB.getName();
var collNss = primaryColl.getFullName();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
function setupTest({
failPoint,
nss: nss = '',
diff --git a/jstests/replsets/initial_sync_fails_when_source_removed.js b/jstests/replsets/initial_sync_fails_when_source_removed.js
index a171f92723b..8eb2221c771 100644
--- a/jstests/replsets/initial_sync_fails_when_source_removed.js
+++ b/jstests/replsets/initial_sync_fails_when_source_removed.js
@@ -17,6 +17,10 @@ const primary = rst.getPrimary();
const primaryDb = primary.getDB("test");
const initialSyncSource = rst.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Add some data to be cloned.
assert.commandWorked(primaryDb.test.insert([{a: 1}, {b: 2}, {c: 3}]));
rst.awaitReplication();
diff --git a/jstests/replsets/initial_sync_fails_when_source_resyncs.js b/jstests/replsets/initial_sync_fails_when_source_resyncs.js
index b74f328979e..c8646637e32 100644
--- a/jstests/replsets/initial_sync_fails_when_source_resyncs.js
+++ b/jstests/replsets/initial_sync_fails_when_source_resyncs.js
@@ -17,6 +17,10 @@ const primary = rst.getPrimary();
const primaryDb = primary.getDB("test");
let initialSyncSource = rst.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Add some data to be cloned.
assert.commandWorked(primaryDb.test.insert([{a: 1}, {b: 2}, {c: 3}]));
rst.awaitReplication();
diff --git a/jstests/replsets/initial_sync_fcv.js b/jstests/replsets/initial_sync_fcv.js
index 015de237d98..29bea77d145 100644
--- a/jstests/replsets/initial_sync_fcv.js
+++ b/jstests/replsets/initial_sync_fcv.js
@@ -25,6 +25,9 @@ rst.initiate(replSetConfig);
const primary = rst.getPrimary();
const dbName = 'foo';
const collName = 'bar';
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
assert.commandWorked(primary.getDB(dbName).getCollection(collName).insert({a: 1}));
diff --git a/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp.js b/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp.js
index c0823cb0f12..597e1cefc4b 100644
--- a/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp.js
+++ b/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp.js
@@ -36,6 +36,10 @@ replTest.initiate(config);
const primary = replTest.getPrimary();
let secondary = replTest.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const dbName = "test";
const collName = "initial_sync_fetch_from_oldest_active_transaction_timestamp";
let testDB = primary.getDB(dbName);
diff --git a/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js b/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js
index ea5e521a5f5..176309bfa86 100644
--- a/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js
+++ b/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js
@@ -32,6 +32,10 @@ replTest.initiate();
const primary = replTest.getPrimary();
let secondary = replTest.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const dbName = "test";
const collName = "initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application";
const testDB = primary.getDB(dbName);
diff --git a/jstests/replsets/initial_sync_oplog_hole.js b/jstests/replsets/initial_sync_oplog_hole.js
index 0cc6a1811b4..44d666f7a3a 100644
--- a/jstests/replsets/initial_sync_oplog_hole.js
+++ b/jstests/replsets/initial_sync_oplog_hole.js
@@ -32,6 +32,10 @@ const nss = primaryColl.getFullName();
TestData.testName = testName;
TestData.collectionName = collName;
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
jsTestLog("Writing data before oplog hole to collection.");
assert.commandWorked(primaryColl.insert({_id: "a"}));
// Make sure it gets written out.
diff --git a/jstests/replsets/initial_sync_rename_collection.js b/jstests/replsets/initial_sync_rename_collection.js
index d571e83c869..d77f8e87808 100644
--- a/jstests/replsets/initial_sync_rename_collection.js
+++ b/jstests/replsets/initial_sync_rename_collection.js
@@ -24,6 +24,10 @@ const primaryDB = primary.getDB(dbName);
const primaryColl = primaryDB[collName];
const pRenameColl = primaryDB["r_" + collName];
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Used for cross-DB renames.
const secondDbName = testName + "_cross";
const primarySecondDB = primary.getDB(secondDbName);
diff --git a/jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js b/jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js
index 8a0c58acbc1..e8d50b343e1 100644
--- a/jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js
+++ b/jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js
@@ -37,6 +37,11 @@ assert.commandWorked(testColl.insert({_id: 1}));
const session = primary.startSession();
const sessionDB = session.getDatabase(dbName);
const sessionColl = sessionDB.getCollection(collName);
+
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
session.startTransaction();
assert.commandWorked(sessionColl.insert({_id: 2}));
diff --git a/jstests/replsets/initial_sync_survives_network_error.js b/jstests/replsets/initial_sync_survives_network_error.js
index 6d2b5575abb..ce21f9b05f9 100644
--- a/jstests/replsets/initial_sync_survives_network_error.js
+++ b/jstests/replsets/initial_sync_survives_network_error.js
@@ -14,6 +14,10 @@ rst.initiate();
const primary = rst.getPrimary();
const primaryDb = primary.getDB("test");
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Add some data to be cloned.
assert.commandWorked(primaryDb.test.insert([{a: 1}, {b: 2}, {c: 3}]));
diff --git a/jstests/replsets/initial_sync_survives_restart.js b/jstests/replsets/initial_sync_survives_restart.js
index 625453f08a4..fe461321e41 100644
--- a/jstests/replsets/initial_sync_survives_restart.js
+++ b/jstests/replsets/initial_sync_survives_restart.js
@@ -16,6 +16,11 @@ rst.initiate();
const primary = rst.getPrimary();
const primaryDb = primary.getDB("test");
+
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Add some data to be cloned.
assert.commandWorked(primaryDb.test.insert([{a: 1}, {b: 2}, {c: 3}]));
diff --git a/jstests/replsets/initial_sync_uuid_not_found.js b/jstests/replsets/initial_sync_uuid_not_found.js
index 2e2911ee6dd..33d7f3dd071 100644
--- a/jstests/replsets/initial_sync_uuid_not_found.js
+++ b/jstests/replsets/initial_sync_uuid_not_found.js
@@ -21,6 +21,10 @@ const primary = rst.getPrimary();
const primaryDB = primary.getDB('d');
const primaryColl = primaryDB.coll;
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
jsTestLog('Create a collection (with a UUID) and insert a document.');
assert.commandWorked(primaryColl.insert({_id: 0}));
diff --git a/jstests/replsets/interrupted_batch_insert.js b/jstests/replsets/interrupted_batch_insert.js
index f51cb135e9e..a1a17050a17 100644
--- a/jstests/replsets/interrupted_batch_insert.js
+++ b/jstests/replsets/interrupted_batch_insert.js
@@ -32,6 +32,10 @@ replTest.initiate({
replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY);
var primary = replTest.nodes[0];
var collName = primary.getDB("db")[name].getFullName();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
var getParameterResult =
primary.getDB("admin").runCommand({getParameter: 1, internalInsertMaxBatchSize: 1});
diff --git a/jstests/replsets/libs/prepare_standalone_replication_recovery.js b/jstests/replsets/libs/prepare_standalone_replication_recovery.js
index bb2972dc9aa..20cb109668e 100644
--- a/jstests/replsets/libs/prepare_standalone_replication_recovery.js
+++ b/jstests/replsets/libs/prepare_standalone_replication_recovery.js
@@ -46,6 +46,10 @@ var testPrepareRecoverFromOplogAsStandalone = function(name, commitBeforeRecover
assert.eq(rst.getPrimary(), node);
+ // The default WC is majority and stopServerReplication will prevent satisfying any majority
+ // writes.
+ assert.commandWorked(node.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
// Create both collections with {w: majority}.
assert.commandWorked(node.getDB(dbName).runCommand({
create: nonTxnCollName,
diff --git a/jstests/replsets/libs/rollback_test.js b/jstests/replsets/libs/rollback_test.js
index 227947cea1a..3b5878aba50 100644
--- a/jstests/replsets/libs/rollback_test.js
+++ b/jstests/replsets/libs/rollback_test.js
@@ -128,6 +128,10 @@ function RollbackTest(name = "RollbackTest", replSet) {
// Make sure we have a primary.
curPrimary = replSet.getPrimary();
+ // The default WC is majority and we must use w:1 to be able to properly test rollback.
+ assert.commandWorked(curPrimary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+ replSet.awaitReplication();
// Extract the other two nodes and wait for them to be ready.
let secondaries = replSet.getSecondaries();
diff --git a/jstests/replsets/libs/rollback_test_deluxe.js b/jstests/replsets/libs/rollback_test_deluxe.js
index aae00d549e3..29f1749b473 100644
--- a/jstests/replsets/libs/rollback_test_deluxe.js
+++ b/jstests/replsets/libs/rollback_test_deluxe.js
@@ -188,6 +188,10 @@ function RollbackTestDeluxe(name = "FiveNodeDoubleRollbackTest", replSet) {
// Make sure we have a primary.
curPrimary = replSet.getPrimary();
+ // The default WC is majority and we must use w:1 to be able to properly test rollback.
+ assert.commandWorked(curPrimary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+ replSet.awaitReplication();
// Extract the other nodes and wait for them to be ready.
arbiters = replSet.getArbiters();
arbiters.forEach(arbiter => waitForState(arbiter, ReplSetTest.State.ARBITER));
diff --git a/jstests/replsets/libs/tenant_migration_recipient_sync_source.js b/jstests/replsets/libs/tenant_migration_recipient_sync_source.js
index 13656e4bf3b..488b8fce70d 100644
--- a/jstests/replsets/libs/tenant_migration_recipient_sync_source.js
+++ b/jstests/replsets/libs/tenant_migration_recipient_sync_source.js
@@ -48,6 +48,11 @@ const setUpMigrationSyncSourceTest = function() {
const donorPrimary = tenantMigrationTest.getDonorPrimary();
const delayedSecondary = donorRst.getSecondaries()[0];
const donorSecondary = donorRst.getSecondaries()[1];
+ // The default WC is majority and stopServerReplication will prevent satisfying any majority
+ // writes.
+ assert.commandWorked(donorPrimary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+ donorRst.awaitReplication();
const recipientRst = tenantMigrationTest.getRecipientRst();
const recipientPrimary = tenantMigrationTest.getRecipientPrimary();
diff --git a/jstests/replsets/libs/two_phase_drops.js b/jstests/replsets/libs/two_phase_drops.js
index aa8ec6eb570..d81f0043322 100644
--- a/jstests/replsets/libs/two_phase_drops.js
+++ b/jstests/replsets/libs/two_phase_drops.js
@@ -125,6 +125,11 @@ class TwoPhaseDropCollectionTest {
// Initiate the replica set.
this.replTest.startSet();
this.replTest.initiate();
+
+ // The default WC is majority and rsSyncApplyStop failpoint will prevent satisfying any
+ // majority writes.
+ assert.commandWorked(this.replTest.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
this.replTest.awaitReplication();
return this.replTest;
diff --git a/jstests/replsets/linearizable_read_concern.js b/jstests/replsets/linearizable_read_concern.js
index 80821a2507e..4ea116bf40b 100644
--- a/jstests/replsets/linearizable_read_concern.js
+++ b/jstests/replsets/linearizable_read_concern.js
@@ -44,13 +44,17 @@ config.settings = {
replTest.startSet();
replTest.initiate(config);
+var primary = replTest.getPrimary();
+var secondaries = replTest.getSecondaries();
+
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Without a sync source the heartbeat interval will be half of the election timeout, 30
// seconds. It thus will take almost 30 seconds for the secondaries to set the primary as
// their sync source and begin replicating.
replTest.awaitReplication();
-var primary = replTest.getPrimary();
-var secondaries = replTest.getSecondaries();
-
// Do a write to have something to read.
assert.commandWorked(primary.getDB("test").foo.insert(
{"number": 7}, {"writeConcern": {"w": "majority", "wtimeout": ReplSetTest.kDefaultTimeoutMS}}));
diff --git a/jstests/replsets/log_secondary_oplog_application.js b/jstests/replsets/log_secondary_oplog_application.js
index d8abf235900..2e1c522be4d 100644
--- a/jstests/replsets/log_secondary_oplog_application.js
+++ b/jstests/replsets/log_secondary_oplog_application.js
@@ -24,6 +24,10 @@ rst.initiate({
let primary = rst.getPrimary();
let secondary = rst.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
/**
* Part 1: Issue a fast op and make sure that we do *not* log it.
* We ensure the op is always considered fast by vastly increasing the "slowMS" threshold.
diff --git a/jstests/replsets/maintenance_non-blocking.js b/jstests/replsets/maintenance_non-blocking.js
index 15fe20ce4b0..19887ae55f6 100644
--- a/jstests/replsets/maintenance_non-blocking.js
+++ b/jstests/replsets/maintenance_non-blocking.js
@@ -11,6 +11,10 @@ doTest = function() {
var sDB = s.getDB("test");
var sColl = sDB.maint;
+ // The default WC is majority and fsyncLock will prevent satisfying any majority writes.
+ assert.commandWorked(replTest.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
var status = assert.commandWorked(sDB.adminCommand("replSetGetStatus"));
printjson(status);
diff --git a/jstests/replsets/maxSyncSourceLagSecs.js b/jstests/replsets/maxSyncSourceLagSecs.js
index 6630b5d3072..d65b629f76f 100644
--- a/jstests/replsets/maxSyncSourceLagSecs.js
+++ b/jstests/replsets/maxSyncSourceLagSecs.js
@@ -20,9 +20,16 @@ var nodes = replTest.nodeList();
replTest.startSet();
replTest.initiate();
replTest.awaitNodesAgreeOnPrimary();
-
var primary = replTest.getPrimary();
var secondaries = replTest.getSecondaries();
+
+// The default WC is majority and stopServerReplication could prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
+replTest.awaitReplication();
+
syncFrom(secondaries[0], primary, replTest);
syncFrom(secondaries[1], primary, replTest);
primary.getDB("foo").bar.save({a: 1});
diff --git a/jstests/replsets/new_sync_source_in_quiesce_mode.js b/jstests/replsets/new_sync_source_in_quiesce_mode.js
index d05661d4bf0..fb2c583884c 100644
--- a/jstests/replsets/new_sync_source_in_quiesce_mode.js
+++ b/jstests/replsets/new_sync_source_in_quiesce_mode.js
@@ -33,6 +33,10 @@ assert.commandWorked(syncSource.adminCommand({
rst.initiateWithHighElectionTimeout();
const primary = rst.getPrimary();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+rst.awaitReplication();
// Stop replication on the syncingNode so that the primary and syncSource will both
// definitely be ahead of it.
diff --git a/jstests/replsets/no_chaining.js b/jstests/replsets/no_chaining.js
index 7f8f8fb2087..fe5998395a0 100644
--- a/jstests/replsets/no_chaining.js
+++ b/jstests/replsets/no_chaining.js
@@ -18,6 +18,11 @@ replTest.initiate({
});
var primary = replTest.getPrimary();
+// The default WC is majority and stopServerReplication could prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
replTest.awaitReplication();
var breakNetwork = function() {
diff --git a/jstests/replsets/no_progress_updates_during_initial_sync.js b/jstests/replsets/no_progress_updates_during_initial_sync.js
index 4f2a13113d8..ae9b3557554 100644
--- a/jstests/replsets/no_progress_updates_during_initial_sync.js
+++ b/jstests/replsets/no_progress_updates_during_initial_sync.js
@@ -20,6 +20,10 @@ rst.initiate();
const primary = rst.getPrimary();
const primaryDb = primary.getDB("test");
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
assert.commandWorked(primaryDb.test.insert({"starting": "doc"}, {writeConcern: {w: 2}}));
jsTestLog("Adding a new node to the replica set");
diff --git a/jstests/replsets/node_restarts_no_oplog_entry_at_stable.js b/jstests/replsets/node_restarts_no_oplog_entry_at_stable.js
index ec1ca49df7f..c8cdded6ea1 100644
--- a/jstests/replsets/node_restarts_no_oplog_entry_at_stable.js
+++ b/jstests/replsets/node_restarts_no_oplog_entry_at_stable.js
@@ -24,6 +24,10 @@ const primaryColl = primaryDB[collName];
const nss = primaryColl.getFullName();
TestData.collectionName = collName;
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Turn on checkpoint logging.
assert.commandWorked(primary.adminCommand(
{"setParameter": 1, "logComponentVerbosity": {"storage": {"recovery": 2, "verbosity": 1}}}));
diff --git a/jstests/replsets/nodes_eventually_sync_from_closer_data_center.js b/jstests/replsets/nodes_eventually_sync_from_closer_data_center.js
index c972f1aa3b3..af9a5d5364b 100644
--- a/jstests/replsets/nodes_eventually_sync_from_closer_data_center.js
+++ b/jstests/replsets/nodes_eventually_sync_from_closer_data_center.js
@@ -36,12 +36,16 @@ const rst = new ReplSetTest({
rst.startSet();
rst.initiateWithHighElectionTimeout();
-rst.awaitReplication();
const primary = rst.getPrimary();
const centralSecondary = rst.getSecondaries()[0];
const testNode = rst.getSecondaries()[1];
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+rst.awaitReplication();
+
const primaryDB = primary.getDB(name);
const primaryColl = primaryDB["testColl"];
diff --git a/jstests/replsets/nodes_in_primarys_datacenter_dont_sync_across_datacenters.js b/jstests/replsets/nodes_in_primarys_datacenter_dont_sync_across_datacenters.js
index 798ada00a72..e9a0e1a7f15 100644
--- a/jstests/replsets/nodes_in_primarys_datacenter_dont_sync_across_datacenters.js
+++ b/jstests/replsets/nodes_in_primarys_datacenter_dont_sync_across_datacenters.js
@@ -36,12 +36,16 @@ const rst = new ReplSetTest({
rst.startSet();
rst.initiateWithHighElectionTimeout();
-rst.awaitReplication();
const primary = rst.getPrimary();
const testNode = rst.getSecondaries()[0];
const secondary = rst.getSecondaries()[1];
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+rst.awaitReplication();
+
const primaryDB = primary.getDB(name);
const primaryColl = primaryDB["testColl"];
diff --git a/jstests/replsets/noop_writes_wait_for_write_concern_fcv.js b/jstests/replsets/noop_writes_wait_for_write_concern_fcv.js
index 875e09acc13..4a5266ee657 100644
--- a/jstests/replsets/noop_writes_wait_for_write_concern_fcv.js
+++ b/jstests/replsets/noop_writes_wait_for_write_concern_fcv.js
@@ -24,6 +24,9 @@ function testFCVNoop(targetVersion) {
const primary = replTest.getPrimary();
assert.eq(primary, replTest.nodes[0]);
+ // The default WC is majority and this test can't satisfy majority writes.
+ assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
// Set the FCV to the given target version, to ensure calling setFCV below is a no-op.
assert.commandWorkedIgnoringWriteConcernErrors(
diff --git a/jstests/replsets/prepare_prepared_transaction_wc_timeout.js b/jstests/replsets/prepare_prepared_transaction_wc_timeout.js
index 44e69d4f71e..65276544311 100644
--- a/jstests/replsets/prepare_prepared_transaction_wc_timeout.js
+++ b/jstests/replsets/prepare_prepared_transaction_wc_timeout.js
@@ -25,6 +25,10 @@ const secConn = replTest.getSecondary();
const lsid = UUID();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(priConn.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Insert something into the user collection.
runWriteConcernRetryabilityTest(priConn,
secConn,
diff --git a/jstests/replsets/prepare_transaction_index_build.js b/jstests/replsets/prepare_transaction_index_build.js
index 983bd33989a..345f79ac61d 100644
--- a/jstests/replsets/prepare_transaction_index_build.js
+++ b/jstests/replsets/prepare_transaction_index_build.js
@@ -21,6 +21,10 @@ replTest.initiate();
const primary = replTest.getPrimary();
const secondary = replTest.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const dbName = "test";
const collName = "prepared_transactions_index_build";
const testDB = primary.getDB(dbName);
diff --git a/jstests/replsets/read_committed.js b/jstests/replsets/read_committed.js
index 4678638b09c..1774ce9e9d9 100644
--- a/jstests/replsets/read_committed.js
+++ b/jstests/replsets/read_committed.js
@@ -77,6 +77,10 @@ var secondary = replTest.getSecondary();
var coll = primary.getDB(name)[name];
var secondaryColl = secondary.getDB(name)[name];
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
function log(arg) {
jsTest.log(tojson(arg));
}
diff --git a/jstests/replsets/read_committed_after_rollback.js b/jstests/replsets/read_committed_after_rollback.js
index 23a790c8a38..bca0bf2289b 100644
--- a/jstests/replsets/read_committed_after_rollback.js
+++ b/jstests/replsets/read_committed_after_rollback.js
@@ -50,6 +50,10 @@ replTest.initiate(config);
var oldPrimary = replTest.getPrimary();
var [newPrimary, pureSecondary, ...arbiters] = replTest.getSecondaries();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(oldPrimary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
// This is the collection that all of the tests will use.
var collName = name + '.collection';
var oldPrimaryColl = oldPrimary.getCollection(collName);
diff --git a/jstests/replsets/read_committed_lookup.js b/jstests/replsets/read_committed_lookup.js
index ab3c8ed67a0..bd931bc54ab 100644
--- a/jstests/replsets/read_committed_lookup.js
+++ b/jstests/replsets/read_committed_lookup.js
@@ -35,9 +35,20 @@ const config = {
rst.initiate(config);
+let st = new ShardingTest({
+ manualAddShard: true,
+});
+assert.commandWorked(st.s.adminCommand({addShard: rst.getURL()}));
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+// We can't run this command on a shard server (configured with --shardsvr) which is why we must run
+// it on mongos.
+assert.commandWorked(st.s.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
let shardSecondary = rst.getSecondary();
testReadCommittedLookup(rst.getPrimary().getDB("test"), shardSecondary, rst);
+st.stop();
rst.stopSet();
})();
diff --git a/jstests/replsets/read_committed_on_secondary.js b/jstests/replsets/read_committed_on_secondary.js
index 6629b162172..da29020b101 100644
--- a/jstests/replsets/read_committed_on_secondary.js
+++ b/jstests/replsets/read_committed_on_secondary.js
@@ -92,6 +92,11 @@ function doCommittedRead(lastOp) {
return new DBCommandCursor(dbSecondary, res).toArray()[0].state;
}
+// The default WC is majority and disableSnapshotting failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
// Do a write, wait for it to replicate, and ensure it is visible.
var op0 = saveDoc(0);
assert.eq(doDirtyRead(op0), 0);
diff --git a/jstests/replsets/read_committed_stale_history.js b/jstests/replsets/read_committed_stale_history.js
index afd78695e01..28f2bd3feea 100644
--- a/jstests/replsets/read_committed_stale_history.js
+++ b/jstests/replsets/read_committed_stale_history.js
@@ -52,6 +52,11 @@ function checkDocNotCommitted(node, doc) {
jsTestLog("Make sure node 0 is primary.");
var primary = rst.getPrimary();
var secondaries = rst.getSecondaries();
+
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+rst.awaitReplication();
assert.eq(nodes[0], primary);
// Wait for all data bearing nodes to get up to date.
assert.commandWorked(nodes[0].getDB(dbName).getCollection(collName).insert(
diff --git a/jstests/replsets/read_committed_with_catalog_changes.js b/jstests/replsets/read_committed_with_catalog_changes.js
index 9e1c349ff3c..a0053de2bfd 100644
--- a/jstests/replsets/read_committed_with_catalog_changes.js
+++ b/jstests/replsets/read_committed_with_catalog_changes.js
@@ -244,6 +244,10 @@ replTest.initiate(config);
var primary = replTest.getPrimary();
var secondary = replTest.getSecondary();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
// This is the DB that all of the tests will use.
var mainDB = primary.getDB('mainDB');
diff --git a/jstests/replsets/read_concern_majority_getmore_secondaries.js b/jstests/replsets/read_concern_majority_getmore_secondaries.js
index 6e73104ac6d..59414c6b4e2 100644
--- a/jstests/replsets/read_concern_majority_getmore_secondaries.js
+++ b/jstests/replsets/read_concern_majority_getmore_secondaries.js
@@ -24,6 +24,10 @@ const secondary = secondaries[0];
const primaryDB = primary.getDB(dbName);
const secondaryDB = secondary.getDB(dbName);
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Insert data on primary and allow it to become committed.
for (let i = 0; i < 4; i++) {
assert.commandWorked(primaryDB[collName].insert({_id: i}));
diff --git a/jstests/replsets/reconfig_only_counts_voting_nodes_for_oplog_commitment.js b/jstests/replsets/reconfig_only_counts_voting_nodes_for_oplog_commitment.js
index 5b028b0ae15..51ab53feeab 100644
--- a/jstests/replsets/reconfig_only_counts_voting_nodes_for_oplog_commitment.js
+++ b/jstests/replsets/reconfig_only_counts_voting_nodes_for_oplog_commitment.js
@@ -30,6 +30,10 @@ nodes.forEach(node => {
replTest.initiateWithHighElectionTimeout();
var primary = replTest.getPrimary();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
// Do a write that should not be able to replicate to node1 since we stopped replication.
stopServerReplication(nodes[1]);
assert.commandWorked(primary.getDB("test")["test"].insert({x: 1}));
diff --git a/jstests/replsets/reconfig_waits_for_oplog_commitment_condition.js b/jstests/replsets/reconfig_waits_for_oplog_commitment_condition.js
index 7427873d0f1..1963f20f6cf 100644
--- a/jstests/replsets/reconfig_waits_for_oplog_commitment_condition.js
+++ b/jstests/replsets/reconfig_waits_for_oplog_commitment_condition.js
@@ -19,6 +19,10 @@ const primary = rst.getPrimary();
const secondary = rst.getSecondary();
const coll = primary.getDB(dbName)[collName];
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// This makes the test run faster.
assert.commandWorked(secondary.adminCommand(
{configureFailPoint: 'setSmallOplogGetMoreMaxTimeMS', mode: 'alwaysOn'}));
diff --git a/jstests/replsets/reconfig_waits_for_oplog_commitment_condition_when_leaving_force.js b/jstests/replsets/reconfig_waits_for_oplog_commitment_condition_when_leaving_force.js
index 1880c4cdef6..32658b9fe58 100644
--- a/jstests/replsets/reconfig_waits_for_oplog_commitment_condition_when_leaving_force.js
+++ b/jstests/replsets/reconfig_waits_for_oplog_commitment_condition_when_leaving_force.js
@@ -19,6 +19,10 @@ const primary = rst.getPrimary();
const secondary = rst.getSecondary();
const coll = primary.getDB(dbName)[collName];
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// This makes the test run faster.
assert.commandWorked(secondary.adminCommand(
{configureFailPoint: 'setSmallOplogGetMoreMaxTimeMS', mode: 'alwaysOn'}));
diff --git a/jstests/replsets/reconstruct_prepared_transactions_initial_sync.js b/jstests/replsets/reconstruct_prepared_transactions_initial_sync.js
index 8c6dba0524e..99018d864c5 100644
--- a/jstests/replsets/reconstruct_prepared_transactions_initial_sync.js
+++ b/jstests/replsets/reconstruct_prepared_transactions_initial_sync.js
@@ -34,6 +34,10 @@ replTest.initiate(config);
const primary = replTest.getPrimary();
let secondary = replTest.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const dbName = "test";
const collName = "reconstruct_prepared_transactions_initial_sync";
let testDB = primary.getDB(dbName);
diff --git a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_change_oldest_active_txn_timestamp.js b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_change_oldest_active_txn_timestamp.js
index 6501d6afc9a..0cd745addc7 100644
--- a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_change_oldest_active_txn_timestamp.js
+++ b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_change_oldest_active_txn_timestamp.js
@@ -28,7 +28,10 @@ replTest.initiateWithHighElectionTimeout();
const primary = replTest.getPrimary();
let secondary = replTest.getSecondary();
-
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
const dbName = "test";
const collName = jsTestName();
const testDB = primary.getDB(dbName);
diff --git a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js
index 38f7f431ca2..35fafa71508 100644
--- a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js
+++ b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js
@@ -29,6 +29,9 @@ replTest.initiate(config);
const primary = replTest.getPrimary();
let secondary = replTest.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
const dbName = "test";
const collName = "reconstruct_prepared_transactions_initial_sync_index_build";
diff --git a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_on_oplog_seed.js b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_on_oplog_seed.js
index 832f9c76d17..7d87fe2a2b1 100644
--- a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_on_oplog_seed.js
+++ b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_on_oplog_seed.js
@@ -34,6 +34,10 @@ replTest.initiate(config);
const primary = replTest.getPrimary();
let secondary = replTest.getSecondary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const dbName = "test";
const collName = "reconstruct_prepared_transactions_initial_sync_on_oplog_seed";
diff --git a/jstests/replsets/recover_multiple_prepared_transactions_startup.js b/jstests/replsets/recover_multiple_prepared_transactions_startup.js
index 7c943b11c4d..51096bb79f3 100644
--- a/jstests/replsets/recover_multiple_prepared_transactions_startup.js
+++ b/jstests/replsets/recover_multiple_prepared_transactions_startup.js
@@ -14,6 +14,10 @@ replTest.startSet();
replTest.initiate();
let primary = replTest.getPrimary();
+// The default WC is majority and disableSnapshotting failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
const dbName = "test";
const collName = "recover_multiple_prepared_transactions_startup";
diff --git a/jstests/replsets/recover_prepared_transactions_startup_secondary_application.js b/jstests/replsets/recover_prepared_transactions_startup_secondary_application.js
index 56f40a8793f..914bbcf324e 100644
--- a/jstests/replsets/recover_prepared_transactions_startup_secondary_application.js
+++ b/jstests/replsets/recover_prepared_transactions_startup_secondary_application.js
@@ -19,6 +19,10 @@ replTest.initiateWithHighElectionTimeout();
const primary = replTest.getPrimary();
let secondary = replTest.getSecondary();
+// The default WC is majority and disableSnapshotting failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
const dbName = "test";
const collName = "recover_prepared_transactions_startup_secondary_application";
diff --git a/jstests/replsets/recovery_after_clean_shutdown_but_not_all_writes_in_snapshot.js b/jstests/replsets/recovery_after_clean_shutdown_but_not_all_writes_in_snapshot.js
index 77700523439..3e73080e098 100644
--- a/jstests/replsets/recovery_after_clean_shutdown_but_not_all_writes_in_snapshot.js
+++ b/jstests/replsets/recovery_after_clean_shutdown_but_not_all_writes_in_snapshot.js
@@ -17,6 +17,11 @@ rst.initiate();
const dbName = "recovery_clean_shutdown";
let primaryDB = rst.getPrimary().getDB(dbName);
+// The default WC is majority and disableSnapshotting failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primaryDB.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const wMajority = {
writeConcern: {w: "majority", wtimeout: ReplSetTest.kDefaultTimeoutMS}
};
diff --git a/jstests/replsets/replSetGetStatus_new_term_oplog_entry_fields.js b/jstests/replsets/replSetGetStatus_new_term_oplog_entry_fields.js
index fbe09eeeec2..a4f0abb777a 100644
--- a/jstests/replsets/replSetGetStatus_new_term_oplog_entry_fields.js
+++ b/jstests/replsets/replSetGetStatus_new_term_oplog_entry_fields.js
@@ -15,6 +15,10 @@ rst.startSet();
rst.initiateWithHighElectionTimeout();
rst.awaitReplication();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(rst.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+rst.awaitReplication();
stopServerReplication(rst.nodes);
// Step up one of the secondaries.
diff --git a/jstests/replsets/resync_majority_member.js b/jstests/replsets/resync_majority_member.js
index 0047c49cf01..5cbf2e5809f 100644
--- a/jstests/replsets/resync_majority_member.js
+++ b/jstests/replsets/resync_majority_member.js
@@ -35,6 +35,10 @@ rst.initiateWithHighElectionTimeout();
const primary = rst.getPrimary();
const primaryDb = primary.getDB(dbName);
const primaryColl = primaryDb.getCollection(collName);
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+rst.awaitReplication();
assert.commandWorked(primaryColl.insert({"starting": "doc", writeConcern: {w: 3}}));
/**
diff --git a/jstests/replsets/rollback_ddl_op_sequences.js b/jstests/replsets/rollback_ddl_op_sequences.js
index 0c5c2f27fad..6e88e014957 100644
--- a/jstests/replsets/rollback_ddl_op_sequences.js
+++ b/jstests/replsets/rollback_ddl_op_sequences.js
@@ -53,6 +53,12 @@ replTest.initiate({
// Make sure we have a primary and that that primary is node A
replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY);
var primary = replTest.getPrimary();
+
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
+
var a_conn = conns[0];
a_conn.setSecondaryOk();
var A = a_conn.getDB("admin");
diff --git a/jstests/replsets/rollback_transaction_table.js b/jstests/replsets/rollback_transaction_table.js
index cf3b8bd98f3..e0ac44bca41 100644
--- a/jstests/replsets/rollback_transaction_table.js
+++ b/jstests/replsets/rollback_transaction_table.js
@@ -73,6 +73,10 @@ let replTest = new ReplSetTest({
let nodes = replTest.startSet();
replTest.initiate();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(replTest.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replTest.awaitReplication();
let downstream = nodes[0];
let upstream = nodes[1];
let arbiter = nodes[2];
diff --git a/jstests/replsets/rollback_views.js b/jstests/replsets/rollback_views.js
index 04dbf99fcce..3a030b7e916 100644
--- a/jstests/replsets/rollback_views.js
+++ b/jstests/replsets/rollback_views.js
@@ -64,6 +64,10 @@ let nodeA = conns[0];
let nodeB = conns[1];
let arbiter = conns[2];
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(nodeA.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
let a1 = nodeA.getDB("test1");
let b1 = nodeB.getDB("test1");
diff --git a/jstests/replsets/secondarydelaysecs_sync_source.js b/jstests/replsets/secondarydelaysecs_sync_source.js
index 10f1f77beaa..e2b7de6a3bf 100644
--- a/jstests/replsets/secondarydelaysecs_sync_source.js
+++ b/jstests/replsets/secondarydelaysecs_sync_source.js
@@ -21,6 +21,12 @@ config.members[2].priority = 0;
replTest.initiate(config);
var primary = replTest.getPrimary().getDB(jsTestName());
+// The default WC is majority and stopServerReplication could prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
+replTest.awaitReplication();
var secondaryConns = replTest.getSecondaries();
var secondaries = [];
diff --git a/jstests/replsets/secondarydelaysecs_waits_for_writes.js b/jstests/replsets/secondarydelaysecs_waits_for_writes.js
index 901d70b17b5..a98a719056d 100644
--- a/jstests/replsets/secondarydelaysecs_waits_for_writes.js
+++ b/jstests/replsets/secondarydelaysecs_waits_for_writes.js
@@ -29,6 +29,12 @@ doTest = function(signal) {
replTest.initiate(config);
var primary = replTest.getPrimary().getDB(name);
+
+ // The default WC is majority and this test can't satisfy majority writes.
+ assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+ replTest.awaitReplication();
+
var secondaryConns = replTest.getSecondaries();
var secondaries = [];
for (var i in secondaryConns) {
diff --git a/jstests/replsets/server8070.js b/jstests/replsets/server8070.js
index 92546a56c0a..bf3047a6b96 100644
--- a/jstests/replsets/server8070.js
+++ b/jstests/replsets/server8070.js
@@ -41,6 +41,10 @@ replSet.nodes[2].setSecondaryOk();
var member2 = replSet.nodes[1].getDB("admin");
var member3 = replSet.nodes[2].getDB("admin");
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Do an initial write
primary.getDB("foo").bar.insert({x: 1});
replSet.awaitReplication();
diff --git a/jstests/replsets/server_status_metrics.js b/jstests/replsets/server_status_metrics.js
index 6f0806b0bf2..59f23c5f6b6 100644
--- a/jstests/replsets/server_status_metrics.js
+++ b/jstests/replsets/server_status_metrics.js
@@ -89,6 +89,10 @@ var secondary = rt.getSecondary();
var primary = rt.getPrimary();
var testDB = primary.getDB("test");
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Record the base oplogGetMoresProcessed on primary and the base oplog getmores on secondary.
const primaryBaseOplogGetMoresProcessedNum =
primary.getDB("test").serverStatus().metrics.repl.network.oplogGetMoresProcessed.num;
diff --git a/jstests/replsets/speculative_read_transaction.js b/jstests/replsets/speculative_read_transaction.js
index df2a4cdca93..b633af97ea5 100644
--- a/jstests/replsets/speculative_read_transaction.js
+++ b/jstests/replsets/speculative_read_transaction.js
@@ -19,6 +19,9 @@ const primary = rst.getPrimary();
const secondary = rst.getSecondary();
const testDB = primary.getDB(dbName);
const coll = testDB[collName];
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
function runTest(sessionOptions) {
testDB.runCommand({drop: collName, writeConcern: {w: "majority"}});
diff --git a/jstests/replsets/speculative_transaction.js b/jstests/replsets/speculative_transaction.js
index e138612dcd1..60cab2ac951 100644
--- a/jstests/replsets/speculative_transaction.js
+++ b/jstests/replsets/speculative_transaction.js
@@ -20,6 +20,9 @@ const primary = rst.getPrimary();
const secondary = rst.getSecondary();
var testDB = primary.getDB(dbName);
const coll = testDB[collName];
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
function runTest(sessionOptions) {
testDB.runCommand({drop: collName, writeConcern: {w: "majority"}});
diff --git a/jstests/replsets/standalone_replication_recovery_idempotent.js b/jstests/replsets/standalone_replication_recovery_idempotent.js
index d277fd79ea5..3ced688da2d 100644
--- a/jstests/replsets/standalone_replication_recovery_idempotent.js
+++ b/jstests/replsets/standalone_replication_recovery_idempotent.js
@@ -58,6 +58,10 @@ let secondary = nodes[1];
rst.initiate(
{_id: name, members: [{_id: 0, host: node.host}, {_id: 1, host: secondary.host, priority: 0}]});
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(rst.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Create two collections with w:majority and then perform a clean restart to ensure that
// the collections are in a stable checkpoint.
assert.commandWorked(getColl1(node).insert({_id: 3}, {writeConcern: {w: "majority"}}));
diff --git a/jstests/replsets/step_down_during_draining.js b/jstests/replsets/step_down_during_draining.js
index a52602ea3d7..7ca48244ee1 100644
--- a/jstests/replsets/step_down_during_draining.js
+++ b/jstests/replsets/step_down_during_draining.js
@@ -48,6 +48,11 @@ function disableFailPoint(node) {
assert.commandWorked(node.adminCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}));
}
+// The default WC is majority and rsSyncApplyStop failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Do an initial insert to prevent the secondary from going into recovery
var numDocuments = 20;
var coll = primary.getDB("foo").foo;
diff --git a/jstests/replsets/step_down_during_draining2.js b/jstests/replsets/step_down_during_draining2.js
index 0599357b1de..1f29da1280e 100644
--- a/jstests/replsets/step_down_during_draining2.js
+++ b/jstests/replsets/step_down_during_draining2.js
@@ -51,6 +51,11 @@ function disableFailPoint(node) {
assert.commandWorked(node.adminCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}));
}
+// The default WC is majority and rsSyncApplyStop failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Do an initial insert to prevent the secondary from going into recovery
var numDocuments = 20;
var coll = primary.getDB("foo").foo;
diff --git a/jstests/replsets/step_down_during_draining3.js b/jstests/replsets/step_down_during_draining3.js
index a52736cc5f1..4841c4e569a 100644
--- a/jstests/replsets/step_down_during_draining3.js
+++ b/jstests/replsets/step_down_during_draining3.js
@@ -40,6 +40,11 @@ function disableFailPoint(node) {
assert.commandWorked(node.adminCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}));
}
+// The default WC is majority and rsSyncApplyStop failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Do an initial insert to prevent the secondary from going into recovery
var numDocuments = 20;
var coll = primary.getDB("foo").foo;
diff --git a/jstests/replsets/stepdown.js b/jstests/replsets/stepdown.js
index 005a22c7e10..9ca3f520f50 100644
--- a/jstests/replsets/stepdown.js
+++ b/jstests/replsets/stepdown.js
@@ -26,6 +26,10 @@ replTest.initiate();
replTest.waitForState(nodes[0], ReplSetTest.State.PRIMARY);
var primary = replTest.getPrimary();
+// The default WC is majority and this test can't satisfy majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// do a write
print("\ndo a write");
assert.commandWorked(primary.getDB("foo").bar.insert({x: 1}));
diff --git a/jstests/replsets/stepdown_catch_up_opt.js b/jstests/replsets/stepdown_catch_up_opt.js
index 1e178f9ba6d..ffd103adc96 100644
--- a/jstests/replsets/stepdown_catch_up_opt.js
+++ b/jstests/replsets/stepdown_catch_up_opt.js
@@ -17,6 +17,10 @@ replTest.awaitSecondaryNodes();
var primary = replTest.getPrimary();
var secondary = replTest.getSecondary();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
// Error codes we expect to see.
// If the secondary is not caught up.
diff --git a/jstests/replsets/stepdown_killop.js b/jstests/replsets/stepdown_killop.js
index a280e13e6b9..aa4b889c93d 100644
--- a/jstests/replsets/stepdown_killop.js
+++ b/jstests/replsets/stepdown_killop.js
@@ -26,6 +26,10 @@ replSet.initiate({
});
replSet.waitForState(replSet.nodes[0], ReplSetTest.State.PRIMARY);
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(replSet.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+replSet.awaitReplication();
var secondary = replSet.getSecondary();
jsTestLog('Disable replication on the SECONDARY ' + secondary.host);
diff --git a/jstests/replsets/stepdown_long_wait_time.js b/jstests/replsets/stepdown_long_wait_time.js
index b2f8ed89483..6a390319bb6 100644
--- a/jstests/replsets/stepdown_long_wait_time.js
+++ b/jstests/replsets/stepdown_long_wait_time.js
@@ -26,6 +26,9 @@ replSet.initiate({
replSet.waitForState(replSet.nodes[0], ReplSetTest.State.PRIMARY);
var primary = replSet.getPrimary();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
var secondary = replSet.getSecondary();
jsTestLog('Disable replication on the SECONDARY ' + secondary.host);
diff --git a/jstests/replsets/stepup.js b/jstests/replsets/stepup.js
index 59c20e1715a..fcb334ea3f7 100644
--- a/jstests/replsets/stepup.js
+++ b/jstests/replsets/stepup.js
@@ -11,10 +11,12 @@ var rst = new ReplSetTest({name: name, nodes: 2});
rst.startSet();
rst.initiate();
-rst.awaitReplication();
var primary = rst.getPrimary();
var secondary = rst.getSecondary();
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
const initialSecondaryStatus = assert.commandWorked(secondary.adminCommand({serverStatus: 1}));
diff --git a/jstests/replsets/tenant_migration_cloning_uses_read_concern_majority.js b/jstests/replsets/tenant_migration_cloning_uses_read_concern_majority.js
index bbdece41e3a..06f86c06766 100644
--- a/jstests/replsets/tenant_migration_cloning_uses_read_concern_majority.js
+++ b/jstests/replsets/tenant_migration_cloning_uses_read_concern_majority.js
@@ -30,6 +30,11 @@ const recipientPrimary = tenantMigrationTest.getRecipientPrimary();
const donorRst = tenantMigrationTest.getDonorRst();
const donorTestColl = donorPrimary.getDB(dbName).getCollection(collName);
+// The default WC is majority and stopReplicationOnSecondaries will prevent satisfying any majority
+assert.commandWorked(recipientPrimary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+tenantMigrationTest.getRecipientRst().awaitReplication();
+
// Populate the donor replica set with some initial data and make sure it is majority committed.
const majorityCommittedDocs = [{_id: 0, x: 0}, {_id: 1, x: 1}];
assert.commandWorked(donorTestColl.insert(majorityCommittedDocs, {writeConcern: {w: "majority"}}));
diff --git a/jstests/replsets/tenant_migration_donor_rollback_recovery.js b/jstests/replsets/tenant_migration_donor_rollback_recovery.js
index c58d0f23d2d..8f5ddb5ff22 100644
--- a/jstests/replsets/tenant_migration_donor_rollback_recovery.js
+++ b/jstests/replsets/tenant_migration_donor_rollback_recovery.js
@@ -72,6 +72,11 @@ function testRollBack(setUpFunc, rollbackOpsFunc, steadyStateFunc) {
});
donorRst.startSet();
donorRst.initiate();
+ // The default WC is majority and stopServerReplication will prevent satisfying any majority
+ // writes.
+ assert.commandWorked(donorRst.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+ donorRst.awaitReplication();
const tenantMigrationTest =
new TenantMigrationTest({name: jsTestName(), donorRst, recipientRst});
diff --git a/jstests/replsets/tenant_migration_recipient_rollback_recovery.js b/jstests/replsets/tenant_migration_recipient_rollback_recovery.js
index 5f518bf84c9..c7f293df43c 100644
--- a/jstests/replsets/tenant_migration_recipient_rollback_recovery.js
+++ b/jstests/replsets/tenant_migration_recipient_rollback_recovery.js
@@ -81,6 +81,10 @@ function testRollBack(setUpFunc, rollbackOpsFunc, steadyStateFunc) {
let originalRecipientPrimary = recipientRst.getPrimary();
const originalRecipientSecondaries = recipientRst.getSecondaries();
+ // The default WC is majority and stopServerReplication will prevent satisfying any majority
+ // writes.
+ assert.commandWorked(originalRecipientPrimary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
recipientRst.awaitLastOpCommitted();
// Disable replication on the secondaries so that writes during this step will be rolled back.
diff --git a/jstests/replsets/transaction_table_oplog_replay.js b/jstests/replsets/transaction_table_oplog_replay.js
index eb155343127..43771ebb453 100644
--- a/jstests/replsets/transaction_table_oplog_replay.js
+++ b/jstests/replsets/transaction_table_oplog_replay.js
@@ -81,6 +81,10 @@ replTest.initiate();
let primary = replTest.getPrimary();
let secondary = replTest.getSecondary();
+// The default WC is majority and rsSyncApplyStop failpoint will prevent satisfying any majority
+// writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
////////////////////////////////////////////////////////////////////////
// Test insert command
diff --git a/jstests/replsets/update_commit_point_from_sync_source_ignores_term.js b/jstests/replsets/update_commit_point_from_sync_source_ignores_term.js
index 61a4c339fdf..37065be798a 100644
--- a/jstests/replsets/update_commit_point_from_sync_source_ignores_term.js
+++ b/jstests/replsets/update_commit_point_from_sync_source_ignores_term.js
@@ -23,6 +23,10 @@ config.settings = {
};
rst.initiate(config);
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(rst.getPrimary().adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+
const nodeA = rst.nodes[0];
const nodeB = rst.nodes[1];
const nodeC = rst.nodes[2];
diff --git a/jstests/replsets/write_concern_after_stepdown.js b/jstests/replsets/write_concern_after_stepdown.js
index ef08710356a..241806e12e6 100644
--- a/jstests/replsets/write_concern_after_stepdown.js
+++ b/jstests/replsets/write_concern_after_stepdown.js
@@ -37,6 +37,12 @@ jsTestLog("Make sure node 0 is primary.");
var primary = rst.getPrimary();
var secondaries = rst.getSecondaries();
assert.eq(nodes[0], primary);
+
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+rst.awaitReplication();
+
// Wait for all data bearing nodes to get up to date.
assert.commandWorked(nodes[0].getDB(dbName).getCollection(collName).insert(
{a: 1}, {writeConcern: {w: 3, wtimeout: rst.kDefaultTimeoutMS}}));
diff --git a/jstests/replsets/write_concern_after_stepdown_and_stepup.js b/jstests/replsets/write_concern_after_stepdown_and_stepup.js
index c4321d8e92b..73d11f2215d 100644
--- a/jstests/replsets/write_concern_after_stepdown_and_stepup.js
+++ b/jstests/replsets/write_concern_after_stepdown_and_stepup.js
@@ -45,6 +45,12 @@ stepUp(nodes[0]);
var primary = rst.getPrimary();
var secondaries = rst.getSecondaries();
assert.eq(nodes[0], primary);
+
+// The default WC is majority and stopServerReplication will prevent satisfying any majority writes.
+assert.commandWorked(primary.adminCommand(
+ {setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+rst.awaitReplication();
+
// Wait for all data bearing nodes to get up to date.
assert.commandWorked(nodes[0].getDB(dbName).getCollection(collName).insert(
{a: 1}, {writeConcern: {w: 3, wtimeout: rst.kDefaultTimeoutMS}}));