summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec
diff options
context:
space:
mode:
authorYoonsoo Kim <yoonsoo.kim@mongodb.com>2022-05-03 16:01:44 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-03 18:11:13 +0000
commitf808d90990b18f34e5fd32534087d0b96ea7df1e (patch)
treec9aaac8e870d5226133fdf91455b83b9e4eabae8 /src/mongo/db/exec
parentfec96c5cca9033ec8e8437926f3871a353d10a1a (diff)
downloadmongo-f808d90990b18f34e5fd32534087d0b96ea7df1e.tar.gz
SERVER-65470 Use `const&` instead of `const*` to express always non-null argument
Diffstat (limited to 'src/mongo/db/exec')
-rw-r--r--src/mongo/db/exec/sbe/stages/hash_lookup.cpp3
-rw-r--r--src/mongo/db/exec/sbe/stages/loop_join.cpp3
-rw-r--r--src/mongo/db/exec/sbe/stages/plan_stats.cpp12
-rw-r--r--src/mongo/db/exec/sbe/stages/plan_stats.h2
-rw-r--r--src/mongo/db/exec/sbe/stages/stage_visitors.h2
5 files changed, 11 insertions, 11 deletions
diff --git a/src/mongo/db/exec/sbe/stages/hash_lookup.cpp b/src/mongo/db/exec/sbe/stages/hash_lookup.cpp
index 0d976f1a875..a65f2f8bd89 100644
--- a/src/mongo/db/exec/sbe/stages/hash_lookup.cpp
+++ b/src/mongo/db/exec/sbe/stages/hash_lookup.cpp
@@ -591,11 +591,12 @@ void HashLookupStage::close() {
std::unique_ptr<PlanStageStats> HashLookupStage::getStats(bool includeDebugInfo) const {
auto ret = std::make_unique<PlanStageStats>(_commonStats);
+ invariant(ret);
ret->children.emplace_back(outerChild()->getStats(includeDebugInfo));
ret->children.emplace_back(innerChild()->getStats(includeDebugInfo));
ret->specific = std::make_unique<HashLookupStats>(_specificStats);
if (includeDebugInfo) {
- BSONObjBuilder bob(StorageAccessStatsVisitor::collectStats(*this, ret.get()).toBSON());
+ BSONObjBuilder bob(StorageAccessStatsVisitor::collectStats(*this, *ret).toBSON());
// Spilling stats.
bob.appendBool("usedDisk", _specificStats.usedDisk)
.appendNumber("spilledRecords", _specificStats.getSpilledRecords())
diff --git a/src/mongo/db/exec/sbe/stages/loop_join.cpp b/src/mongo/db/exec/sbe/stages/loop_join.cpp
index b319f94af11..bfc29e29e2e 100644
--- a/src/mongo/db/exec/sbe/stages/loop_join.cpp
+++ b/src/mongo/db/exec/sbe/stages/loop_join.cpp
@@ -174,12 +174,13 @@ void LoopJoinStage::doSaveState(bool relinquishCursor) {
std::unique_ptr<PlanStageStats> LoopJoinStage::getStats(bool includeDebugInfo) const {
auto ret = std::make_unique<PlanStageStats>(_commonStats);
+ invariant(ret);
ret->children.emplace_back(_children[0]->getStats(includeDebugInfo));
ret->children.emplace_back(_children[1]->getStats(includeDebugInfo));
ret->specific = std::make_unique<LoopJoinStats>(_specificStats);
if (includeDebugInfo) {
- BSONObjBuilder bob(StorageAccessStatsVisitor::collectStats(*this, ret.get()).toBSON());
+ BSONObjBuilder bob(StorageAccessStatsVisitor::collectStats(*this, *ret).toBSON());
bob.appendNumber("innerOpens", static_cast<long long>(_specificStats.innerOpens))
.appendNumber("innerCloses", static_cast<long long>(_specificStats.innerCloses))
.append("outerProjects", _outerProjects.begin(), _outerProjects.end())
diff --git a/src/mongo/db/exec/sbe/stages/plan_stats.cpp b/src/mongo/db/exec/sbe/stages/plan_stats.cpp
index 71a22275664..c0ba82d3cd8 100644
--- a/src/mongo/db/exec/sbe/stages/plan_stats.cpp
+++ b/src/mongo/db/exec/sbe/stages/plan_stats.cpp
@@ -46,19 +46,17 @@ size_t calculateNumberOfReads(const PlanStageStats* root) {
return visitor.numReads;
}
-PlanSummaryStats collectExecutionStatsSummary(const PlanStageStats* root) {
- invariant(root);
-
+PlanSummaryStats collectExecutionStatsSummary(const PlanStageStats& root) {
PlanSummaryStats summary;
- summary.nReturned = root->common.advances;
+ summary.nReturned = root.common.advances;
- if (root->common.executionTimeMillis) {
- summary.executionTimeMillisEstimate = *root->common.executionTimeMillis;
+ if (root.common.executionTimeMillis) {
+ summary.executionTimeMillisEstimate = *root.common.executionTimeMillis;
}
auto visitor = PlanSummaryStatsVisitor(summary);
auto walker = PlanStageStatsWalker<true, CommonStats>(nullptr, nullptr, &visitor);
- tree_walker::walk<true, PlanStageStats>(root, &walker);
+ tree_walker::walk<true, PlanStageStats>(&root, &walker);
return summary;
}
} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/stages/plan_stats.h b/src/mongo/db/exec/sbe/stages/plan_stats.h
index 263a4f86660..44f89ce0096 100644
--- a/src/mongo/db/exec/sbe/stages/plan_stats.h
+++ b/src/mongo/db/exec/sbe/stages/plan_stats.h
@@ -340,5 +340,5 @@ size_t calculateNumberOfReads(const PlanStageStats* root);
/**
* Accumulates the summary of all execution statistics by walking over the specific-stats of stages.
*/
-PlanSummaryStats collectExecutionStatsSummary(const PlanStageStats* root);
+PlanSummaryStats collectExecutionStatsSummary(const PlanStageStats& root);
} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/stages/stage_visitors.h b/src/mongo/db/exec/sbe/stages/stage_visitors.h
index 942dfcedd44..2e75c5c207e 100644
--- a/src/mongo/db/exec/sbe/stages/stage_visitors.h
+++ b/src/mongo/db/exec/sbe/stages/stage_visitors.h
@@ -56,7 +56,7 @@ public:
* Collects the storage-related statictics for the given 'root' and 'rootStats'.
*/
static StorageAccessStatsVisitor collectStats(const PlanStage& root,
- const PlanStageStats* rootStats) {
+ const PlanStageStats& rootStats) {
StorageAccessStatsVisitor res;
root.accumulate(res);
auto joinSummary = sbe::collectExecutionStatsSummary(rootStats);