diff options
author | Grace Luong <grace.luong@mongodb.com> | 2020-07-15 15:52:07 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-15 16:22:04 +0000 |
commit | 1c4dde30942b37f1fc0cfbaea688e66746e2406c (patch) | |
tree | aa42c7fc6fa3c6ea619653870779c37c5c58cb4c | |
parent | 35b5c8a5054456fb80b8ef3001557e6d16a84867 (diff) | |
download | mongo-1c4dde30942b37f1fc0cfbaea688e66746e2406c.tar.gz |
SERVER-49060: added comments for generic FCV constants and conditional checks
-rw-r--r-- | src/mongo/db/catalog/coll_mod.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/catalog/database_impl.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/commands/feature_compatibility_version.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/initial_syncer.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_mongod_test_fixture.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/server_options.h | 2 | ||||
-rw-r--r-- | src/mongo/db/views/view_catalog.cpp | 1 | ||||
-rw-r--r-- | src/mongo/dbtests/dbtests.cpp | 1 | ||||
-rw-r--r-- | src/mongo/s/mongos_main.cpp | 1 | ||||
-rw-r--r-- | src/mongo/shell/mongo_main.cpp | 1 | ||||
-rw-r--r-- | src/mongo/unittest/unittest.cpp | 1 |
13 files changed, 17 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; diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp index 85d9af677a6..67a5d58a67e 100644 --- a/src/mongo/dbtests/dbtests.cpp +++ b/src/mongo/dbtests/dbtests.cpp @@ -179,6 +179,7 @@ int dbtestsMain(int argc, char** argv) { mongo::dbtests::initWireSpec(); mongo::runGlobalInitializersOrDie(std::vector<std::string>(argv, argv + argc)); + // (Generic FCV reference): This FCV reference should exist across LTS binary versions. serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::kLatest); repl::ReplSettings replSettings; diff --git a/src/mongo/s/mongos_main.cpp b/src/mongo/s/mongos_main.cpp index e60aaf53fdb..92ea2adc996 100644 --- a/src/mongo/s/mongos_main.cpp +++ b/src/mongo/s/mongos_main.cpp @@ -902,6 +902,7 @@ MONGO_INITIALIZER_GENERAL(ForkServer, ("EndStartupOptionHandling"), ("default")) // featureCompatibilityVersion is lower. MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersionLatest, ("EndStartupOptionStorage")) +// (Generic FCV reference): This FCV reference should exist across LTS binary versions. (InitializerContext* context) { serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::kLatest); diff --git a/src/mongo/shell/mongo_main.cpp b/src/mongo/shell/mongo_main.cpp index 8cbabf24dc3..3faef0e3bb5 100644 --- a/src/mongo/shell/mongo_main.cpp +++ b/src/mongo/shell/mongo_main.cpp @@ -118,6 +118,7 @@ const std::string kDefaultMongoURL = "mongodb://"s + kDefaultMongoHost + ":"s + // featureCompatibilityVersion is lower. MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersionLatest, ("EndStartupOptionSetup")) +// (Generic FCV reference): This FCV reference should exist across LTS binary versions. (InitializerContext* context) { mongo::serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::kLatest); diff --git a/src/mongo/unittest/unittest.cpp b/src/mongo/unittest/unittest.cpp index c3d0431b8d9..22fb7285a18 100644 --- a/src/mongo/unittest/unittest.cpp +++ b/src/mongo/unittest/unittest.cpp @@ -160,6 +160,7 @@ namespace { // Attempting to read the featureCompatibilityVersion parameter before it is explicitly initialized // with a meaningful value will trigger failures as of SERVER-32630. +// (Generic FCV reference): This FCV reference should exist across LTS binary versions. void setUpFCV() { serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::kLatest); |