From 4313a0ff6dc419431998017a20c035439fb083af Mon Sep 17 00:00:00 2001 From: Maddie Zechar Date: Tue, 4 Jan 2022 19:05:28 +0000 Subject: SERVER-62019: Remove flag guard from linearFill --- jstests/aggregation/sources/setWindowFields/locf.js | 5 +++++ src/mongo/db/pipeline/accumulator_locf.cpp | 4 ++-- src/mongo/db/pipeline/document_source_fill.cpp | 4 ++-- .../window_function/window_function_expression.cpp | 8 +++++--- src/mongo/db/query/query_feature_flags.idl | 19 ++++++++++++------- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/jstests/aggregation/sources/setWindowFields/locf.js b/jstests/aggregation/sources/setWindowFields/locf.js index b6a7d7960b6..8038c2cbc1b 100644 --- a/jstests/aggregation/sources/setWindowFields/locf.js +++ b/jstests/aggregation/sources/setWindowFields/locf.js @@ -12,6 +12,11 @@ load("jstests/aggregation/extras/window_function_helpers.js"); load("jstests/aggregation/extras/utils.js"); // For arrayEq. load("jstests/libs/feature_flag_util.js"); // For isEnabled. +if (!FeatureFlagUtil.isEnabled(db, "Locf")) { + jsTestLog("Skipping as featureFlagLocf is not enabled"); + return; +} + const coll = db[jsTestName()]; coll.drop(); diff --git a/src/mongo/db/pipeline/accumulator_locf.cpp b/src/mongo/db/pipeline/accumulator_locf.cpp index 9d7749e6a5a..01ac81bf029 100644 --- a/src/mongo/db/pipeline/accumulator_locf.cpp +++ b/src/mongo/db/pipeline/accumulator_locf.cpp @@ -41,8 +41,8 @@ namespace mongo { REGISTER_WINDOW_FUNCTION_CONDITIONALLY( locf, mongo::window_function::ExpressionFromLeftUnboundedWindowFunction::parse, - multiversion::FeatureCompatibilityVersion::kVersion_5_2, - true); + feature_flags::gFeatureFlagLocf.getVersion(), + feature_flags::gFeatureFlagLocf.isEnabledAndIgnoreFCV()); AccumulatorLocf::AccumulatorLocf(ExpressionContext* const expCtx) : AccumulatorForWindowFunctions(expCtx) { diff --git a/src/mongo/db/pipeline/document_source_fill.cpp b/src/mongo/db/pipeline/document_source_fill.cpp index 282ca7586f2..beb335bf31f 100644 --- a/src/mongo/db/pipeline/document_source_fill.cpp +++ b/src/mongo/db/pipeline/document_source_fill.cpp @@ -44,8 +44,8 @@ REGISTER_DOCUMENT_SOURCE_CONDITIONALLY(fill, document_source_fill::createFromBson, AllowedWithApiStrict::kNeverInVersion1, AllowedWithClientType::kAny, - multiversion::FeatureCompatibilityVersion::kVersion_5_2, - feature_flags::gFlagFill.isEnabledAndIgnoreFCV()); + feature_flags::gFeatureFlagFill.getVersion(), + feature_flags::gFeatureFlagFill.isEnabledAndIgnoreFCV()); namespace document_source_fill { std::list> createFromBson( diff --git a/src/mongo/db/pipeline/window_function/window_function_expression.cpp b/src/mongo/db/pipeline/window_function/window_function_expression.cpp index 10229d9eedb..cd5d3ad6da8 100644 --- a/src/mongo/db/pipeline/window_function/window_function_expression.cpp +++ b/src/mongo/db/pipeline/window_function/window_function_expression.cpp @@ -58,9 +58,11 @@ REGISTER_WINDOW_FUNCTION(derivative, ExpressionDerivative::parse); REGISTER_WINDOW_FUNCTION(first, ExpressionFirst::parse); REGISTER_WINDOW_FUNCTION(last, ExpressionLast::parse); REGISTER_WINDOW_FUNCTION_CONDITIONALLY(linearFill, - ExpressionLinearFill::parse, - multiversion::FeatureCompatibilityVersion::kVersion_5_2, - feature_flags::gFlagFill.isEnabledAndIgnoreFCV()); + (ExpressionLinearFill::parse), + feature_flags::gFeatureFlagFill.getVersion(), + feature_flags::gFeatureFlagFill.isEnabledAndIgnoreFCV()); +// TODO SERVER-52247 Replace boost::none with 'gFeatureFlagExactTopNAccumulator.getVersion()' below +// once 'gFeatureFlagExactTopNAccumulator' is set to true by default and is configured with an FCV. REGISTER_WINDOW_FUNCTION_CONDITIONALLY( minN, (ExpressionN::parse), diff --git a/src/mongo/db/query/query_feature_flags.idl b/src/mongo/db/query/query_feature_flags.idl index 5607f3069f7..17a33beb4be 100644 --- a/src/mongo/db/query/query_feature_flags.idl +++ b/src/mongo/db/query/query_feature_flags.idl @@ -82,13 +82,6 @@ feature_flags: cpp_varname: gFeatureFlagSbePlanCache default: false - featureFlagFill: - description: > - When disabled, this flag does not allow $fill, $locf or the linear interpolation window function - to parse. It will be removed when PM-1935 is complete - cpp_varname: gFlagFill - default: false - featureFlagSortArray: description: "Feature flag for allowing use of the $sortArray aggregation expression" cpp_varname: gFeatureFlagSortArray @@ -100,6 +93,18 @@ feature_flags: cpp_varname: gFeatureFlagChangeStreamsVisibility default: false + featureFlagLocf: + description: "Feature flag for allowing $locf window function" + cpp_varname: gFeatureFlagLocf + default: true + version: 5.2 + + featureFlagFill: + description: "Feature flag for allowing $fill and $linearFill window functions" + cpp_varname: gFeatureFlagFill + default: true + version: 5.3 + featureFlagPerShardCursor: description: "Feature flag for enabling a per-shard cursor via mongos" cpp_varname: gFeatureFlagPerShardCursor -- cgit v1.2.1