diff options
author | Sergi Mateo Bellido <sergi.mateo-bellido@mongodb.com> | 2022-06-17 04:51:39 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-20 07:59:31 +0000 |
commit | f9c9120058d3d5597a282bc72e6bc4ced2517212 (patch) | |
tree | b57bc50823525fcec65a9fffa25b7c9a44cd86c7 /src | |
parent | dd97dc5f81ddce5415fedf539b11246910f8f676 (diff) | |
download | mongo-f9c9120058d3d5597a282bc72e6bc4ced2517212.tar.gz |
SERVER-66541 Rely on a refresh to define the metadata barrier
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/commands/set_feature_compatibility_version_command.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp index 40b01cc9944..73933d1abe2 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -74,7 +74,9 @@ #include "mongo/db/s/resharding/coordinator_document_gen.h" #include "mongo/db/s/resharding/resharding_coordinator_service.h" #include "mongo/db/s/resharding/resharding_donor_recipient_common.h" +#include "mongo/db/s/shard_filtering_metadata_refresh.h" #include "mongo/db/s/sharding_ddl_coordinator_service.h" +#include "mongo/db/s/sharding_state.h" #include "mongo/db/s/sharding_util.h" #include "mongo/db/s/transaction_coordinator_service.h" #include "mongo/db/server_feature_flags_gen.h" @@ -87,6 +89,8 @@ #include "mongo/idl/cluster_server_parameter_gen.h" #include "mongo/logv2/log.h" #include "mongo/rpc/get_status_from_command_result.h" +#include "mongo/s/catalog/sharding_catalog_client.h" +#include "mongo/s/catalog_cache_loader.h" #include "mongo/s/pm2423_feature_flags_gen.h" #include "mongo/s/pm2583_feature_flags_gen.h" #include "mongo/s/refine_collection_shard_key_coordinator_feature_flags_gen.h" @@ -546,6 +550,26 @@ public: } } + if (requestedVersion == multiversion::FeatureCompatibilityVersion::kVersion_6_0 && + ShardingState::get(opCtx)->enabled()) { + const auto colls = CollectionShardingState::getCollectionNames(opCtx); + for (const auto& collName : colls) { + onShardVersionMismatch(opCtx, collName, boost::none); + CatalogCacheLoader::get(opCtx).waitForCollectionFlush(opCtx, collName); + } + + repl::ReplClientInfo::forClient(opCtx->getClient()) + .setLastOpToSystemLastOpTime(opCtx); + + // Wait until the changes on config.cache.* are majority committed. + WriteConcernResult ignoreResult; + auto latestOpTime = repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp(); + uassertStatusOK(waitForWriteConcern(opCtx, + latestOpTime, + ShardingCatalogClient::kMajorityWriteConcern, + &ignoreResult)); + } + // Complete transition by updating the local FCV document to the fully upgraded or // downgraded requestedVersion. const auto fcvChangeRegion(FeatureCompatibilityVersion::enterFCVChangeRegion(opCtx)); |