cambyzju commented on code in PR #11930:
URL: https://github.com/apache/doris/pull/11930#discussion_r949965981
##########
be/src/runtime/memory/mem_tracker_limiter.h:
##########
@@ -87,11 +87,16 @@ class MemTrackerLimiter final : public MemTracker {
_limit = limit;
}
bool limit_exceeded() const { return _limit >= 0 && _limit <
consumption(); }
+ // means that the memory usage of the query has exceeded 90% of the mem
limit.
+ // It is expected to wait for the memory to be released to continue.
Otherwise,
+ // the exceeded mem limit may occur, and the query will be canceled.
+ bool soft_limit_exceeded() const { return _limit >= 0 && _limit * 0.9 <
consumption(); }
// Returns true if a valid limit of this tracker limiter or one of its
ancestors is exceeded.
- bool any_limit_exceeded() const {
+ template <bool SOFT>
+ bool any_limit_exceeded() {
for (const auto& tracker : _limited_ancestors) {
- if (tracker->limit_exceeded()) {
+ if (SOFT ? tracker->soft_limit_exceeded() :
tracker->limit_exceeded()) {
Review Comment:
```suggestion
if constexpr (SOFT) {
return tracker->soft_limit_exceeded();
} else {
return tracker->limit_exceeded();
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]