Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add ResourceMonitor* to ExecutionEngine.cpp and ExecutionPlan.cpp
  • Loading branch information
knakatasf committed Nov 18, 2025
commit a718ca4e3e48aa3348e90ffa99ea4c0f324fd385
7 changes: 4 additions & 3 deletions arangod/Aql/ExecutionEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ void ExecutionEngine::initializeConstValueBlock(
plan.getAst()->variables()->visit(
[&, regPlan = plan.root()->getRegisterPlan(),
block = mgr.getConstValueBlock()](Variable* var) {
ResourceMonitor* rm = &plan.getAst()->query().resourceMonitor();
if (var->type() == Variable::Type::Const) {
RegisterId reg = regPlan->variableToOptionalRegisterId(var->id);
if (reg.value() != RegisterId::maxRegisterId) {
Expand All @@ -918,7 +919,8 @@ void ExecutionEngine::initializeConstValueBlock(
TRI_ASSERT(!value.isNone());
// the constValueBlock takes ownership, so we have to create a
// copy here.
block->emplaceValue(0, reg.value(), AqlValue(value.slice()));
block->emplaceValue(0, reg.value(),
AqlValue(value.slice(), 0, rm));
}
} else if (var->type() == Variable::Type::BindParameter) {
RegisterId reg = regPlan->variableToOptionalRegisterId(var->id);
Expand All @@ -927,8 +929,7 @@ void ExecutionEngine::initializeConstValueBlock(
if (slice.isNone()) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_QUERY_BIND_PARAMETER_MISSING);
}

block->emplaceValue(0, reg.value(), AqlValue(slice));
block->emplaceValue(0, reg.value(), AqlValue(slice, 0, rm));
}
}
});
Expand Down
8 changes: 5 additions & 3 deletions arangod/Aql/ExecutionPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,9 @@ ExecutionNode* ExecutionPlan::createCalculation(Variable* out,
// soon, leaving us with an AqlValue with a dangling pointer!
bool mustDestroy; // can be ignored here; the variable takes ownership of
// the value.
ResourceMonitor* rm = &getAst()->query().resourceMonitor();
out->setConstantValue(
AqlValue(expr->execute(&exprContext, mustDestroy).slice()));
AqlValue(expr->execute(&exprContext, mustDestroy).slice(), 0, rm));
}

CalculationNode* en =
Expand Down Expand Up @@ -2373,19 +2374,20 @@ ExecutionNode* ExecutionPlan::fromNodeWindow(ExecutionNode* previous,
}

bool mustDestroy = false;
ResourceMonitor* rm = &getAst()->query().resourceMonitor();
if (name == "preceding") {
Expression expr(_ast, value);
AqlValue val = expr.execute(&exprContext, mustDestroy);
if (!mustDestroy && val.isPointer()) { // force a copy
preceding = AqlValue(val.slice());
preceding = AqlValue(val.slice(), 0, rm);
} else {
preceding = val.clone();
}
} else if (name == "following") {
Expression expr(_ast, value);
AqlValue val = expr.execute(&exprContext, mustDestroy);
if (!mustDestroy && val.isPointer()) { // force a copy
following = AqlValue(val.slice());
following = AqlValue(val.slice(), 0, rm);
} else {
following = val.clone();
}
Expand Down