diff options
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/cost_model/cost_model_manager.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/db/query/cost_model/cost_model_manager.cpp b/src/mongo/db/query/cost_model/cost_model_manager.cpp index caa493fffb0..6c97b39124a 100644 --- a/src/mongo/db/query/cost_model/cost_model_manager.cpp +++ b/src/mongo/db/query/cost_model/cost_model_manager.cpp @@ -106,9 +106,14 @@ CostModelCoefficients CostModelManager::getDefaultCoefficients() { } void CostModelManager::updateCostModelCoefficients(const BSONObj& overrides) { - auto coefsObj = _coefficients.toBSON(); - auto newCoefs = CostModelCoefficients::parse(IDLParserContext{"CostModelCoefficients"}, - coefsObj.addFields(overrides)); + CostModelCoefficients newCoefs; + if (overrides.isEmpty()) { + initializeCoefficients(newCoefs); + } else { + auto coefsObj = _coefficients.toBSON(); + newCoefs = CostModelCoefficients::parse(IDLParserContext{"CostModelCoefficients"}, + coefsObj.addFields(overrides)); + } stdx::unique_lock wLock(_mutex); _coefficients = std::move(newCoefs); |