summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/collection_sharding_runtime.cpp
diff options
context:
space:
mode:
authorMihai Andrei <mihai.andrei@mongodb.com>2023-02-03 18:09:28 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-03 19:52:33 +0000
commit56616080c12298229fc6e3cc71ace4c85ac973f4 (patch)
tree2eec3256ce8903a95085ee65dd7e5a0894cd739b /src/mongo/db/s/collection_sharding_runtime.cpp
parentd5e1315e25a60019434fa2379a2168c29b5cd93a (diff)
downloadmongo-56616080c12298229fc6e3cc71ace4c85ac973f4.tar.gz
SERVER-71798 Expand the set of queries eligible for SBE in the 6.3 release
Diffstat (limited to 'src/mongo/db/s/collection_sharding_runtime.cpp')
-rw-r--r--src/mongo/db/s/collection_sharding_runtime.cpp86
1 files changed, 41 insertions, 45 deletions
diff --git a/src/mongo/db/s/collection_sharding_runtime.cpp b/src/mongo/db/s/collection_sharding_runtime.cpp
index 385a2b91b67..61dde7e5a32 100644
--- a/src/mongo/db/s/collection_sharding_runtime.cpp
+++ b/src/mongo/db/s/collection_sharding_runtime.cpp
@@ -647,52 +647,48 @@ void CollectionShardingRuntime::_cleanupBeforeInstallingNewCollectionMetadata(
return;
}
- if (feature_flags::gFeatureFlagSbeFull.isEnabledAndIgnoreFCV()) {
- const auto oldUUID = _metadataManager->getCollectionUuid();
- const auto oldShardVersion = _metadataManager->getActiveShardVersion();
- ExecutorFuture<void>{Grid::get(opCtx)->getExecutorPool()->getFixedExecutor()}
- .then([svcCtx{opCtx->getServiceContext()}, oldUUID, oldShardVersion] {
- ThreadClient tc{"CleanUpShardedMetadata", svcCtx};
- {
- stdx::lock_guard<Client> lk{*tc.get()};
- tc->setSystemOperationKillableByStepdown(lk);
- }
- auto uniqueOpCtx{tc->makeOperationContext()};
- auto opCtx{uniqueOpCtx.get()};
-
- try {
- auto& planCache = sbe::getPlanCache(opCtx);
- planCache.removeIf([&](const sbe::PlanCacheKey& key,
- const sbe::PlanCacheEntry& entry) -> bool {
- const auto matchingCollState =
- [&](const sbe::PlanCacheKeyCollectionState& entryCollState) {
- return entryCollState.uuid == oldUUID &&
- entryCollState.shardVersion &&
- entryCollState.shardVersion->epoch == oldShardVersion.epoch() &&
- entryCollState.shardVersion->ts ==
- oldShardVersion.getTimestamp();
- };
-
- // Check whether the main collection of this plan is the one being removed
- if (matchingCollState(key.getMainCollectionState()))
+ const auto oldUUID = _metadataManager->getCollectionUuid();
+ const auto oldShardVersion = _metadataManager->getActiveShardVersion();
+ ExecutorFuture<void>{Grid::get(opCtx)->getExecutorPool()->getFixedExecutor()}
+ .then([svcCtx{opCtx->getServiceContext()}, oldUUID, oldShardVersion] {
+ ThreadClient tc{"CleanUpShardedMetadata", svcCtx};
+ {
+ stdx::lock_guard<Client> lk{*tc.get()};
+ tc->setSystemOperationKillableByStepdown(lk);
+ }
+ auto uniqueOpCtx{tc->makeOperationContext()};
+ auto opCtx{uniqueOpCtx.get()};
+
+ try {
+ auto& planCache = sbe::getPlanCache(opCtx);
+ planCache.removeIf([&](const sbe::PlanCacheKey& key,
+ const sbe::PlanCacheEntry& entry) -> bool {
+ const auto matchingCollState =
+ [&](const sbe::PlanCacheKeyCollectionState& entryCollState) {
+ return entryCollState.uuid == oldUUID && entryCollState.shardVersion &&
+ entryCollState.shardVersion->epoch == oldShardVersion.epoch() &&
+ entryCollState.shardVersion->ts == oldShardVersion.getTimestamp();
+ };
+
+ // Check whether the main collection of this plan is the one being removed
+ if (matchingCollState(key.getMainCollectionState()))
+ return true;
+
+ // Check whether a secondary collection is the one being removed
+ for (const auto& secCollState : key.getSecondaryCollectionStates()) {
+ if (matchingCollState(secCollState))
return true;
-
- // Check whether a secondary collection is the one being removed
- for (const auto& secCollState : key.getSecondaryCollectionStates()) {
- if (matchingCollState(secCollState))
- return true;
- }
-
- return false;
- });
- } catch (const DBException& ex) {
- LOGV2(6549200,
- "Interrupted deferred clean up of sharded metadata",
- "error"_attr = redact(ex));
- }
- })
- .getAsync([](auto) {});
- }
+ }
+
+ return false;
+ });
+ } catch (const DBException& ex) {
+ LOGV2(6549200,
+ "Interrupted deferred clean up of sharded metadata",
+ "error"_attr = redact(ex));
+ }
+ })
+ .getAsync([](auto) {});
}
void CollectionShardingRuntime::_checkCritSecForIndexMetadata(OperationContext* opCtx) const {