Skip to content

Commit

Permalink
[Improment]Reset workload group's default value (#43942)
Browse files Browse the repository at this point in the history
1 set  cpu_share and memory_limit's default value to -1.
2 unify error message when workload group's value is invalid.
  • Loading branch information
wangbo authored Nov 18, 2024
1 parent 122b22f commit e4a7464
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 155 deletions.
12 changes: 7 additions & 5 deletions be/src/runtime/workload_group/workload_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,19 +345,19 @@ WorkloadGroupInfo WorkloadGroupInfo::parse_topic_info(

// 4 cpu_share
uint64_t cpu_share = CgroupCpuCtl::cpu_soft_limit_default_value();
if (tworkload_group_info.__isset.cpu_share) {
if (tworkload_group_info.__isset.cpu_share && tworkload_group_info.cpu_share > 0) {
cpu_share = tworkload_group_info.cpu_share;
}

// 5 cpu hard limit
int cpu_hard_limit = CPU_HARD_LIMIT_DEFAULT_VALUE;
if (tworkload_group_info.__isset.cpu_hard_limit) {
if (tworkload_group_info.__isset.cpu_hard_limit && tworkload_group_info.cpu_hard_limit > 0) {
cpu_hard_limit = tworkload_group_info.cpu_hard_limit;
}

// 6 mem_limit
std::string mem_limit_str = MEMORY_LIMIT_DEFAULT_VALUE;
if (tworkload_group_info.__isset.mem_limit) {
if (tworkload_group_info.__isset.mem_limit && tworkload_group_info.mem_limit != "-1") {
mem_limit_str = tworkload_group_info.mem_limit;
}
bool is_percent = true;
Expand Down Expand Up @@ -410,13 +410,15 @@ WorkloadGroupInfo WorkloadGroupInfo::parse_topic_info(

// 14 scan io
int read_bytes_per_second = -1;
if (tworkload_group_info.__isset.read_bytes_per_second) {
if (tworkload_group_info.__isset.read_bytes_per_second &&
tworkload_group_info.read_bytes_per_second > 0) {
read_bytes_per_second = tworkload_group_info.read_bytes_per_second;
}

// 15 remote scan io
int remote_read_bytes_per_second = -1;
if (tworkload_group_info.__isset.remote_read_bytes_per_second) {
if (tworkload_group_info.__isset.remote_read_bytes_per_second &&
tworkload_group_info.remote_read_bytes_per_second > 0) {
remote_read_bytes_per_second = tworkload_group_info.remote_read_bytes_per_second;
}

Expand Down
Loading

0 comments on commit e4a7464

Please sign in to comment.