diff options
author | David Percy <david.percy@mongodb.com> | 2023-02-01 19:06:00 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-02-10 21:48:25 +0000 |
commit | 9dbe0a11bf15f2c4079e5a1ddd1d9e5838f4addc (patch) | |
tree | cdd17d18c4686c6424f456ec8e3f78dc22734f63 | |
parent | 45bceb5adece464eb8d36abb45faa62556692111 (diff) | |
download | mongo-9dbe0a11bf15f2c4079e5a1ddd1d9e5838f4addc.tar.gz |
SERVER-73852 Enable bounded-sort optimization on FCV 5.0
Once we backport this feature to 5.0, you should be able to upgrade
from 5.0 to 6.0 while using this feature. That means as you transition
through these cases, the feature should stay on:
- 5.0 binary with FCV 5.0
- 6.0 binary with FCV 5.0 -- this is the case we need to enable.
- 6.0 binary with FCV 6.0
This commit changes the 6.0 binary to enable this feature even when FCV
is 5.0.
-rw-r--r-- | src/mongo/db/pipeline/document_source_sort.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/pipeline/pipeline_d.cpp | 14 |
2 files changed, 6 insertions, 13 deletions
diff --git a/src/mongo/db/pipeline/document_source_sort.cpp b/src/mongo/db/pipeline/document_source_sort.cpp index e1ee0f3e6f3..84b28d6fde9 100644 --- a/src/mongo/db/pipeline/document_source_sort.cpp +++ b/src/mongo/db/pipeline/document_source_sort.cpp @@ -151,7 +151,10 @@ REGISTER_DOCUMENT_SOURCE_CONDITIONALLY( : AllowedWithApiStrict::kInternal, ::mongo::getTestCommandsEnabled() ? AllowedWithClientType::kAny : AllowedWithClientType::kInternal, - feature_flags::gFeatureFlagBucketUnpackWithSort.getVersion(), + // We don't expect mongos or clients to produce this stage: + // We only generate it after multiplanning, which means only within one mongod process. + // So, we should be allowed to parse this stage regardless of FCV. + boost::none /*minVersion*/, feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabledAndIgnoreFCV()); DocumentSource::GetNextResult::ReturnStatus DocumentSourceSort::timeSorterPeek() { diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index d2c09df5604..ad6adf44eaa 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -1218,12 +1218,7 @@ PipelineD::buildInnerQueryExecutorGeneric(const MultipleCollectionAccessor& coll // sort optimization. We check eligibility and perform the rewrite here. auto [unpack, sort] = findUnpackThenSort(pipeline->_sources); QueryPlannerParams plannerOpts; - if (serverGlobalParams.featureCompatibility.isVersionInitialized() && - serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo( - multiversion::FeatureCompatibilityVersion::kVersion_6_0) && - feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabled( - serverGlobalParams.featureCompatibility) && - unpack && sort) { + if (feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabledAndIgnoreFCV() && unpack && sort) { plannerOpts.traversalPreference = createTimeSeriesTraversalPreference(unpack, sort); } @@ -1245,12 +1240,7 @@ PipelineD::buildInnerQueryExecutorGeneric(const MultipleCollectionAccessor& coll // If this is a query on a time-series collection then it may be eligible for a post-planning // sort optimization. We check eligibility and perform the rewrite here. - if (serverGlobalParams.featureCompatibility.isVersionInitialized() && - serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo( - multiversion::FeatureCompatibilityVersion::kVersion_6_0) && - feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabled( - serverGlobalParams.featureCompatibility) && - unpack && sort) { + if (feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabledAndIgnoreFCV() && unpack && sort) { auto execImpl = dynamic_cast<PlanExecutorImpl*>(exec.get()); if (execImpl) { |