summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/plan_ranker.cpp
diff options
context:
space:
mode:
authorMisha Ivkov <misha.ivkov@10gen.com>2019-06-11 17:02:48 -0400
committerMisha Ivkov <misha.ivkov@10gen.com>2019-06-11 17:03:12 -0400
commitcad3a84e198e0851c7a8dd49d365ea1ce5cada50 (patch)
treef8d3190c3a5c0434c40641e0f278efc245f08360 /src/mongo/db/query/plan_ranker.cpp
parent95975c0e9c725ef86ef2fe6a8f5372e8a3f219d3 (diff)
downloadmongo-cad3a84e198e0851c7a8dd49d365ea1ce5cada50.tar.gz
SERVER-41271 allow logging doubles with arbitrary precision
Diffstat (limited to 'src/mongo/db/query/plan_ranker.cpp')
-rw-r--r--src/mongo/db/query/plan_ranker.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mongo/db/query/plan_ranker.cpp b/src/mongo/db/query/plan_ranker.cpp
index 4d3069fb47a..ff2e636a28a 100644
--- a/src/mongo/db/query/plan_ranker.cpp
+++ b/src/mongo/db/query/plan_ranker.cpp
@@ -242,14 +242,16 @@ double PlanRanker::scoreTree(const PlanStageStats* stats) {
double tieBreakers = noFetchBonus + noSortBonus + noIxisectBonus;
double score = baseScore + productivity + tieBreakers;
- str::stream ss;
- ss << "score(" << score << ") = baseScore(" << baseScore << ")"
+ StringBuilder sb;
+ sb << "score(" << str::convertDoubleToString(score) << ") = baseScore("
+ << str::convertDoubleToString(baseScore) << ")"
<< " + productivity((" << stats->common.advanced << " advanced)/(" << stats->common.works
- << " works) = " << productivity << ")"
- << " + tieBreakers(" << noFetchBonus << " noFetchBonus + " << noSortBonus
- << " noSortBonus + " << noIxisectBonus << " noIxisectBonus = " << tieBreakers << ")";
- std::string scoreStr = ss;
- LOG(2) << scoreStr;
+ << " works) = " << str::convertDoubleToString(productivity) << ")"
+ << " + tieBreakers(" << str::convertDoubleToString(noFetchBonus) << " noFetchBonus + "
+ << str::convertDoubleToString(noSortBonus) << " noSortBonus + "
+ << str::convertDoubleToString(noIxisectBonus)
+ << " noIxisectBonus = " << str::convertDoubleToString(tieBreakers) << ")";
+ LOG(2) << sb.str();
if (internalQueryForceIntersectionPlans.load()) {
if (hasStage(STAGE_AND_HASH, stats) || hasStage(STAGE_AND_SORTED, stats)) {