github-actions[bot] commented on code in PR #24975:
URL: https://github.com/apache/doris/pull/24975#discussion_r1338391536
##########
be/src/runtime/memory/mem_tracker_limiter.cpp:
##########
@@ -512,9 +518,18 @@
COUNTER_SET(seek_tasks_counter, (int64_t)0);
COUNTER_SET(previously_canceling_tasks_counter, (int64_t)0);
+ std::string log_prefix = fmt::format("[MemoryGC] GC free {} top memory
overcommit {}, ",
Review Comment:
warning: variable 'log_prefix' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::string log_prefix = 0 = fmt::format("[MemoryGC] GC free {} top
memory overcommit {}, ",
```
##########
be/src/runtime/memory/mem_tracker_limiter.cpp:
##########
@@ -323,36 +325,31 @@ std::string
MemTrackerLimiter::process_limit_exceeded_errmsg_str() {
std::string MemTrackerLimiter::process_soft_limit_exceeded_errmsg_str() {
return fmt::format(
- "process memory used {} exceed soft limit {} or sys mem available
{} less than warning "
- "water mark {}.",
+ "process memory used {} exceed soft limit {} or sys available
memory {} less than "
+ "warning water mark {}.",
PerfCounters::get_vm_rss_str(), MemInfo::soft_mem_limit_str(),
MemInfo::sys_mem_available_str(),
PrettyPrinter::print(MemInfo::sys_mem_available_warning_water_mark(),
TUnit::BYTES));
}
-std::string MemTrackerLimiter::query_tracker_limit_exceeded_str(
- const std::string& tracker_limit_exceeded, const std::string&
last_consumer_tracker,
- const std::string& executing_msg) {
- return fmt::format(
- "Memory limit exceeded:{}, exec node:<{}>, execute msg:{}. backend
{} "
- "process memory used {}, limit {}. Can `set "
- "exec_mem_limit=8G` to change limit, details see be.INFO.",
- tracker_limit_exceeded, last_consumer_tracker, executing_msg,
- BackendOptions::get_localhost(), PerfCounters::get_vm_rss_str(),
- MemInfo::mem_limit_str());
-}
-
std::string MemTrackerLimiter::tracker_limit_exceeded_str() {
- return fmt::format(
- "exceeded tracker:<{}>, limit {}, peak "
- "used {}, current used {}",
- label(), print_bytes(limit()),
print_bytes(_consumption->peak_value()),
- print_bytes(_consumption->current_value()));
-}
-
-std::string MemTrackerLimiter::tracker_limit_exceeded_str(int64_t bytes) {
- return fmt::format("failed alloc size {}, {}", print_bytes(bytes),
- tracker_limit_exceeded_str());
+ std::string err_msg = fmt::format(
Review Comment:
warning: variable 'err_msg' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::string err_msg = 0 = fmt::format(
```
##########
be/src/runtime/memory/mem_tracker_limiter.cpp:
##########
@@ -607,28 +620,77 @@
}
int64_t freed_mem = 0;
- constexpr auto query_type = MemTrackerLimiter::Type::QUERY;
- auto cancel_str = [id, &name, memory_limit, used_memory](int64_t
mem_consumption,
- const
std::string& label) {
+
+ std::string cancel_str = fmt::format(
+ "work load group memory exceeded limit, group id:{}, name:{},
used:{}, limit:{}, "
+ "backend:{}.",
+ id, name, MemTracker::print_bytes(used_memory),
MemTracker::print_bytes(memory_limit),
+ BackendOptions::get_localhost());
+ auto cancel_top_overcommit_str = [cancel_str](int64_t mem_consumption,
+ const std::string& label) {
+ return fmt::format(
+ "{} cancel top memory overcommit tracker <{}> consumption {}.
execute again after "
+ "enough memory, details see be.INFO.",
+ cancel_str, label, MemTracker::print_bytes(mem_consumption));
+ };
+ auto cancel_top_usage_str = [cancel_str](int64_t mem_consumption, const
std::string& label) {
return fmt::format(
- "Resource group id:{}, name:{} memory exceeded limit, cancel
top memory {}: "
- "memory tracker <{}> consumption {}, backend {}, "
- "resource group memory used {}, memory limit {}.",
- id, name, MemTrackerLimiter::type_string(query_type), label,
- MemTracker::print_bytes(mem_consumption),
BackendOptions::get_localhost(),
- MemTracker::print_bytes(used_memory),
MemTracker::print_bytes(memory_limit));
+ "{} cancel top memory used tracker <{}> consumption {}.
execute again after "
+ "enough memory, details see be.INFO.",
+ cancel_str, label, MemTracker::print_bytes(mem_consumption));
};
+
+ LOG(INFO) << fmt::format(
+ "[MemoryGC] work load group start gc, id:{} name:{}, memory limit:
{}, used: {}, "
+ "need_free_mem: {}.",
+ id, name, memory_limit, used_memory, need_free_mem);
+ Defer defer {[&]() {
+ LOG(INFO) << fmt::format(
+ "[MemoryGC] work load group finished gc, id:{} name:{}, memory
limit: {}, used: "
+ "{}, need_free_mem: {}, freed memory: {}.",
+ id, name, memory_limit, used_memory, need_free_mem, freed_mem);
+ }};
+
+ // 1. free top overcommit query
if (config::enable_query_memory_overcommit) {
+ RuntimeProfile* tmq_profile = profile->create_child(
+ fmt::format("FreeGroupTopOvercommitQuery:Name {}", name),
true, true);
freed_mem += MemTrackerLimiter::free_top_overcommit_query(
- need_free_mem - freed_mem, query_type, tracker_limiter_groups,
cancel_str, profile);
+ need_free_mem - freed_mem, MemTrackerLimiter::Type::QUERY,
tracker_limiter_groups,
+ cancel_top_overcommit_str, tmq_profile,
GCType::WORK_LOAD_GROUP);
}
- if (freed_mem < need_free_mem) {
- freed_mem += MemTrackerLimiter::free_top_memory_query(
- need_free_mem - freed_mem, query_type, tracker_limiter_groups,
cancel_str, profile);
+ if (freed_mem >= need_free_mem) {
+ return freed_mem;
}
- LOG(INFO) << fmt::format(
- "task group {} finished gc, memory_limit: {}, used_memory: {},
freed_mem: {}.", name,
- memory_limit, used_memory, freed_mem);
+
+ // 2. free top usage query
+ RuntimeProfile* tmq_profile =
Review Comment:
warning: variable 'tmq_profile' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
RuntimeProfile* tmq_profile = nullptr =
```
##########
be/src/runtime/memory/mem_tracker_limiter.cpp:
##########
@@ -607,28 +620,77 @@
}
int64_t freed_mem = 0;
- constexpr auto query_type = MemTrackerLimiter::Type::QUERY;
- auto cancel_str = [id, &name, memory_limit, used_memory](int64_t
mem_consumption,
- const
std::string& label) {
+
+ std::string cancel_str = fmt::format(
+ "work load group memory exceeded limit, group id:{}, name:{},
used:{}, limit:{}, "
+ "backend:{}.",
+ id, name, MemTracker::print_bytes(used_memory),
MemTracker::print_bytes(memory_limit),
+ BackendOptions::get_localhost());
+ auto cancel_top_overcommit_str = [cancel_str](int64_t mem_consumption,
+ const std::string& label) {
+ return fmt::format(
+ "{} cancel top memory overcommit tracker <{}> consumption {}.
execute again after "
+ "enough memory, details see be.INFO.",
+ cancel_str, label, MemTracker::print_bytes(mem_consumption));
+ };
+ auto cancel_top_usage_str = [cancel_str](int64_t mem_consumption, const
std::string& label) {
return fmt::format(
- "Resource group id:{}, name:{} memory exceeded limit, cancel
top memory {}: "
- "memory tracker <{}> consumption {}, backend {}, "
- "resource group memory used {}, memory limit {}.",
- id, name, MemTrackerLimiter::type_string(query_type), label,
- MemTracker::print_bytes(mem_consumption),
BackendOptions::get_localhost(),
- MemTracker::print_bytes(used_memory),
MemTracker::print_bytes(memory_limit));
+ "{} cancel top memory used tracker <{}> consumption {}.
execute again after "
+ "enough memory, details see be.INFO.",
+ cancel_str, label, MemTracker::print_bytes(mem_consumption));
};
+
+ LOG(INFO) << fmt::format(
+ "[MemoryGC] work load group start gc, id:{} name:{}, memory limit:
{}, used: {}, "
+ "need_free_mem: {}.",
+ id, name, memory_limit, used_memory, need_free_mem);
+ Defer defer {[&]() {
+ LOG(INFO) << fmt::format(
+ "[MemoryGC] work load group finished gc, id:{} name:{}, memory
limit: {}, used: "
+ "{}, need_free_mem: {}, freed memory: {}.",
+ id, name, memory_limit, used_memory, need_free_mem, freed_mem);
+ }};
+
+ // 1. free top overcommit query
if (config::enable_query_memory_overcommit) {
+ RuntimeProfile* tmq_profile = profile->create_child(
Review Comment:
warning: variable 'tmq_profile' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
RuntimeProfile* tmq_profile = nullptr = profile->create_child(
```
##########
be/src/runtime/memory/mem_tracker_limiter.cpp:
##########
@@ -397,9 +394,18 @@
COUNTER_SET(seek_tasks_counter, (int64_t)0);
COUNTER_SET(previously_canceling_tasks_counter, (int64_t)0);
+ std::string log_prefix = fmt::format("[MemoryGC] GC free {} top memory
used {}, ",
Review Comment:
warning: variable 'log_prefix' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::string log_prefix = 0 = fmt::format("[MemoryGC] GC free {} top
memory used {}, ",
```
##########
be/src/runtime/memory/mem_tracker_limiter.cpp:
##########
@@ -607,28 +620,77 @@
}
int64_t freed_mem = 0;
- constexpr auto query_type = MemTrackerLimiter::Type::QUERY;
- auto cancel_str = [id, &name, memory_limit, used_memory](int64_t
mem_consumption,
- const
std::string& label) {
+
+ std::string cancel_str = fmt::format(
Review Comment:
warning: variable 'cancel_str' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::string cancel_str = 0 = fmt::format(
```
--
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]