🌐 AI搜索 & 代理 主页
Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
4695ddc
Add resource monitor as argument to AqlValue
cpjulia Nov 14, 2025
8bf38cf
Format and add getter for resource monitor in Functions
cpjulia Nov 14, 2025
b3f570c
Add ResourceMonitor to ComputedValuesExpressionContext; Add getResour…
knakatasf Nov 14, 2025
f4c98a3
Fix compilation errors
cpjulia Nov 17, 2025
7c96a1c
Fix compilation errors
cpjulia Nov 17, 2025
ac12386
Add resource monitor to AqlValue ctor call
cpjulia Nov 17, 2025
a80de9d
Add resource monitor to IResearch callers that need to pass it
cpjulia Nov 17, 2025
4b44e5a
Add ResourceMonitor* to DecayFunctions.cpp DistanceFunctions.cpp Dist…
knakatasf Nov 17, 2025
6132af1
Add resource monitor to remaining IResearh files
cpjulia Nov 17, 2025
349c88d
Add ResourceMonitor* to those Functions
knakatasf Nov 17, 2025
a21a067
Change signature of convertToObject() of DistributeFunctions.cpp; Pas…
knakatasf Nov 17, 2025
98875a2
Add ResourceMonitor* to ComputedValues.cpp
knakatasf Nov 17, 2025
69bf641
Add ResourceMonitor* to Expression.cpp
knakatasf Nov 18, 2025
f725133
Add monitor to expression contexts
cpjulia Nov 18, 2025
bf3392e
Add monitor to expression
cpjulia Nov 18, 2025
2c5d770
Fix monitor usage in Expression, already had as member
cpjulia Nov 18, 2025
0c9e57a
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Nov 18, 2025
d5c571e
Add monitor usage to LateMaterializedExpressionContext
cpjulia Nov 18, 2025
f62f392
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Nov 18, 2025
1617e38
Add access to monitor in Variable
cpjulia Nov 19, 2025
2f49ac3
Add rm to missing ctor callers
cpjulia Nov 19, 2025
7692c69
Correct complier errors for Expression.cpp; Add ResourceMonitor* to C…
knakatasf Nov 19, 2025
42855b2
Format code
knakatasf Nov 19, 2025
5e0b8f4
Fixed typos
cpjulia Nov 19, 2025
a5ceec2
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Nov 19, 2025
d12b34d
Attempt to fix memory leak failure
cpjulia Nov 21, 2025
371dc5b
Add check for nullptr
cpjulia Nov 21, 2025
aecb218
Added monitor support to tests
cpjulia Nov 22, 2025
b0b9ac7
Brought back wrong logic of hashing
cpjulia Nov 23, 2025
34bb289
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sup…
cpjulia Nov 23, 2025
4b58613
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Nov 30, 2025
3eef984
Change cloneDataAndMoveShadow to always steal the guard
cpjulia Nov 30, 2025
720ee57
Added fix for use-after-free in cloneDataAndMoveShadow
cpjulia Dec 1, 2025
bfc9715
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 1, 2025
ac2c304
Add special case for supervised slice in cloneDataAndMoveShadow
cpjulia Dec 1, 2025
7ea92bf
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 1, 2025
0f42608
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 1, 2025
1fe66cb
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 2, 2025
d7e9d31
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 2, 2025
049fe01
Remove special case for supervised slice from cloneDataAndMoveShadow
cpjulia Dec 2, 2025
8cad3f7
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 3, 2025
8ad3a1f
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 3, 2025
6e64bde
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 3, 2025
8222211
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 3, 2025
788a006
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 4, 2025
a464c41
Merge remote-tracking branch 'origin/devel' into feature/supervised-a…
cpjulia Dec 4, 2025
7c01568
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 4, 2025
9e56a4f
Merge branch 'feature/supervised-aql-functions' of github.com:arangod…
cpjulia Dec 4, 2025
16d876f
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 5, 2025
c6d2c9d
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 5, 2025
3ec2380
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 8, 2025
cdcb261
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 9, 2025
2812ca4
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 10, 2025
c76d91f
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 10, 2025
22afa88
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 12, 2025
653a0a4
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 12, 2025
f48b51d
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 15, 2025
77d334e
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 15, 2025
9baaf97
Merge feature/supervised-aql-value
cpjulia Dec 17, 2025
7fe5b98
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 17, 2025
2e7fad9
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 17, 2025
a568a4c
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 19, 2025
93aa007
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 19, 2025
03990ca
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sup…
cpjulia Dec 26, 2025
fea5260
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 27, 2025
fe5df62
Merge branch 'feature/supervised-aql-functions' of github.com:arangod…
cpjulia Dec 27, 2025
d6f55ac
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 28, 2025
a3f7c23
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjulia Dec 28, 2025
a072225
Merge branch 'feature/supervised-aql-functions' of github.com:arangod…
cpjulia Dec 28, 2025
b0e8451
Fixed wrong constructor call passing length 0 after fix in supervised…
cpjulia Dec 28, 2025
6701294
Fix wrong constructor call that passed length 0, also made the ctor c…
cpjulia Dec 29, 2025
aeb2cd2
Fix wrong constructor call that passed length 0, also made the ctor c…
cpjulia Dec 29, 2025
46a6094
Another round of passing the length in the ctor instead of 0 and the rm*
cpjulia Dec 29, 2025
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
8 changes: 5 additions & 3 deletions arangod/Aql/Function/DistributeFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void buildKeyObject(VPackBuilder& builder, std::string_view key,

AqlValue convertToObject(transaction::Methods& trx, VPackSlice input,
bool allowKeyConversionToObject, bool canUseCustomKey,
bool ignoreErrors) {
bool ignoreErrors, ResourceMonitor* rm = nullptr) {
// input is not an object.
// if this happens, it must be a string key
if (!input.isString() || !allowKeyConversionToObject) {
Expand Down Expand Up @@ -102,8 +102,9 @@ AqlValue functions::MakeDistributeInput(
flags["allowKeyConversionToObject"].getBool();
bool canUseCustomKey = flags["canUseCustomKey"].getBool();
bool ignoreErrors = flags["ignoreErrors"].getBool();
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();
return convertToObject(trx, input, allowKeyConversionToObject,
canUseCustomKey, ignoreErrors);
canUseCustomKey, ignoreErrors, rm);
}
TRI_ASSERT(input.isObject());

Expand Down Expand Up @@ -163,7 +164,8 @@ AqlValue functions::MakeDistributeInputWithKeyCreation(

VPackSlice input = value.slice(); // will throw when wrong type
if (!input.isObject()) {
return convertToObject(trx, input, true, canUseCustomKey, ignoreErrors);
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();
return convertToObject(trx, input, true, canUseCustomKey, ignoreErrors, rm);
}

TRI_ASSERT(input.isObject());
Expand Down
12 changes: 9 additions & 3 deletions arangod/Aql/Function/EncodingFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ AqlValue functions::ToBase64(ExpressionContext* expr, AstNode const&,

std::string encoded = absl::Base64Escape({buffer->data(), buffer->length()});

return AqlValue(std::move(encoded));
ResourceMonitor* rm = expr->getResourceMonitorPtr();

return AqlValue(std::move(encoded), rm);
}

/// @brief function TO_HEX
Expand All @@ -74,7 +76,9 @@ AqlValue functions::ToHex(ExpressionContext* expr, AstNode const&,
std::string encoded =
basics::StringUtils::encodeHex(buffer->data(), buffer->length());

return AqlValue(encoded);
ResourceMonitor* rm = expr->getResourceMonitorPtr();

return AqlValue(encoded, rm);
}

/// @brief function ENCODE_URI_COMPONENT
Expand All @@ -91,7 +95,9 @@ AqlValue functions::EncodeURIComponent(ExpressionContext* expr, AstNode const&,
std::string encoded =
basics::StringUtils::encodeURIComponent(buffer->data(), buffer->length());

return AqlValue(encoded);
ResourceMonitor* rm = expr->getResourceMonitorPtr();

return AqlValue(encoded, rm);
}

} // namespace arangodb::aql
12 changes: 8 additions & 4 deletions arangod/Aql/Function/InformationFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,31 @@ using namespace arangodb;
namespace arangodb::aql {

/// @brief function CURRENT_USER
AqlValue functions::CurrentUser(ExpressionContext*, AstNode const&,
AqlValue functions::CurrentUser(ExpressionContext* expressionContext,
AstNode const&,
VPackFunctionParametersView parameters) {
std::string const& username = ExecContext::current().user();
if (username.empty()) {
return AqlValue(AqlValueHintNull());
}
return AqlValue(username);
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();
return AqlValue(username, rm);
}

/// @brief function CURRENT_DATABASE
AqlValue functions::CurrentDatabase(ExpressionContext* expressionContext,
AstNode const&,
VPackFunctionParametersView parameters) {
return AqlValue(expressionContext->vocbase().name());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();
return AqlValue(expressionContext->vocbase().name(), rm);
}

/// @brief function VERSION
AqlValue functions::Version(ExpressionContext* expressionContext,
AstNode const&,
VPackFunctionParametersView parameters) {
return AqlValue(rest::Version::getServerVersion());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();
return AqlValue(rest::Version::getServerVersion(), rm);
}

} // namespace arangodb::aql
5 changes: 3 additions & 2 deletions arangod/Aql/Function/RandomFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ AqlValue functions::Rand(ExpressionContext*, AstNode const&,
}

/// @brief function RANDOM_TOKEN
AqlValue functions::RandomToken(ExpressionContext*, AstNode const&,
AqlValue functions::RandomToken(ExpressionContext* expr, AstNode const&,
VPackFunctionParametersView parameters) {
AqlValue const& value =
aql::functions::extractFunctionParameterValue(parameters, 0);
Expand All @@ -54,9 +54,10 @@ AqlValue functions::RandomToken(ExpressionContext*, AstNode const&,
TRI_ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH, "RANDOM_TOKEN");
}

ResourceMonitor* rm = expr->getResourceMonitorPtr();
UniformCharacter generator(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
return AqlValue(generator.random(static_cast<size_t>(length)));
return AqlValue(generator.random(static_cast<size_t>(length)), rm);
}

} // namespace arangodb::aql
6 changes: 4 additions & 2 deletions arangod/Aql/Function/StatisticsFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,8 @@ AqlValue functions::Min(ExpressionContext* expressionContext, AstNode const&,
if (minValue.isNone()) {
return AqlValue(AqlValueHintNull());
}
return AqlValue(minValue);
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();
return AqlValue(minValue, 0, rm);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AqlValue constructor called with invalid zero length argument

The AqlValue 3-argument constructor AqlValue(VPackSlice, ValueLength, ResourceMonitor*) contains TRI_ASSERT(length >= 1) at line 1397 of AqlValue.cpp. Multiple locations in this diff pass 0 as the length parameter (e.g., AqlValue(minValue, 0, rm)), which will trigger this assertion in debug builds and may cause undefined behavior in release builds. The correct approach is to either use the 2-argument constructor AqlValue(slice, rm) which automatically computes slice.byteSize(), or pass the actual byte size instead of 0. This affects Min, Max functions, QueryExpressionContext, IResearchExpressionContext, IResearchFeature, Variable, and DistributeFunctions.

Additional Locations (2)

Fix in Cursor Fix in Web

}

/// @brief function MAX
Expand Down Expand Up @@ -507,7 +508,8 @@ AqlValue functions::Max(ExpressionContext* expressionContext, AstNode const&,
if (maxValue.isNone()) {
return AqlValue(AqlValueHintNull());
}
return AqlValue(maxValue);
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();
return AqlValue(maxValue, 0, rm);
}

/// @brief function SUM
Expand Down
5 changes: 3 additions & 2 deletions arangod/Aql/Function/TypeCheckFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ AqlValue functions::IsObject(ExpressionContext*, AstNode const&,
}

/// @brief function TYPENAME
AqlValue functions::Typename(ExpressionContext*, AstNode const&,
AqlValue functions::Typename(ExpressionContext* expr, AstNode const&,
VPackFunctionParametersView parameters) {
AqlValue const& value = extractFunctionParameterValue(parameters, 0);
return AqlValue(value.getTypeString());
ResourceMonitor* rm = expr->getResourceMonitorPtr();
return AqlValue(value.getTypeString(), rm);
}

} // namespace arangodb::aql
5 changes: 3 additions & 2 deletions arangod/Aql/Function/UuidFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static std::mutex uuidMutex;
} // namespace

/// @brief function UUID
AqlValue functions::Uuid(ExpressionContext*, AstNode const&,
AqlValue functions::Uuid(ExpressionContext* expr, AstNode const&,
VPackFunctionParametersView parameters) {
boost::uuids::uuid uuid;
{
Expand All @@ -58,7 +58,8 @@ AqlValue functions::Uuid(ExpressionContext*, AstNode const&,
uuid = boost::uuids::random_generator()();
}

return AqlValue(boost::uuids::to_string(uuid));
ResourceMonitor* rm = expr->getResourceMonitorPtr();
return AqlValue(boost::uuids::to_string(uuid), rm);
}

} // namespace arangodb::aql
4 changes: 3 additions & 1 deletion arangod/VocBase/ComputedValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <span>
#include <string_view>
#include <type_traits>
#include <immer/detail/combine_standard_layout.hpp>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally included unrelated immer internal header

The #include <immer/detail/combine_standard_layout.hpp> appears to be accidentally committed. This is an internal implementation header from the immer library that is not used anywhere in ComputedValues.cpp. The changes in this file are about adding ResourceMonitor support and this include is completely unrelated. Including internal/detail headers directly is generally discouraged and this looks like leftover code from development.

Fix in Cursor Fix in Web


namespace {
// name of bind parameter variable that contains the current document
Expand Down Expand Up @@ -147,7 +148,8 @@ aql::AqlValue ComputedValuesExpressionContext::getVariableValue(
return aql::AqlValue(aql::AqlValueHintNull());
}
if (doCopy) {
return aql::AqlValue(aql::AqlValueHintSliceCopy(it->second));
return aql::AqlValue(aql::AqlValueHintSliceCopy(it->second),
getResourceMonitorPtr());
}
return aql::AqlValue(aql::AqlValueHintSliceNoCopy(it->second));
}
Expand Down