diff options
author | Cheahuychou Mao <mao.cheahuychou@gmail.com> | 2023-05-10 14:41:03 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-10 16:46:52 +0000 |
commit | ad86a3ab2803902e0037a4e12264380969b9cbb9 (patch) | |
tree | 945bcafd45f5e186ffcc709dda0ffe26c6c94527 /src/mongo/db | |
parent | 77c30e41e70e2f517ec037a7acb05ff7c1dde6c1 (diff) | |
download | mongo-ad86a3ab2803902e0037a4e12264380969b9cbb9.tar.gz |
SERVER-67966 Remove feature flag for PM-1858
Diffstat (limited to 'src/mongo/db')
10 files changed, 19 insertions, 48 deletions
diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp index 636852ed088..01b9fef468e 100644 --- a/src/mongo/db/mongod_main.cpp +++ b/src/mongo/db/mongod_main.cpp @@ -928,7 +928,7 @@ ExitCode _initAndListen(ServiceContext* serviceContext, int listenPort) { LogicalSessionCache::set(serviceContext, makeLogicalSessionCacheD(kind)); - if (analyze_shard_key::supportsSamplingQueries(serviceContext, true /* ignoreFCV */) && + if (analyze_shard_key::supportsSamplingQueries(serviceContext) && serverGlobalParams.clusterRole.has(ClusterRole::None)) { analyze_shard_key::QueryAnalysisSampler::get(serviceContext).onStartup(); } @@ -1244,14 +1244,10 @@ void setUpReplication(ServiceContext* serviceContext) { ReplicaSetNodeProcessInterface::setReplicaSetNodeExecutor( serviceContext, makeReplicaSetNodeExecutor(serviceContext)); - // The check below ignores the FCV because FCV is not initialized until after the replica - // set is initiated. - if (analyze_shard_key::isFeatureFlagEnabled(true /* ignoreFCV */)) { - analyze_shard_key::QueryAnalysisClient::get(serviceContext) - .setTaskExecutor( - serviceContext, - ReplicaSetNodeProcessInterface::getReplicaSetNodeExecutor(serviceContext)); - } + analyze_shard_key::QueryAnalysisClient::get(serviceContext) + .setTaskExecutor( + serviceContext, + ReplicaSetNodeProcessInterface::getReplicaSetNodeExecutor(serviceContext)); } repl::ReplicationCoordinator::set(serviceContext, std::move(replCoord)); @@ -1444,7 +1440,7 @@ void shutdownTask(const ShutdownTaskArgs& shutdownArgs) { lsc->joinOnShutDown(); } - if (analyze_shard_key::supportsSamplingQueries(serviceContext, true /* ignoreFCV */)) { + if (analyze_shard_key::supportsSamplingQueries(serviceContext)) { LOGV2_OPTIONS(7350601, {LogComponent::kDefault}, "Shutting down the QueryAnalysisSampler"); analyze_shard_key::QueryAnalysisSampler::get(serviceContext).onShutdown(); } diff --git a/src/mongo/db/pipeline/document_source_list_sampled_queries.cpp b/src/mongo/db/pipeline/document_source_list_sampled_queries.cpp index 2caa1fa442e..5fdecf0dd8a 100644 --- a/src/mongo/db/pipeline/document_source_list_sampled_queries.cpp +++ b/src/mongo/db/pipeline/document_source_list_sampled_queries.cpp @@ -32,18 +32,16 @@ #include "mongo/db/dbdirectclient.h" #include "mongo/logv2/log.h" #include "mongo/s/analyze_shard_key_documents_gen.h" -#include "mongo/s/analyze_shard_key_feature_flag_gen.h" #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kSharding namespace mongo { namespace analyze_shard_key { -REGISTER_DOCUMENT_SOURCE_WITH_FEATURE_FLAG(listSampledQueries, - DocumentSourceListSampledQueries::LiteParsed::parse, - DocumentSourceListSampledQueries::createFromBson, - AllowedWithApiStrict::kNeverInVersion1, - analyze_shard_key::gFeatureFlagAnalyzeShardKey); +REGISTER_DOCUMENT_SOURCE(listSampledQueries, + DocumentSourceListSampledQueries::LiteParsed::parse, + DocumentSourceListSampledQueries::createFromBson, + AllowedWithApiStrict::kNeverInVersion1); boost::intrusive_ptr<DocumentSource> DocumentSourceListSampledQueries::createFromBson( BSONElement specElem, const boost::intrusive_ptr<ExpressionContext>& pExpCtx) { diff --git a/src/mongo/db/s/analyze_shard_key_cmd.cpp b/src/mongo/db/s/analyze_shard_key_cmd.cpp index ac6475ebeac..11698c703c7 100644 --- a/src/mongo/db/s/analyze_shard_key_cmd.cpp +++ b/src/mongo/db/s/analyze_shard_key_cmd.cpp @@ -36,7 +36,6 @@ #include "mongo/db/s/shard_key_index_util.h" #include "mongo/logv2/log.h" #include "mongo/s/analyze_shard_key_cmd_gen.h" -#include "mongo/s/analyze_shard_key_feature_flag_gen.h" #include "mongo/s/analyze_shard_key_util.h" #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand @@ -145,10 +144,7 @@ public: std::string help() const override { return "Returns metrics for evaluating a shard key for a collection."; } -}; - -MONGO_REGISTER_FEATURE_FLAGGED_COMMAND(AnalyzeShardKeyCmd, - analyze_shard_key::gFeatureFlagAnalyzeShardKey); +} analyzeShardKeyCmd; } // namespace diff --git a/src/mongo/db/s/configure_query_analyzer_cmd.cpp b/src/mongo/db/s/configure_query_analyzer_cmd.cpp index 84b6fd11dbf..b40c0d2396c 100644 --- a/src/mongo/db/s/configure_query_analyzer_cmd.cpp +++ b/src/mongo/db/s/configure_query_analyzer_cmd.cpp @@ -40,7 +40,6 @@ #include "mongo/db/s/sharding_ddl_coordinator_service.h" #include "mongo/logv2/log.h" #include "mongo/s/analyze_shard_key_documents_gen.h" -#include "mongo/s/analyze_shard_key_feature_flag_gen.h" #include "mongo/s/analyze_shard_key_util.h" #include "mongo/s/configure_query_analyzer_cmd_gen.h" #include "mongo/s/grid.h" @@ -289,10 +288,7 @@ public: return "Starts or stops collecting metrics about read and write queries against a " "collection."; } -}; - -MONGO_REGISTER_FEATURE_FLAGGED_COMMAND(ConfigureQueryAnalyzerCmd, - analyze_shard_key::gFeatureFlagAnalyzeShardKey); +} configureQueryAnalyzerCmd; } // namespace diff --git a/src/mongo/db/s/document_source_analyze_shard_key_read_write_distribution.cpp b/src/mongo/db/s/document_source_analyze_shard_key_read_write_distribution.cpp index d3d43f07ae9..c0a38e0a169 100644 --- a/src/mongo/db/s/document_source_analyze_shard_key_read_write_distribution.cpp +++ b/src/mongo/db/s/document_source_analyze_shard_key_read_write_distribution.cpp @@ -36,7 +36,6 @@ #include "mongo/db/vector_clock.h" #include "mongo/logv2/log.h" #include "mongo/s/analyze_shard_key_documents_gen.h" -#include "mongo/s/analyze_shard_key_feature_flag_gen.h" #include "mongo/s/collection_routing_info_targeter.h" #include "mongo/s/grid.h" @@ -292,12 +291,10 @@ void processSampledDiffs(OperationContext* opCtx, } // namespace -REGISTER_DOCUMENT_SOURCE_WITH_FEATURE_FLAG( - _analyzeShardKeyReadWriteDistribution, - DocumentSourceAnalyzeShardKeyReadWriteDistribution::LiteParsed::parse, - DocumentSourceAnalyzeShardKeyReadWriteDistribution::createFromBson, - AllowedWithApiStrict::kNeverInVersion1, - analyze_shard_key::gFeatureFlagAnalyzeShardKey); +REGISTER_DOCUMENT_SOURCE(_analyzeShardKeyReadWriteDistribution, + DocumentSourceAnalyzeShardKeyReadWriteDistribution::LiteParsed::parse, + DocumentSourceAnalyzeShardKeyReadWriteDistribution::createFromBson, + AllowedWithApiStrict::kNeverInVersion1); boost::intrusive_ptr<DocumentSource> DocumentSourceAnalyzeShardKeyReadWriteDistribution::createFromBson( diff --git a/src/mongo/db/s/query_analysis_coordinator.cpp b/src/mongo/db/s/query_analysis_coordinator.cpp index 9979c87f971..770e778a308 100644 --- a/src/mongo/db/s/query_analysis_coordinator.cpp +++ b/src/mongo/db/s/query_analysis_coordinator.cpp @@ -65,9 +65,7 @@ QueryAnalysisCoordinator* QueryAnalysisCoordinator::get(ServiceContext* serviceC } bool QueryAnalysisCoordinator::shouldRegisterReplicaSetAwareService() const { - // This is invoked when the Register above is constructed which is before FCV is set so we need - // to ignore FCV when checking if the feature flag is enabled. - return supportsCoordinatingQueryAnalysis(true /* isReplEnabled */, true /* ignoreFCV */); + return supportsCoordinatingQueryAnalysis(true /* isReplEnabled */); } void QueryAnalysisCoordinator::onConfigurationInsert(const QueryAnalyzerDocument& doc) { diff --git a/src/mongo/db/s/query_analysis_coordinator_test.cpp b/src/mongo/db/s/query_analysis_coordinator_test.cpp index 93ca5c3ac0f..c65012c3028 100644 --- a/src/mongo/db/s/query_analysis_coordinator_test.cpp +++ b/src/mongo/db/s/query_analysis_coordinator_test.cpp @@ -173,7 +173,6 @@ protected: private: const std::shared_ptr<ClockSourceMock> _mockClock = std::make_shared<ClockSourceMock>(); - RAIIServerParameterControllerForTest _featureFlagController{"featureFlagAnalyzeShardKey", true}; RAIIServerParameterControllerForTest _inactiveThresholdController{ "queryAnalysisSamplerInActiveThresholdSecs", inActiveThresholdSecs}; }; diff --git a/src/mongo/db/s/query_analysis_writer.cpp b/src/mongo/db/s/query_analysis_writer.cpp index 7404066b9c9..67a170f734a 100644 --- a/src/mongo/db/s/query_analysis_writer.cpp +++ b/src/mongo/db/s/query_analysis_writer.cpp @@ -290,9 +290,7 @@ QueryAnalysisWriter* QueryAnalysisWriter::get(ServiceContext* serviceContext) { } bool QueryAnalysisWriter::shouldRegisterReplicaSetAwareService() const { - // This is invoked when the Register above is constructed which is before FCV is set so we need - // to ignore FCV when checking if the feature flag is enabled. - return supportsPersistingSampledQueries(true /* isReplEnabled */, true /* ignoreFCV */); + return supportsPersistingSampledQueries(true /* isReplEnabled */); } void QueryAnalysisWriter::onStartup(OperationContext* opCtx) { diff --git a/src/mongo/db/s/query_analysis_writer_test.cpp b/src/mongo/db/s/query_analysis_writer_test.cpp index c40e596a7d3..5d532ca53ad 100644 --- a/src/mongo/db/s/query_analysis_writer_test.cpp +++ b/src/mongo/db/s/query_analysis_writer_test.cpp @@ -506,7 +506,6 @@ private: return cursor->next(); } - RAIIServerParameterControllerForTest _featureFlagController{"featureFlagAnalyzeShardKey", true}; // This fixture manually flushes sampled queries and diffs. FailPointEnableBlock _fp{"disableQueryAnalysisWriterFlusher"}; PseudoRandom _random{SecureRandom{}.nextInt64()}; @@ -974,7 +973,6 @@ TEST_F(QueryAnalysisWriterTest, QueriesMultipleBatches_MaxBatchSize) { } TEST_F(QueryAnalysisWriterTest, QueriesMultipleBatchesFewQueries_MaxBSONObjSize) { - RAIIServerParameterControllerForTest featureFlagController("featureFlagAnalyzeShardKey", true); auto& writer = *QueryAnalysisWriter::get(operationContext()); auto numQueries = 3; @@ -999,7 +997,6 @@ TEST_F(QueryAnalysisWriterTest, QueriesMultipleBatchesFewQueries_MaxBSONObjSize) } TEST_F(QueryAnalysisWriterTest, QueriesMultipleBatchesManyQueries_MaxBSONObjSize) { - RAIIServerParameterControllerForTest featureFlagController("featureFlagAnalyzeShardKey", true); auto& writer = *QueryAnalysisWriter::get(operationContext()); auto numQueries = 75'000; diff --git a/src/mongo/db/s/refresh_query_analyzer_configuration_cmd.cpp b/src/mongo/db/s/refresh_query_analyzer_configuration_cmd.cpp index 0efae360f48..6361eef0c3b 100644 --- a/src/mongo/db/s/refresh_query_analyzer_configuration_cmd.cpp +++ b/src/mongo/db/s/refresh_query_analyzer_configuration_cmd.cpp @@ -34,7 +34,6 @@ #include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/s/query_analysis_coordinator.h" #include "mongo/logv2/log.h" -#include "mongo/s/analyze_shard_key_feature_flag_gen.h" #include "mongo/s/refresh_query_analyzer_configuration_cmd_gen.h" #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand @@ -107,10 +106,7 @@ public: std::string help() const override { return "Refreshes the query analyzer configurations for all collections."; } -}; - -MONGO_REGISTER_FEATURE_FLAGGED_COMMAND(RefreshQueryAnalyzerConfigurationCmd, - analyze_shard_key::gFeatureFlagAnalyzeShardKey); +} refreshQueryAnalyzerConfigurationCmd; } // namespace |