diff options
author | Allison Easton <allison.easton@mongodb.com> | 2022-08-17 10:00:30 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-17 10:53:36 +0000 |
commit | a510654b3da2cb828aeff7cdccf0e2d657132b59 (patch) | |
tree | 712c02ffcfca63c9fa99318d907768f6685d9574 /src/mongo/db/s/collection_sharding_runtime.cpp | |
parent | 261b4a8e28cc7daf57135bb0fb31148388f930ff (diff) | |
download | mongo-a510654b3da2cb828aeff7cdccf0e2d657132b59.tar.gz |
SERVER-62793 Add index component to shard version
Diffstat (limited to 'src/mongo/db/s/collection_sharding_runtime.cpp')
-rw-r--r-- | src/mongo/db/s/collection_sharding_runtime.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/db/s/collection_sharding_runtime.cpp b/src/mongo/db/s/collection_sharding_runtime.cpp index 74ec459230d..bf444811915 100644 --- a/src/mongo/db/s/collection_sharding_runtime.cpp +++ b/src/mongo/db/s/collection_sharding_runtime.cpp @@ -40,6 +40,7 @@ #include "mongo/db/s/sharding_runtime_d_params_gen.h" #include "mongo/db/s/sharding_state.h" #include "mongo/logv2/log.h" +#include "mongo/s/sharding_feature_flags_gen.h" #include "mongo/s/type_collection_common_types_gen.h" #include "mongo/util/duration.h" @@ -109,6 +110,12 @@ ScopedCollectionFilter CollectionShardingRuntime::getOwnershipFilter( // No operations should be calling getOwnershipFilter without a shard version invariant(optReceivedShardVersion, "getOwnershipFilter called by operation that doesn't specify shard version"); + uassert(6279300, + "Request was received without an attached index version. This could indicate that " + "this request was sent by a router of an older version", + !feature_flags::gGlobalIndexesShardingCatalog.isEnabled( + serverGlobalParams.featureCompatibility) || + optReceivedShardVersion->indexVersion()); } auto metadata = @@ -141,6 +148,12 @@ ScopedCollectionDescription CollectionShardingRuntime::getCollectionDescription( auto optMetadata = _getCurrentMetadataIfKnown(boost::none); const auto receivedShardVersion{oss.getShardVersion(_nss)}; + uassert(6279301, + "Request was received without an attached index version. This could indicate that this " + "request was sent by a router of an older version", + !feature_flags::gGlobalIndexesShardingCatalog.isEnabled( + serverGlobalParams.featureCompatibility) || + !receivedShardVersion || receivedShardVersion->indexVersion()); uassert( StaleConfigInfo(_nss, receivedShardVersion ? (ChunkVersion)*receivedShardVersion @@ -355,6 +368,13 @@ CollectionShardingRuntime::_getMetadataWithVersionCheckAt( // Assume that the received shard version was IGNORED if the current operation wasn't versioned const auto& receivedShardVersion = optReceivedShardVersion ? (ChunkVersion)*optReceivedShardVersion : ChunkVersion::IGNORED(); + uassert(6279302, + "Request was received without an attached index version. This could indicate that this " + "request was sent by a router of an older version", + !feature_flags::gGlobalIndexesShardingCatalog.isEnabled( + serverGlobalParams.featureCompatibility) || + receivedShardVersion == ChunkVersion::IGNORED() || + optReceivedShardVersion->indexVersion()); auto csrLock = CSRLock::lockShared(opCtx, this); |