summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/db.cpp15
-rw-r--r--src/mongo/db/keys_collection_client_direct.h3
-rw-r--r--src/mongo/db/mongod_options.cpp21
-rw-r--r--src/mongo/db/pipeline/document_source_lookup_test.cpp1
-rw-r--r--src/mongo/db/repl/repl_settings.cpp8
-rw-r--r--src/mongo/db/repl/repl_settings.h9
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp10
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_test.cpp4
-rw-r--r--src/mongo/db/repl/replication_coordinator_test_fixture.cpp1
-rw-r--r--src/mongo/db/views/view_catalog_test.cpp1
10 files changed, 19 insertions, 54 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index f67c7e7e3d1..af021dcf0ed 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -742,21 +742,6 @@ ExitCode _initAndListen(int listenPort) {
}
}
- if (!serviceContext->getGlobalStorageEngine()->getSnapshotManager()) {
- if (moe::startupOptionsParsed.count("replication.enableMajorityReadConcern") &&
- moe::startupOptionsParsed["replication.enableMajorityReadConcern"].as<bool>()) {
- // Note: we are intentionally only erroring if the user explicitly requested that we
- // enable majority read concern. We do not error if the they are implicitly enabled for
- // CSRS because a required step in the upgrade procedure can involve an mmapv1 node in
- // the CSRS in the REMOVED state. This is handled by the TopologyCoordinator.
- invariant(replSettings.isMajorityReadConcernEnabled());
- severe() << "Majority read concern requires a storage engine that supports"
- << " snapshots, such as wiredTiger. " << storageGlobalParams.engine
- << " does not support snapshots.";
- exitCleanly(EXIT_BADOPTIONS);
- }
- }
-
logMongodStartupWarnings(storageGlobalParams, serverGlobalParams, serviceContext);
{
diff --git a/src/mongo/db/keys_collection_client_direct.h b/src/mongo/db/keys_collection_client_direct.h
index 7bc02ed1c4f..f588fcc9d6e 100644
--- a/src/mongo/db/keys_collection_client_direct.h
+++ b/src/mongo/db/keys_collection_client_direct.h
@@ -57,8 +57,7 @@ public:
/**
* Returns false if getNewKeys uses readConcern level:local, so the documents returned can be
- * rolled back. For level:majority support the nodes must always start with
- * enableMajorityReadConcern parameter set to true.
+ * rolled back.
*/
bool supportsMajorityReads() const final {
return false;
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index 7e31a8f2890..6e68a66f3fb 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -437,10 +437,15 @@ Status addMongodOptions(moe::OptionSection* options) {
"specify index prefetching behavior (if secondary) [none|_id_only|all]")
.format("(:?none)|(:?_id_only)|(:?all)", "(none/_id_only/all)");
- rs_options.addOptionChaining("replication.enableMajorityReadConcern",
- "enableMajorityReadConcern",
- moe::Switch,
- "enables majority readConcern");
+ // `enableMajorityReadConcern` is always enabled starting in 3.6, regardless of user
+ // settings. We're leaving the option in to not break existing deployment scripts. A warning
+ // will appear if explicitly set to false.
+ rs_options
+ .addOptionChaining("replication.enableMajorityReadConcern",
+ "enableMajorityReadConcern",
+ moe::Switch,
+ "enables majority readConcern")
+ .setDefault(moe::Value(true));
// Sharding Options
@@ -1129,8 +1134,11 @@ Status storeMongodOptions(const moe::Environment& params) {
}
if (params.count("replication.enableMajorityReadConcern")) {
- replSettings.setMajorityReadConcernEnabled(
- params["replication.enableMajorityReadConcern"].as<bool>());
+ bool val = params["replication.enableMajorityReadConcern"].as<bool>();
+ if (!val) {
+ warning() << "enableMajorityReadConcern startup parameter was supplied, but its value "
+ "was ignored; majority read concern cannot be disabled.";
+ }
}
if (params.count("storage.indexBuildRetry")) {
@@ -1196,7 +1204,6 @@ Status storeMongodOptions(const moe::Environment& params) {
auto clusterRoleParam = params["sharding.clusterRole"].as<std::string>();
if (clusterRoleParam == "configsvr") {
serverGlobalParams.clusterRole = ClusterRole::ConfigServer;
- replSettings.setMajorityReadConcernEnabled(true);
// If we haven't explicitly specified a journal option, default journaling to true for
// the config server role
diff --git a/src/mongo/db/pipeline/document_source_lookup_test.cpp b/src/mongo/db/pipeline/document_source_lookup_test.cpp
index 9e6677f8dcb..54e58c25b58 100644
--- a/src/mongo/db/pipeline/document_source_lookup_test.cpp
+++ b/src/mongo/db/pipeline/document_source_lookup_test.cpp
@@ -84,7 +84,6 @@ public:
repl::ReplSettings settings;
settings.setReplSetString("lookupTestSet/node1:12345");
- settings.setMajorityReadConcernEnabled(true);
repl::StorageInterface::set(service, stdx::make_unique<repl::StorageInterfaceMock>());
auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorMock>(service, settings);
diff --git a/src/mongo/db/repl/repl_settings.cpp b/src/mongo/db/repl/repl_settings.cpp
index c31f8bc5012..5f73147ee47 100644
--- a/src/mongo/db/repl/repl_settings.cpp
+++ b/src/mongo/db/repl/repl_settings.cpp
@@ -68,10 +68,6 @@ bool ReplSettings::isAutoResyncEnabled() const {
return _autoResyncEnabled;
}
-bool ReplSettings::isMajorityReadConcernEnabled() const {
- return _majorityReadConcernEnabled;
-}
-
Seconds ReplSettings::getSlaveDelaySecs() const {
return _slaveDelaySecs;
}
@@ -123,10 +119,6 @@ void ReplSettings::setAutoResyncEnabled(bool autoResyncEnabled) {
_autoResyncEnabled = autoResyncEnabled;
}
-void ReplSettings::setMajorityReadConcernEnabled(bool majorityReadConcernEnabled) {
- _majorityReadConcernEnabled = majorityReadConcernEnabled;
-}
-
void ReplSettings::setSlaveDelaySecs(int slaveDelay) {
_slaveDelaySecs = Seconds(slaveDelay);
}
diff --git a/src/mongo/db/repl/repl_settings.h b/src/mongo/db/repl/repl_settings.h
index fe0e9ff03b6..ce804fb3502 100644
--- a/src/mongo/db/repl/repl_settings.h
+++ b/src/mongo/db/repl/repl_settings.h
@@ -60,7 +60,6 @@ public:
bool isMaster() const;
bool isFastSyncEnabled() const;
bool isAutoResyncEnabled() const;
- bool isMajorityReadConcernEnabled() const;
Seconds getSlaveDelaySecs() const;
int getPretouch() const;
long long getOplogSizeBytes() const;
@@ -87,7 +86,6 @@ public:
void setMaster(bool master);
void setFastSyncEnabled(bool fastSyncEnabled);
void setAutoResyncEnabled(bool autoResyncEnabled);
- void setMajorityReadConcernEnabled(bool majorityReadConcernEnabled);
void setSlaveDelaySecs(int slaveDelay);
void setPretouch(int pretouch);
void setOplogSizeBytes(long long oplogSizeBytes);
@@ -111,13 +109,6 @@ private:
Seconds _slaveDelaySecs = Seconds(0);
long long _oplogSizeBytes = 0; // --oplogSize
- /**
- * True means that the majorityReadConcern feature is enabled, either explicitly by the user or
- * implicitly by a requiring feature such as CSRS. It does not mean that the storage engine
- * supports snapshots or that the snapshot thread is running. Those are tracked separately.
- */
- bool _majorityReadConcernEnabled = false;
-
// for master/slave replication
std::string _source; // --source
std::string _only; // --only
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index e1cfd2e0b84..2f4a4331218 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -1139,9 +1139,6 @@ Status ReplicationCoordinatorImpl::_validateReadConcern(OperationContext* opCtx,
"Waiting for replication not allowed while holding a lock"};
}
- const bool isMajorityReadConcern =
- readConcern.getLevel() == ReadConcernLevel::kMajorityReadConcern;
-
if (readConcern.getArgsClusterTime() &&
readConcern.getLevel() != ReadConcernLevel::kMajorityReadConcern &&
readConcern.getLevel() != ReadConcernLevel::kLocalReadConcern) {
@@ -1150,11 +1147,10 @@ Status ReplicationCoordinatorImpl::_validateReadConcern(OperationContext* opCtx,
"afterClusterTime"};
}
- if (isMajorityReadConcern && !getSettings().isMajorityReadConcernEnabled()) {
- // This is an opt-in feature. Fail if the user didn't opt-in.
+ if (readConcern.getLevel() == ReadConcernLevel::kMajorityReadConcern &&
+ !_externalState->isReadCommittedSupportedByStorageEngine(opCtx)) {
return {ErrorCodes::ReadConcernMajorityNotEnabled,
- "Majority read concern requested, but server was not started with "
- "--enableMajorityReadConcern."};
+ "Majority read concern requested, but it is not supported by the storage engine."};
}
return Status::OK();
diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
index 0ac9df2b61a..c4038822d36 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
@@ -4065,9 +4065,7 @@ TEST_F(ReplCoordTest,
}
TEST_F(ReplCoordTest, NodeReturnsNotAReplicaSetWhenWaitUntilOpTimeIsRunAgainstAStandaloneNode) {
- auto settings = ReplSettings();
- settings.setMajorityReadConcernEnabled(true);
- init(settings);
+ init(ReplSettings());
auto opCtx = makeOperationContext();
diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
index abdee75ed34..3d302f781d4 100644
--- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
+++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
@@ -86,7 +86,6 @@ BSONObj ReplCoordTest::addProtocolVersion(const BSONObj& configDoc, int protocol
void ReplCoordTest::setUp() {
_settings.setReplSetString("mySet/node1:12345,node2:54321");
- _settings.setMajorityReadConcernEnabled(true);
}
void ReplCoordTest::tearDown() {
diff --git a/src/mongo/db/views/view_catalog_test.cpp b/src/mongo/db/views/view_catalog_test.cpp
index 192e79a1255..d26256cf40d 100644
--- a/src/mongo/db/views/view_catalog_test.cpp
+++ b/src/mongo/db/views/view_catalog_test.cpp
@@ -151,7 +151,6 @@ public:
repl::ReplSettings settings;
settings.setReplSetString("viewCatalogTestSet/node1:12345");
- settings.setMajorityReadConcernEnabled(true);
repl::StorageInterface::set(service, stdx::make_unique<repl::StorageInterfaceMock>());
auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorMock>(service, settings);