summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/commands/find_cmd.cpp3
-rw-r--r--src/mongo/db/commands/plan_cache_commands.cpp4
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp1
-rw-r--r--src/mongo/db/cst/pipeline_parser_gen.cpp4
-rw-r--r--src/mongo/db/exec/sbe/stages/hash_agg.cpp2
-rw-r--r--src/mongo/db/exec/sbe/stages/hash_join.cpp4
-rw-r--r--src/mongo/db/exec/sbe/stages/sort.cpp5
-rw-r--r--src/mongo/db/exec/sbe/stages/spool.cpp3
-rw-r--r--src/mongo/db/pipeline/tee_buffer.cpp2
-rw-r--r--src/mongo/db/query/get_executor.cpp3
10 files changed, 16 insertions, 15 deletions
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index 55233df9dc2..cba4f1d224e 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -316,6 +316,7 @@ public:
auto parsedNss =
NamespaceString{CommandHelpers::parseNsFromCommand(_dbName, _request.body)};
const bool isExplain = false;
+ const bool isOplogNss = (parsedNss == NamespaceString::kRsOplogNamespace);
auto qr =
parseCmdObjectToQueryRequest(opCtx, std::move(parsedNss), _request.body, isExplain);
@@ -344,7 +345,7 @@ public:
// The presence of a term in the request indicates that this is an internal replication
// oplog read request.
- if (term && parsedNss == NamespaceString::kRsOplogNamespace) {
+ if (term && isOplogNss) {
// We do not want to take tickets for internal (replication) oplog reads. Stalling
// on ticket acquisition can cause complicated deadlocks. Primaries may depend on
// data reaching secondaries in order to proceed; and secondaries may get stalled
diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp
index 0bafc8533b3..c4a6bb696e0 100644
--- a/src/mongo/db/commands/plan_cache_commands.cpp
+++ b/src/mongo/db/commands/plan_cache_commands.cpp
@@ -91,7 +91,9 @@ StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(OperationContext* opCtx
qr->setSort(sortObj);
qr->setProj(projObj);
qr->setCollation(collationObj);
- const ExtensionsCallbackReal extensionsCallback(opCtx, &nss);
+ // TODO(SERVER-49997): remove clang-tidy NOLINT comment.
+ const ExtensionsCallbackReal extensionsCallback(opCtx,
+ &nss); // NOLINT(bugprone-use-after-move)
const boost::intrusive_ptr<ExpressionContext> expCtx;
auto statusWithCQ =
CanonicalQuery::canonicalize(opCtx,
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 5964e931397..3083dd36d4c 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -717,7 +717,6 @@ Status runAggregate(OperationContext* opCtx,
}
auto pin = CursorManager::get(opCtx)->registerCursor(opCtx, std::move(cursorParams));
- invariant(!exec);
cursors.emplace_back(pin.getCursor());
pins.emplace_back(std::move(pin));
diff --git a/src/mongo/db/cst/pipeline_parser_gen.cpp b/src/mongo/db/cst/pipeline_parser_gen.cpp
index 06fc7b7cadb..8d13065b8ee 100644
--- a/src/mongo/db/cst/pipeline_parser_gen.cpp
+++ b/src/mongo/db/cst/pipeline_parser_gen.cpp
@@ -3327,8 +3327,8 @@ int PipelineParserGen::parse() {
| yyreturn -- parsing is finished, return the result. |
`-----------------------------------------------------*/
yyreturn:
- if (!yyla.empty())
- yy_destroy_("Cleanup: discarding lookahead", yyla);
+ if (!yyla.empty()) // NOLINT(bugprone-use-after-move)
+ yy_destroy_("Cleanup: discarding lookahead", yyla); // NOLINT(bugprone-use-after-move)
/* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
diff --git a/src/mongo/db/exec/sbe/stages/hash_agg.cpp b/src/mongo/db/exec/sbe/stages/hash_agg.cpp
index e8cfc33fde2..aa5c0deb58e 100644
--- a/src/mongo/db/exec/sbe/stages/hash_agg.cpp
+++ b/src/mongo/db/exec/sbe/stages/hash_agg.cpp
@@ -103,8 +103,8 @@ void HashAggStage::open(bool reOpen) {
_commonStats.opens++;
_children[0]->open(reOpen);
- value::MaterializedRow key;
while (_children[0]->getNext() == PlanState::ADVANCED) {
+ value::MaterializedRow key;
key._fields.resize(_inKeyAccessors.size());
// Copy keys in order to do the lookup.
size_t idx = 0;
diff --git a/src/mongo/db/exec/sbe/stages/hash_join.cpp b/src/mongo/db/exec/sbe/stages/hash_join.cpp
index 69e1dffe1e6..4f93c247376 100644
--- a/src/mongo/db/exec/sbe/stages/hash_join.cpp
+++ b/src/mongo/db/exec/sbe/stages/hash_join.cpp
@@ -119,10 +119,10 @@ void HashJoinStage::open(bool reOpen) {
_commonStats.opens++;
_children[0]->open(reOpen);
// Insert the outer side into the hash table.
- value::MaterializedRow key;
- value::MaterializedRow project;
while (_children[0]->getNext() == PlanState::ADVANCED) {
+ value::MaterializedRow key;
+ value::MaterializedRow project;
key._fields.reserve(_inOuterKeyAccessors.size());
project._fields.reserve(_inOuterProjectAccessors.size());
diff --git a/src/mongo/db/exec/sbe/stages/sort.cpp b/src/mongo/db/exec/sbe/stages/sort.cpp
index 26f1239a364..453e4a98f0a 100644
--- a/src/mongo/db/exec/sbe/stages/sort.cpp
+++ b/src/mongo/db/exec/sbe/stages/sort.cpp
@@ -121,9 +121,6 @@ void SortStage::open(bool reOpen) {
_commonStats.opens++;
_children[0]->open(reOpen);
- value::MaterializedRow keys;
- value::MaterializedRow vals;
-
SortOptions opts;
opts.tempDir = storageGlobalParams.dbpath + "/_tmp";
std::string spillFileName = opts.tempDir + "/" + nextFileName();
@@ -150,6 +147,8 @@ void SortStage::open(bool reOpen) {
};
while (_children[0]->getNext() == PlanState::ADVANCED) {
+ value::MaterializedRow keys;
+ value::MaterializedRow vals;
keys._fields.reserve(_inKeyAccessors.size());
vals._fields.reserve(_inValueAccessors.size());
diff --git a/src/mongo/db/exec/sbe/stages/spool.cpp b/src/mongo/db/exec/sbe/stages/spool.cpp
index 8e7928e6d63..b11dd4bc7b7 100644
--- a/src/mongo/db/exec/sbe/stages/spool.cpp
+++ b/src/mongo/db/exec/sbe/stages/spool.cpp
@@ -79,9 +79,8 @@ void SpoolEagerProducerStage::open(bool reOpen) {
_buffer->clear();
}
- value::MaterializedRow vals;
-
while (_children[0]->getNext() == PlanState::ADVANCED) {
+ value::MaterializedRow vals;
vals._fields.reserve(_inAccessors.size());
for (auto accessor : _inAccessors) {
diff --git a/src/mongo/db/pipeline/tee_buffer.cpp b/src/mongo/db/pipeline/tee_buffer.cpp
index 1182c040772..a7e5019f306 100644
--- a/src/mongo/db/pipeline/tee_buffer.cpp
+++ b/src/mongo/db/pipeline/tee_buffer.cpp
@@ -94,7 +94,7 @@ void TeeBuffer::loadNextBatch() {
// - TeeBuffer is the only place where a paused GetNextReturn will be returned.
// - The $facet stage is the only stage that uses TeeBuffer.
// - We currently disallow nested $facet stages.
- invariant(!input.isPaused());
+ invariant(!input.isPaused()); // NOLINT(bugprone-use-after-move)
// Populate the pending returns.
for (size_t consumerId = 0; consumerId < _consumers.size(); ++consumerId) {
diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp
index b5d0a2849ca..a63e841a3e0 100644
--- a/src/mongo/db/query/get_executor.cpp
+++ b/src/mongo/db/query/get_executor.cpp
@@ -919,7 +919,8 @@ protected:
const QueryPlannerParams& plannerParams,
size_t decisionWorks) final {
auto result = makeResult();
- result->emplace(buildExecutableTree(*solution, true), std::move(solution));
+ auto execTree = buildExecutableTree(*solution, true);
+ result->emplace(std::move(execTree), std::move(solution));
result->setDecisionWorks(decisionWorks);
return result;
}