github-actions[bot] commented on code in PR #42418:
URL: https://github.com/apache/doris/pull/42418#discussion_r1814745154
##########
be/src/runtime/workload_group/workload_group.cpp:
##########
@@ -255,6 +255,91 @@
_mem_tracker_limiter_pool[group_num].trackers.end(),
mem_tracker_ptr);
}
+int64_t WorkloadGroup::free_overcommited_memory(int64_t need_free_mem,
RuntimeProfile* profile) {
Review Comment:
warning: function 'free_overcommited_memory' exceeds recommended
size/complexity thresholds [readability-function-size]
```cpp
int64_t WorkloadGroup::free_overcommited_memory(int64_t need_free_mem,
RuntimeProfile* profile) {
^
```
<details>
<summary>Additional context</summary>
**be/src/runtime/workload_group/workload_group.cpp:257:** 83 lines including
whitespace and comments (threshold 80)
```cpp
int64_t WorkloadGroup::free_overcommited_memory(int64_t need_free_mem,
RuntimeProfile* profile) {
^
```
</details>
##########
be/src/runtime/workload_group/workload_group_manager.cpp:
##########
@@ -264,43 +262,27 @@ void WorkloadGroupMgr::add_paused_query(const
std::shared_ptr<QueryContext>& que
}
}
-/**
- * 1. When Process's memory is lower than soft limit, then all workload group
will be converted to hard limit (Exception: there is only one workload group).
- * 2. Reserve logic for workload group that is soft limit take no effect, it
will always return success.
- * 3. QueryLimit for streamload,routineload,group commit, take no affect, it
will always return success, but workload group's hard limit will take affect.
- * 4. See handle_non_overcommit_wg_paused_queries for hard limit logic.
- */
-void WorkloadGroupMgr::handle_paused_queries() {
- handle_non_overcommit_wg_paused_queries();
- handle_overcommit_wg_paused_queries();
-}
-
/**
* Strategy 1: A revocable query should not have any running
task(PipelineTask).
* strategy 2: If the workload group has any task exceed workload group
memlimit, then set all queryctx's memlimit
* strategy 3: If any query exceed process memlimit, then should clear all
caches.
* strategy 4: If any query exceed query's memlimit, then do spill disk or
cancel it.
* strategy 5: If any query exceed process's memlimit and cache is zero, then
do following:
- * 1. cancel other wg's(soft limit) query that exceed limit
- * 2. spill disk
- * 3. cancel it self.
*/
-void WorkloadGroupMgr::handle_non_overcommit_wg_paused_queries() {
+void WorkloadGroupMgr::handle_paused_queries() {
Review Comment:
warning: function 'handle_paused_queries' exceeds recommended
size/complexity thresholds [readability-function-size]
```cpp
void WorkloadGroupMgr::handle_paused_queries() {
^
```
<details>
<summary>Additional context</summary>
**be/src/runtime/workload_group/workload_group_manager.cpp:271:** 185 lines
including whitespace and comments (threshold 80)
```cpp
void WorkloadGroupMgr::handle_paused_queries() {
^
```
</details>
##########
be/src/runtime/workload_group/workload_group.cpp:
##########
@@ -115,21 +117,18 @@ std::string WorkloadGroup::debug_string() const {
}
bool WorkloadGroup::add_wg_refresh_interval_memory_growth(int64_t size) {
- // If a group is enable memory overcommit, then not need check the limit
- // It is always true, and it will only fail when process memory is not
- // enough.
- if (_enable_memory_overcommit) {
- if (doris::GlobalMemoryArbitrator::is_exceed_soft_mem_limit(size)) {
- return false;
- } else {
- return true;
- }
- }
auto realtime_total_mem_used =
_total_mem_used + _wg_refresh_interval_memory_growth.load() + size;
if ((realtime_total_mem_used >
((double)_memory_limit *
_spill_high_watermark.load(std::memory_order_relaxed) / 100))) {
- return false;
+ // If a group is enable memory overcommit, then not need check the
limit
+ // It is always true, and it will only fail when process memory is not
+ // enough.
+ if (_enable_memory_overcommit) {
+ return true;
Review Comment:
warning: redundant boolean literal in conditional return statement
[readability-simplify-boolean-expr]
be/src/runtime/workload_group/workload_group.cpp:126:
```diff
- if (_enable_memory_overcommit) {
- return true;
- } else {
- return false;
- }
+ return _enable_memory_overcommit;
```
##########
be/src/runtime/workload_group/workload_group_manager.cpp:
##########
@@ -595,7 +641,7 @@
return true;
}
-void WorkloadGroupMgr::update_queries_limit(WorkloadGroupPtr wg, bool
enable_hard_limit) {
+void WorkloadGroupMgr::update_queries_limit_(WorkloadGroupPtr wg, bool
enable_hard_limit) {
Review Comment:
warning: function 'update_queries_limit_' exceeds recommended
size/complexity thresholds [readability-function-size]
```cpp
void WorkloadGroupMgr::update_queries_limit_(WorkloadGroupPtr wg, bool
enable_hard_limit) {
^
```
<details>
<summary>Additional context</summary>
**be/src/runtime/workload_group/workload_group_manager.cpp:643:** 94 lines
including whitespace and comments (threshold 80)
```cpp
void WorkloadGroupMgr::update_queries_limit_(WorkloadGroupPtr wg, bool
enable_hard_limit) {
^
```
</details>
##########
be/src/runtime/workload_group/workload_group.h:
##########
@@ -211,11 +201,9 @@ class WorkloadGroup : public
std::enable_shared_from_this<WorkloadGroup> {
}
int64_t get_remote_scan_bytes_per_second();
- int64_t load_buffer_limit() { return _load_buffer_limit; }
+ int64_t load_buffer_limit() { return _memory_limit * _load_buffer_ratio /
100; }
Review Comment:
warning: method 'load_buffer_limit' can be made const
[readability-make-member-function-const]
```suggestion
int64_t load_buffer_limit() const { return _memory_limit *
_load_buffer_ratio / 100; }
```
--
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]