summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorGrace Luong <grace.luong@mongodb.com>2020-07-15 15:52:07 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-15 16:22:04 +0000
commit1c4dde30942b37f1fc0cfbaea688e66746e2406c (patch)
treeaa42c7fc6fa3c6ea619653870779c37c5c58cb4c /src/mongo/db
parent35b5c8a5054456fb80b8ef3001557e6d16a84867 (diff)
downloadmongo-1c4dde30942b37f1fc0cfbaea688e66746e2406c.tar.gz
SERVER-49060: added comments for generic FCV constants and conditional checks
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp1
-rw-r--r--src/mongo/db/catalog/database_impl.cpp1
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.cpp3
-rw-r--r--src/mongo/db/repl/initial_syncer.cpp1
-rw-r--r--src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp1
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp2
-rw-r--r--src/mongo/db/s/sharding_mongod_test_fixture.cpp1
-rw-r--r--src/mongo/db/server_options.h2
-rw-r--r--src/mongo/db/views/view_catalog.cpp1
9 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index eff12ca995c..23199627a75 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -208,6 +208,7 @@ StatusWith<CollModRequest> parseCollModRequest(OperationContext* opCtx,
// being persisted in the catalog.
boost::optional<ServerGlobalParams::FeatureCompatibility::Version>
maxFeatureCompatibilityVersion;
+ // (Generic FCV reference): This FCV check should exist across LTS binary versions.
if (serverGlobalParams.validateFeaturesAsMaster.load() &&
currentFCV != ServerGlobalParams::FeatureCompatibility::kLatest) {
maxFeatureCompatibilityVersion = currentFCV;
diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp
index f164a08e99a..7a0e74071ba 100644
--- a/src/mongo/db/catalog/database_impl.cpp
+++ b/src/mongo/db/catalog/database_impl.cpp
@@ -868,6 +868,7 @@ Status DatabaseImpl::userCreateNS(OperationContext* opCtx,
// If the feature compatibility version is not kLatest, and we are validating features as
// master, ban the use of new agg features introduced in kLatest to prevent them from being
// persisted in the catalog.
+ // (Generic FCV reference): This FCV check should exist across LTS binary versions.
if (serverGlobalParams.validateFeaturesAsMaster.load() &&
currentFCV != ServerGlobalParams::FeatureCompatibility::kLatest) {
expCtx->maxFeatureCompatibilityVersion = currentFCV;
diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp
index 5c96789c300..d7f3aef5d42 100644
--- a/src/mongo/db/commands/feature_compatibility_version.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version.cpp
@@ -196,6 +196,7 @@ void FeatureCompatibilityVersion::_setVersion(
serverGlobalParams.featureCompatibility.setVersion(newVersion);
updateMinWireVersion();
+ // (Generic FCV reference): This FCV check should exist across LTS binary versions.
if (newVersion != ServerGlobalParams::FeatureCompatibility::kLastLTS) {
// Close all incoming connections from internal clients with binary versions lower than
// ours.
@@ -207,6 +208,7 @@ void FeatureCompatibilityVersion::_setVersion(
.dropConnections(transport::Session::kKeepOpen);
}
+ // (Generic FCV reference): This FCV check should exist across LTS binary versions.
if (newVersion != ServerGlobalParams::FeatureCompatibility::kLatest) {
if (MONGO_unlikely(hangBeforeAbortingRunningTransactionsOnFCVDowngrade.shouldFail())) {
LOGV2(20460,
@@ -227,6 +229,7 @@ void FeatureCompatibilityVersion::_setVersion(
// This can only happen in two scenarios:
// 1. Setting featureCompatibilityVersion from downgrading to fullyDowngraded.
// 2. Setting featureCompatibilityVersion from fullyDowngraded to upgrading.
+ // (Generic FCV reference): This FCV check should exist across LTS binary versions.
const auto shouldIncrementTopologyVersion =
newVersion == ServerGlobalParams::FeatureCompatibility::kLastLTS ||
newVersion == ServerGlobalParams::FeatureCompatibility::Version::kUpgradingFrom44To451;
diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp
index 687d0f65eb4..575bc0feacb 100644
--- a/src/mongo/db/repl/initial_syncer.cpp
+++ b/src/mongo/db/repl/initial_syncer.cpp
@@ -1087,6 +1087,7 @@ void InitialSyncer::_fcvFetcherCallback(const StatusWith<Fetcher::QueryResponse>
auto version = fCVParseSW.getValue();
// Changing the featureCompatibilityVersion during initial sync is unsafe.
+ // (Generic FCV reference): This FCV check should exist across LTS binary versions.
if (version > ServerGlobalParams::FeatureCompatibility::kLastLTS &&
version < ServerGlobalParams::FeatureCompatibility::kLatest) {
onCompletionGuard->setResultAndCancelRemainingWork_inlock(
diff --git a/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp b/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp
index 2c6536caa44..6c05eb6cc09 100644
--- a/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp
+++ b/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp
@@ -126,6 +126,7 @@ void OplogApplierImplTest::setUp() {
// Initialize the featureCompatibilityVersion server parameter. This is necessary because this
// test fixture does not create a featureCompatibilityVersion document from which to initialize
// the server parameter.
+ // (Generic FCV reference): This FCV reference should exist across LTS binary versions.
serverGlobalParams.featureCompatibility.setVersion(
ServerGlobalParams::FeatureCompatibility::kLatest);
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
index 5978639a12b..94fd2d01aee 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
@@ -338,6 +338,7 @@ StatusWith<ShardType> ShardingCatalogManager::_validateHostAsShard(
<< "field when attempting to add "
<< connectionString.toString() << " as a shard");
}
+ // (Generic FCV reference): This FCV check should exist across LTS binary versions.
if (serverGlobalParams.featureCompatibility.getVersion() >
ServerGlobalParams::FeatureCompatibility::kLastLTS) {
// If the cluster's FCV is kLatest, or upgrading to / downgrading from, the node being added
@@ -346,6 +347,7 @@ StatusWith<ShardType> ShardingCatalogManager::_validateHostAsShard(
} else {
// If the cluster's FCV is kLastLTS, the node being added must be a version kLastLTS or
// version kLatest binary.
+ // (Generic FCV reference): This FCV check should exist across LTS binary versions.
invariant(serverGlobalParams.featureCompatibility.getVersion() ==
ServerGlobalParams::FeatureCompatibility::kLastLTS);
invariant(maxWireVersion >= WireVersion::LATEST_WIRE_VERSION - 1);
diff --git a/src/mongo/db/s/sharding_mongod_test_fixture.cpp b/src/mongo/db/s/sharding_mongod_test_fixture.cpp
index c8049cd84b7..103ecc582d1 100644
--- a/src/mongo/db/s/sharding_mongod_test_fixture.cpp
+++ b/src/mongo/db/s/sharding_mongod_test_fixture.cpp
@@ -137,6 +137,7 @@ ShardingMongodTestFixture::ShardingMongodTestFixture() {
// Set the highest FCV because otherwise it defaults to the lower FCV. This way we default to
// testing this release's code, not backwards compatibility code.
+ // (Generic FCV reference): This FCV reference should exist across LTS binary versions.
serverGlobalParams.featureCompatibility.setVersion(
ServerGlobalParams::FeatureCompatibility::kLatest);
}
diff --git a/src/mongo/db/server_options.h b/src/mongo/db/server_options.h
index 3be5400522a..6577d946c32 100644
--- a/src/mongo/db/server_options.h
+++ b/src/mongo/db/server_options.h
@@ -198,6 +198,8 @@ struct ServerGlobalParams {
kVersion451 = 4,
};
+ // These constants should only be used for generic FCV references. Generic references are
+ // FCV references that are expected to exist across LTS binary versions.
static constexpr Version kLatest = Version::kVersion451;
static constexpr Version kLastContinuous = Version::kFullyDowngradedTo44;
static constexpr Version kLastLTS = Version::kFullyDowngradedTo44;
diff --git a/src/mongo/db/views/view_catalog.cpp b/src/mongo/db/views/view_catalog.cpp
index fb3cea60737..ad05c435d43 100644
--- a/src/mongo/db/views/view_catalog.cpp
+++ b/src/mongo/db/views/view_catalog.cpp
@@ -334,6 +334,7 @@ StatusWith<stdx::unordered_set<NamespaceString>> ViewCatalog::_validatePipeline(
// If the feature compatibility version is not kLatest, and we are validating features as
// master, ban the use of new agg features introduced in kLatest to prevent them from being
// persisted in the catalog.
+ // (Generic FCV reference): This FCV check should exist across LTS binary versions.
if (serverGlobalParams.validateFeaturesAsMaster.load() &&
currentFCV != ServerGlobalParams::FeatureCompatibility::kLatest) {
expCtx->maxFeatureCompatibilityVersion = currentFCV;