summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2022-09-16 14:42:35 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-16 15:29:16 +0000
commit62ea49cf4617b71cbc03c0058ea477b0e86a8569 (patch)
tree5ac04d22f340bc6c2d475e82f5c9d43a18d62dff
parent228a21b45bbe9978c80059538d2136afd337fed8 (diff)
downloadmongo-62ea49cf4617b71cbc03c0058ea477b0e86a8569.tar.gz
SERVER-62356 Fix multiversion suites
-rw-r--r--src/mongo/db/s/create_collection_coordinator.cpp37
-rw-r--r--src/mongo/db/s/shardsvr_create_collection_command.cpp3
-rw-r--r--src/mongo/s/sharding_feature_flags.idl5
3 files changed, 31 insertions, 14 deletions
diff --git a/src/mongo/db/s/create_collection_coordinator.cpp b/src/mongo/db/s/create_collection_coordinator.cpp
index ff58d129036..343b9a885e5 100644
--- a/src/mongo/db/s/create_collection_coordinator.cpp
+++ b/src/mongo/db/s/create_collection_coordinator.cpp
@@ -418,19 +418,23 @@ ExecutorFuture<void> CreateCollectionCoordinator::_runImpl(
}
}
})
- .then(_executePhase(Phase::kTranslateRequest,
- [this, anchor = shared_from_this()] {
- auto opCtxHolder = cc().makeOperationContext();
- auto* opCtx = opCtxHolder.get();
- getForwardableOpMetadata().setOn(opCtx);
- _logStartCreateCollection(opCtx);
-
- // Enter the critical sections before patching the user request to
- // avoid data races with concurrenct creation of unsharded
- // collections referencing the same namespace(s).
- _acquireCriticalSections(opCtx);
- _doc.setTranslatedRequestParams(_translateRequestParameters(opCtx));
- }))
+ .then([this, anchor = shared_from_this()] {
+ if (_timeseriesNssResolvedByCommandHandler()) {
+ return;
+ }
+ _executePhase(Phase::kTranslateRequest, [this, anchor = shared_from_this()] {
+ auto opCtxHolder = cc().makeOperationContext();
+ auto* opCtx = opCtxHolder.get();
+ getForwardableOpMetadata().setOn(opCtx);
+ _logStartCreateCollection(opCtx);
+
+ // Enter the critical sections before patching the user request to
+ // avoid data races with concurrenct creation of unsharded
+ // collections referencing the same namespace(s).
+ _acquireCriticalSections(opCtx);
+ _doc.setTranslatedRequestParams(_translateRequestParameters(opCtx));
+ })();
+ })
.then(_executePhase(
Phase::kCommit,
[this, executor = executor, token, anchor = shared_from_this()] {
@@ -451,6 +455,13 @@ ExecutorFuture<void> CreateCollectionCoordinator::_runImpl(
opCtx, getCurrentSession(), **executor);
}
+ if (_timeseriesNssResolvedByCommandHandler()) {
+ // execute the logic of the kTranslateRequest phase now.
+ _logStartCreateCollection(opCtx);
+ _acquireCriticalSections(opCtx);
+ _doc.setTranslatedRequestParams(_translateRequestParameters(opCtx));
+ }
+
// Check if the collection was already sharded by a past request
if (auto createCollectionResponseOpt =
sharding_ddl_util::checkIfCollectionAlreadySharded(
diff --git a/src/mongo/db/s/shardsvr_create_collection_command.cpp b/src/mongo/db/s/shardsvr_create_collection_command.cpp
index 3155963cc52..29453c185c8 100644
--- a/src/mongo/db/s/shardsvr_create_collection_command.cpp
+++ b/src/mongo/db/s/shardsvr_create_collection_command.cpp
@@ -145,10 +145,11 @@ public:
request().getShardKey());
const auto createCollectionCoordinator = [&] {
+ FixedFCVRegion fcvRegion(opCtx);
auto nssToForward = ns();
auto requestToForward = request().getCreateCollectionRequest();
auto coordinatorType = DDLCoordinatorTypeEnum::kCreateCollection;
- if (!feature_flags::gImplicitDDLTimeseriesNssTranslation.isEnabled(
+ if (!feature_flags::gCreateCollectionCoordinatorV3.isEnabled(
serverGlobalParams.featureCompatibility)) {
translateToTimeseriesCollection(opCtx, &nssToForward, &requestToForward);
coordinatorType = DDLCoordinatorTypeEnum::kCreateCollectionPre61Compatible;
diff --git a/src/mongo/s/sharding_feature_flags.idl b/src/mongo/s/sharding_feature_flags.idl
index dad24f5e69e..f47bc345d7a 100644
--- a/src/mongo/s/sharding_feature_flags.idl
+++ b/src/mongo/s/sharding_feature_flags.idl
@@ -60,6 +60,11 @@ feature_flags:
cpp_varname: feature_flags::gCollModCoordinatorV3
default: true
version: 6.1
+ featureFlagCreateCollectionCoordinatorV3:
+ description: "Feature for enabling new createCollection coordinator v3"
+ cpp_varname: feature_flags::gCreateCollectionCoordinatorV3
+ default: true
+ version: 6.2
featureFlagHistoricalPlacementShardingCatalog:
description: "Feature flag for enabling the storage and access to historical placement data at shards granularity through the Sharding Catalog"
cpp_varname: feature_flags::gHistoricalPlacementShardingCatalog