yiguolei commented on code in PR #62739:
URL: https://github.com/apache/doris/pull/62739#discussion_r3138497880


##########
be/src/common/daemon.cpp:
##########
@@ -507,6 +508,12 @@ void Daemon::je_reset_dirty_decay_thread() const {
 }
 
 void Daemon::cache_adjust_capacity_thread() {
+    // Attach a tracker so Block/Column destructors triggered by LRU eviction
+    // do not hit the memory_orphan_check DCHECK.
+    auto mem_tracker = 
MemTrackerLimiter::create_shared(MemTrackerLimiter::Type::GLOBAL,

Review Comment:
   The root cause is that the cache value in the query cache contains a block. 
When the daemon performs pruning, it releases the cache value, which in turn 
releases the block, resulting in a dcheck crash.
   Your current approach can prevent the dcheck from crashing, but it will 
cause incorrect statistics in the memtracker of the query cache.
   In my opinion, a more reasonable solution is to override the 
adjust_capacity_weighted method in the query cache. First, add 
SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(ExecEnv::GetInstance()->query_cache_mem_tracker());,
 then continue to call the parent class's adjust_capacity_weighted. This 
ensures that if any destructor runs during the execution of this 
adjust_capacity_weighted function, the memory will be deducted from the query 
cache's memtracker.



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