summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoustafa Maher <m.maher@10gen.com>2021-09-16 21:39:15 +0000
committerMoustafa Maher <m.maher@10gen.com>2021-09-16 23:11:59 +0000
commit0611b8afe4cf77899d9ca9a1fbda02498ce83ad3 (patch)
treeb20cf6b0fc42f77dac5141e47e01d9ebed9b6f41
parent0cdc28063bb607efd2cb732cc88471f6396abd48 (diff)
downloadmongo-0611b8afe4cf77899d9ca9a1fbda02498ce83ad3.tar.gz
Revert "SERVER-56844 Fassert shard server on startup if DWCF=w:1 and no CWWC set"
This reverts commit 29f2d199372149656d3cd1137bdcf7c582656371.
-rw-r--r--jstests/multiVersion/implicit_default_write_concern_upgrade_shards.js85
-rw-r--r--jstests/multiVersion/upgrade_default_write_concern_majority.js5
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp1
-rw-r--r--src/mongo/s/sharding_initialization.cpp2
4 files changed, 0 insertions, 93 deletions
diff --git a/jstests/multiVersion/implicit_default_write_concern_upgrade_shards.js b/jstests/multiVersion/implicit_default_write_concern_upgrade_shards.js
deleted file mode 100644
index 2b90b5b39f5..00000000000
--- a/jstests/multiVersion/implicit_default_write_concern_upgrade_shards.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Tests upgrading a shardsvr to 5.0 binary version will fail if the implicitDefaultWriteConcern is
- * w:1 and CWWC is not set.
- *
- */
-
-(function() {
-"use strict";
-
-load("jstests/multiVersion/libs/multi_cluster.js"); // For 'upgradeCluster()'
-
-// This test triggers an unclean shutdown, which may cause inaccurate fast counts.
-TestData.skipEnforceFastCountOnValidate = true;
-
-// Checks involve connecting to a shard node, that under certain circumstances would fassert.
-TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
-TestData.skipCheckingIndexesConsistentAcrossCluster = true;
-TestData.skipCheckOrphans = true;
-
-function testSharding(CWWCSet, isPSASet) {
- jsTestLog("Running sharding test with CWWCSet: " + tojson(CWWCSet) +
- ", isPSASet: " + tojson(isPSASet));
- let replSetNodes = [{binVersion: "last-lts"}, {binVersion: "last-lts"}];
- if (isPSASet) {
- replSetNodes = [
- {binVersion: "last-lts"},
- {binVersion: "last-lts"},
- {binVersion: "last-lts", arbiter: true}
- ];
- }
- const st = new ShardingTest({
- shards: {rs0: {nodes: replSetNodes}},
- other: {mongosOptions: {binVersion: "last-lts"}, configOptions: {binVersion: "last-lts"}}
- });
-
- if (CWWCSet) {
- jsTestLog("Setting the CWWC before upgrading sharded cluster");
- assert.commandWorked(st.s.adminCommand(
- {setDefaultRWConcern: 1, defaultWriteConcern: {w: "majority", wtimeout: 0}}));
- }
-
- let cwwc = st.s.adminCommand({getDefaultRWConcern: 1});
- if (CWWCSet) {
- assert.eq(cwwc.defaultWriteConcern, {w: "majority", wtimeout: 0});
- } else {
- assert(!cwwc.defaultWriteConcern);
- }
- assert(!cwwc.defaultWriteConcernSource);
-
- jsTestLog("Attempting to upgrade sharded cluster.");
- if (!CWWCSet && isPSASet) {
- // Fassert should be raised.
- assert(function() {
- try {
- st.upgradeCluster("latest");
- return false;
- } catch (ex) {
- assert.soon(
- () => rawMongoProgramOutput().search(/Fatal assertion.*5684400/) >= 0,
- "Node should have fasserted when upgrading to 5.0 when implicitDefaultWC = 1 and no" +
- "CWWC is set.",
- ReplSetTest.kDefaultTimeoutMS);
- return true;
- }
- });
-
- st.stop({skipValidatingExitCode: true, skipValidation: true});
- return;
- }
-
- st.upgradeCluster("latest");
- assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: latestFCV}));
- cwwc = st.s.adminCommand({getDefaultRWConcern: 1});
- assert.eq(cwwc.defaultWriteConcern, {w: "majority", wtimeout: 0}, tojson(cwwc));
- const defaultWriteConcernSource = CWWCSet ? "global" : "implicit";
- assert.eq(cwwc.defaultWriteConcernSource, defaultWriteConcernSource);
- st.stop();
-}
-
-for (const CWWCSet of [true, false]) {
- for (const isPSASet of [false, true]) {
- testSharding(CWWCSet, isPSASet);
- }
-}
-})();
diff --git a/jstests/multiVersion/upgrade_default_write_concern_majority.js b/jstests/multiVersion/upgrade_default_write_concern_majority.js
index 61e76d5220d..0f4e70e15df 100644
--- a/jstests/multiVersion/upgrade_default_write_concern_majority.js
+++ b/jstests/multiVersion/upgrade_default_write_concern_majority.js
@@ -60,11 +60,6 @@ function testReplSet(CWWCSet, isPSASet) {
}
function testSharding(CWWCSet, isPSASet) {
- if (isPSASet && !CWWCSet) {
- // Shard server will fassert on startup if DWCF=w:1 and no CWWC set.
- return;
- }
-
jsTestLog("Running sharding test with CWWCSet: " + tojson(CWWCSet) +
", isPSASet: " + tojson(isPSASet));
let replSetNodes = [{binVersion: "last-lts"}, {binVersion: "last-lts"}];
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 403d4b0e07b..f63f9b90ece 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -4554,7 +4554,6 @@ ReplicationCoordinatorImpl::_setCurrentRSConfig(WithLock lk,
if (!oldConfig.isInitialized()) {
// We allow the IDWC to be set only once after initial configuration is loaded.
_setImplicitDefaultWriteConcern(opCtx, lk);
- _validateDefaultWriteConcernOnShardStartup(lk);
} else {
// If 'enableDefaultWriteConcernUpdatesForInitiate' is enabled, we allow the IDWC to be
// recalculated after a reconfig. However, this logic is only relevant for testing,
diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp
index 11d55bfa79c..c15698b8762 100644
--- a/src/mongo/s/sharding_initialization.cpp
+++ b/src/mongo/s/sharding_initialization.cpp
@@ -230,8 +230,6 @@ Status waitForShardRegistryReload(OperationContext* opCtx) {
try {
uassertStatusOK(ClusterIdentityLoader::get(opCtx)->loadClusterId(
opCtx, repl::ReadConcernLevel::kMajorityReadConcern));
- // Assert will be raised on failure to talk to config server.
- loadCWWCFromConfigServerForReplication(opCtx);
if (Grid::get(opCtx)->shardRegistry()->isUp()) {
return Status::OK();
}