github-actions[bot] commented on code in PR #65695:
URL: https://github.com/apache/doris/pull/65695#discussion_r3712114760
##########
be/src/runtime/query_context.cpp:
##########
@@ -157,33 +157,38 @@ QueryContext::QueryContext(TUniqueId query_id, ExecEnv*
exec_env,
}
void QueryContext::_init_query_mem_tracker() {
+ // If user not set query limit, will use default 1TB memory limit. It is
large enough to cover most cases.
+ constexpr int64_t DEFAULT_QUERY_MEM_LIMIT = 1LL << 60;
bool has_query_mem_limit = _query_options.__isset.mem_limit &&
(_query_options.mem_limit > 0);
- int64_t bytes_limit = has_query_mem_limit ? _query_options.mem_limit : -1;
- if (bytes_limit > MemInfo::mem_limit() || bytes_limit == -1) {
- VLOG_NOTICE << "Query memory limit " <<
PrettyPrinter::print(bytes_limit, TUnit::BYTES)
+ int64_t user_set_mem_limit =
+ has_query_mem_limit ? _query_options.mem_limit :
DEFAULT_QUERY_MEM_LIMIT;
+ int64_t adjusted_mem_limit = user_set_mem_limit;
+ if (adjusted_mem_limit > MemInfo::mem_limit()) {
+ VLOG_NOTICE << "Query memory limit "
+ << PrettyPrinter::print(user_set_mem_limit, TUnit::BYTES)
<< " exceeds process memory limit of "
<< PrettyPrinter::print(MemInfo::mem_limit(), TUnit::BYTES)
- << " OR is -1. Using process memory limit instead.";
- bytes_limit = MemInfo::mem_limit();
+ << ". Using process memory limit instead.";
+ adjusted_mem_limit = MemInfo::mem_limit();
}
// If the query is a pure load task(streamload, routine load, group
commit), then it should not use
// memlimit per query to limit their memory usage.
if (is_pure_load_task()) {
- bytes_limit = MemInfo::mem_limit();
Review Comment:
[P1] Refresh the process-derived cap for pure loads
This assigns the current process cap only at query creation, but the
periodic updater later skips every `is_pure_load_task()` context. A
stream/routine/group-commit load created under a 256 MiB cgroup therefore keeps
a 256 MiB tracker after a valid expansion to 1 GiB (and Nereids stream/routine
loads leave tracker limit checks enabled), so it can still fail at the obsolete
cap even though the process and workload-group limits increased. A contraction
likewise leaves a stale high tracker cap. Please refresh pure-load trackers to
the current process-derived limit in a branch separate from slot weighting, and
cover both expansion and contraction.
--
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]