xinyiZzz commented on code in PR #12716:
URL: https://github.com/apache/doris/pull/12716#discussion_r976172650


##########
be/src/runtime/load_channel_mgr.h:
##########
@@ -143,36 +151,75 @@ Status LoadChannelMgr::add_batch(const 
TabletWriterAddRequest& request,
 
 template <typename TabletWriterAddResult>
 Status LoadChannelMgr::_handle_mem_exceed_limit(TabletWriterAddResult* 
response) {
-    // lock so that only one thread can check mem limit
-    std::lock_guard<std::mutex> l(_lock);
-    if (!_mem_tracker->limit_exceeded()) {
-        return Status::OK();
-    }
-
-    int64_t max_consume = 0;
+    _pending_if_hard_limit_exceeded();
+    // Check limit and pick load channel to reduce memory.
     std::shared_ptr<LoadChannel> channel;
-    for (auto& kv : _load_channels) {
-        if (kv.second->is_high_priority()) {
-            // do not select high priority channel to reduce memory
-            // to avoid blocking them.
-            continue;
+    {
+        std::lock_guard<std::mutex> l(_lock);
+        // Check the soft limit.
+        if (_mem_tracker->consumption() < _load_process_soft_limit) {

Review Comment:
   `if (_mem_tracker->consumption() < _load_process_soft_limit)`Can it be 
placed outside the lock



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to