diff options
author | Marcos José Grillo Ramírez <marcos.grillo@mongodb.com> | 2020-06-16 15:00:37 +0200 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-16 13:16:40 +0000 |
commit | 78c8c0b7bea617a336b5b4701f17e0107db3f78a (patch) | |
tree | e422bb8bfef118e70640dc6f87df099ae8e259ca /src/mongo/db/s/shard_filtering_metadata_refresh.cpp | |
parent | a68c830045bed30f9e3e244daf3d4a846c57bd84 (diff) | |
download | mongo-78c8c0b7bea617a336b5b4701f17e0107db3f78a.tar.gz |
SERVER-47982 Remove refreshFilteringMetadataUntilSuccess from migration recovery
Diffstat (limited to 'src/mongo/db/s/shard_filtering_metadata_refresh.cpp')
-rw-r--r-- | src/mongo/db/s/shard_filtering_metadata_refresh.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp index 18e1b8da13b..b4081648073 100644 --- a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp +++ b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp @@ -303,6 +303,27 @@ Status onShardVersionMismatchNoExcept(OperationContext* opCtx, } } +CollectionMetadata forceGetCurrentMetadata(OperationContext* opCtx, const NamespaceString& nss) { + invariant(!opCtx->lockState()->isLocked()); + invariant(!opCtx->getClient()->isInDirectClient()); + + if (MONGO_unlikely(skipShardFilteringMetadataRefresh.shouldFail())) { + uasserted(ErrorCodes::InternalError, "skipShardFilteringMetadataRefresh failpoint"); + } + + auto* const shardingState = ShardingState::get(opCtx); + invariant(shardingState->canAcceptShardedCommands()); + + auto routingInfo = uassertStatusOK( + Grid::get(opCtx)->catalogCache()->getCollectionRoutingInfoWithRefresh(opCtx, nss, true)); + + if (!routingInfo.cm()) { + return CollectionMetadata(); + } + + return CollectionMetadata(routingInfo.cm(), shardingState->shardId()); +} + ChunkVersion forceShardFilteringMetadataRefresh(OperationContext* opCtx, const NamespaceString& nss, bool forceRefreshFromThisThread) { |