summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/analyze_cmd.cpp
diff options
context:
space:
mode:
authorMisha Tyulenev <misha.tyulenev@mongodb.com>2022-11-08 13:19:30 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-08 13:50:40 +0000
commit684acb71e9064aef555d6f44b2715b77cddd8c0b (patch)
tree48dbb73192bb384ba3f7dc41bfbe912e7b399748 /src/mongo/db/commands/analyze_cmd.cpp
parent25329194fe4343fd4ef1f3423377da742a47d5d6 (diff)
downloadmongo-684acb71e9064aef555d6f44b2715b77cddd8c0b.tar.gz
SERVER-70855 update statistics in the cache after running analyze
Diffstat (limited to 'src/mongo/db/commands/analyze_cmd.cpp')
-rw-r--r--src/mongo/db/commands/analyze_cmd.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/commands/analyze_cmd.cpp b/src/mongo/db/commands/analyze_cmd.cpp
index 5f444aea468..fdad77b25b3 100644
--- a/src/mongo/db/commands/analyze_cmd.cpp
+++ b/src/mongo/db/commands/analyze_cmd.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/query/allowed_contexts.h"
#include "mongo/db/query/analyze_command_gen.h"
+#include "mongo/db/query/ce/stats_catalog.h"
#include "mongo/db/query/query_feature_flags_gen.h"
#include "mongo/rpc/get_status_from_command_result.h"
@@ -198,6 +199,10 @@ public:
uassertStatusOK(getStatusFromCommandResult(analyzeResult));
+ // Invalidate statistics in the cache for the analyzed path
+ StatsCatalog& statsCatalog = StatsCatalog::get(opCtx);
+ uassertStatusOK(statsCatalog.invalidatePath(nss, key->toString()));
+
} else if (sampleSize || sampleRate) {
uassert(
6799706, "It is illegal to pass sampleRate or sampleSize without a key", key);