summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuoxin Xu <ruoxin.xu@mongodb.com>2022-11-29 13:38:38 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-29 14:17:36 +0000
commit880aa5f3b38e1026e4be9ce8f4403703d19d979f (patch)
tree60a93479582468edb2791c3efd8077d8249b3d43
parent5780eb7761504ed0f085216883d481461dc7a6cb (diff)
downloadmongo-880aa5f3b38e1026e4be9ce8f4403703d19d979f.tar.gz
SERVER-71630 Return an error Status if OnCoefficientsChangeUpdater is empty
-rw-r--r--src/mongo/db/query/cost_model/cost_model_on_update.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/query/cost_model/cost_model_on_update.cpp b/src/mongo/db/query/cost_model/cost_model_on_update.cpp
index c57d00b4140..c64a9385b8a 100644
--- a/src/mongo/db/query/cost_model/cost_model_on_update.cpp
+++ b/src/mongo/db/query/cost_model/cost_model_on_update.cpp
@@ -56,6 +56,11 @@ Status updateCostCoefficients() {
const auto overrides = getCostModelCoefficientsOverride();
auto updater = onCoefficientsChangeUpdater(serviceCtx).get();
+ if (!updater) {
+ return Status(ErrorCodes::IllegalOperation,
+ "failed to set 'internalCostModelCoefficients' because "
+ "OnCoefficientsChangeUpdater is null");
+ }
updater->updateCoefficients(serviceCtx, overrides);
} else {
// 'client' may be null if the server parameter is set on mongod startup.