github-actions[bot] commented on code in PR #32641:
URL: https://github.com/apache/doris/pull/32641#discussion_r1537294093


##########
be/src/runtime/workload_group/workload_group.h:
##########
@@ -82,6 +82,31 @@ class WorkloadGroup : public 
std::enable_shared_from_this<WorkloadGroup> {
 
     int64_t memory_used();
 
+    int spill_threshold_low_water_mark() const {
+        return _spill_low_watermark.load(std::memory_order_relaxed);
+    }
+    int spill_threashold_high_water_mark() const {
+        return _spill_high_watermark.load(std::memory_order_relaxed);
+    }
+
+    void set_weighted_memory_used(int64_t wg_total_mem_used, double ratio);
+
+    std::unordered_set<std::shared_ptr<MemTrackerLimiter>> 
get_all_mem_trackers();
+
+    int64_t get_weighted_memory_used() {
+        return _weighted_mem_used.load(std::memory_order_relaxed);
+    }
+
+    void check_mem_used(bool& is_low_wartermark, bool& is_high_wartermark) {

Review Comment:
   warning: method 'check_mem_used' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static void check_mem_used(bool& is_low_wartermark, bool& 
is_high_wartermark) {
   ```
   



##########
be/src/runtime/workload_group/workload_group_manager.cpp:
##########
@@ -135,6 +137,121 @@ void 
WorkloadGroupMgr::delete_workload_group_by_ids(std::set<uint64_t> used_wg_i
               << "ms, deleted group size:" << deleted_task_groups.size();
 }
 
+struct WorkloadGroupMemInfo {
+    int64_t total_mem_used = 0;
+    int64_t weighted_mem_used = 0;
+    bool is_low_wartermark = false;
+    bool is_high_wartermark = false;
+    double mem_used_ratio = 0;
+};
+void WorkloadGroupMgr::refresh_wg_memory_info() {

Review Comment:
   warning: method 'refresh_wg_memory_info' can be made static 
[readability-convert-member-functions-to-static]
   
   be/src/runtime/workload_group/workload_group_manager.h:56:
   ```diff
   -     void refresh_wg_memory_info();
   +     static void refresh_wg_memory_info();
   ```
   



##########
be/src/pipeline/pipeline_x/pipeline_x_task.cpp:
##########
@@ -326,6 +304,46 @@ Status PipelineXTask::execute(bool* eos) {
     return status;
 }
 
+bool PipelineXTask::should_revoke_memory(RuntimeState* state, int64_t 
revocable_mem_bytes) {
+    auto* query_ctx = state->get_query_ctx();
+    bool need_revoke = query_ctx->query_mem_tracker->need_revoke();
+    if (!need_revoke) {
+        return false;
+    }
+
+    const auto min_revocable_mem_bytes = state->min_revocable_mem();
+
+    auto tg = query_ctx->workload_group();
+    bool is_tg_mem_low_water_mark = false;
+    bool is_tg_mem_high_water_mark = false;
+    if (tg) {
+        tg->check_mem_used(is_tg_mem_low_water_mark, 
is_tg_mem_high_water_mark);
+    }
+    if (is_tg_mem_high_water_mark) {
+        if (revocable_mem_bytes > 1024 * 1024) {
+            LOG_EVERY_N(INFO, 5) << "revoke memory, hight water mark";
+            return true;

Review Comment:
   warning: redundant boolean literal in conditional return statement 
[readability-simplify-boolean-expr]
   
   be/src/pipeline/pipeline_x/pipeline_x_task.cpp:322:
   ```diff
   -         if (revocable_mem_bytes > 1024 * 1024) {
   -             LOG_EVERY_N(INFO, 5) << "revoke memory, hight water mark";
   -             return true;
   -         }
   -         return false;
   +         return revocable_mem_bytes > 1024 * 1024;
   ```
   



##########
be/src/runtime/workload_group/workload_group_manager.cpp:
##########
@@ -135,6 +137,121 @@
               << "ms, deleted group size:" << deleted_task_groups.size();
 }
 
+struct WorkloadGroupMemInfo {
+    int64_t total_mem_used = 0;
+    int64_t weighted_mem_used = 0;
+    bool is_low_wartermark = false;
+    bool is_high_wartermark = false;
+    double mem_used_ratio = 0;
+};
+void WorkloadGroupMgr::refresh_wg_memory_info() {

Review Comment:
   warning: function 'refresh_wg_memory_info' exceeds recommended 
size/complexity thresholds [readability-function-size]
   ```cpp
   void WorkloadGroupMgr::refresh_wg_memory_info() {
                          ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/runtime/workload_group/workload_group_manager.cpp:146:** 106 lines 
including whitespace and comments (threshold 80)
   ```cpp
   void WorkloadGroupMgr::refresh_wg_memory_info() {
                          ^
   ```
   
   </details>
   



-- 
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]

Reply via email to