-
Notifications
You must be signed in to change notification settings - Fork 863
Feature/collect resource monitor #21930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
… double counting, add test (must format)
…ge-resource-monitor
…ge-resource-monitor
…ge-resource-monitor
…ge-resource-monitor
…ally in the supervised buffer
…ge-resource-monitor
…ge-resource-monitor
…feature/merge-resource-monitor
…arangodb into feature/merge-resource-monitor
…s argument to helper function, format, fix wrong method call in header
…ge-resource-monitor
…structor because of usage scope's default constructor demanding a monitor, fix order in CMakeLists
…feature/merge-resource-monitor
…ge-resource-monitor
…feature/merge-resource-monitor
… instead of ResourceUsageScope&
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is on a very good way I like it !!
I have left some feedback comments.
arangod/Aql/Aggregator.h
Outdated
|
||
// static std::unique_ptr<Aggregator> fromTypeString(velocypack::Options | ||
// const*, | ||
// std::string_view type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// static std::unique_ptr<Aggregator> fromTypeString(velocypack::Options | |
// const*, | |
// std::string_view type); |
just remove this, we can always go back with git history.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted.
arangod/Aql/Aggregator.h
Outdated
protected: | ||
velocypack::Options const* _vpackOptions; | ||
ResourceMonitor& _resourceMonitor; | ||
std::unique_ptr<ResourceUsageScope> _usageScope; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::unique_ptr<ResourceUsageScope> _usageScope; | |
ResourceUsageScope _usageScope; |
This should be enough right?
We will perform counters to usage scope often, so having the pointer indirection will have some performance impact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Changed to an object by value.
arangod/Aql/AqlValue.h
Outdated
@@ -28,8 +28,10 @@ | |||
#include "Aql/RegisterId.h" | |||
#include "Aql/RegIdFlatSet.h" | |||
#include "Basics/Endian.h" | |||
#include "Basics/ResourceUsage.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include those in the files where it actually is needed.
AqlValue.h is Imported into many places so we would need to recompile a lot if any of those imports change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted. AqlValue.h
doesn't use this header file.
#include "IResearch/Misc.h" | ||
|
||
#include <velocypack/Builder.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include those in the files where it actually is needed.
AqlValue.h is Imported into many places so we would need to recompile a lot if any of those imports change.
@@ -37,6 +37,7 @@ | |||
#include "Aql/WalkerWorker.h" | |||
#include "Transaction/Methods.h" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file looks good 👍
arangod/Aql/Aggregator.cpp
Outdated
@@ -205,7 +212,9 @@ struct AggregatorMax final : public Aggregator { | |||
void reduce(AqlValue const& cmpValue) override { | |||
if (value.isEmpty() || | |||
AqlValue::Compare(_vpackOptions, value, cmpValue, true) < 0) { | |||
resourceUsageScope().decrease(value.memoryUsage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
: Aggregator(opts, monitor), | ||
allocator(1024), | ||
seen(_vpackOptions), | ||
builder(std::make_shared<velocypack::SupervisedBuffer>(monitor)) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the changes here get rather straight forward.
@@ -776,6 +809,7 @@ struct AggregatorCountDistinct : public Aggregator { | |||
return; | |||
} | |||
|
|||
resourceUsageScope().increase(s.byteSize()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good 👍
please make rue the resourceUsageScope is reverted when seen is cleared above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -842,6 +887,7 @@ struct AggregatorCountDistinctStep2 final : public AggregatorCountDistinct { | |||
continue; | |||
} | |||
|
|||
resourceUsageScope().increase(it.byteSize()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again reset on clear()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Aggregator uses AggregatorCountDistinct
's reset()
, which is final
.
arangod/Aql/Aggregator.cpp
Outdated
@@ -988,8 +1043,8 @@ struct AggregatorList : public Aggregator { | |||
// if preceding is `unbounded`. But closing the array here breaks the | |||
// velocypack slice. | |||
auto builderCopy = builder; | |||
builderCopy.close(); | |||
return AqlValue(std::move(*builderCopy.steal())); | |||
AqlValue a{std::move(*builderCopy.steal())}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the builderCopy not be closed anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted to the original code where builderCopy is closed.
Scope & Purpose
Adding memory monitoring mechanism to COLLECT method.
Checklist
Related Information
(Please reference tickets / specification / other PRs etc)