github-actions[bot] commented on code in PR #32039: URL: https://github.com/apache/doris/pull/32039#discussion_r1527469695
########## be/src/runtime/memory/cache_policy.h: ########## @@ -93,15 +94,30 @@ class CachePolicy { __builtin_unreachable(); } - CachePolicy(CacheType type, uint32_t stale_sweep_time_s, bool enable_prune); + CachePolicy(CacheType type, uint32_t stale_sweep_time_s, bool enable_prune, + bool tracking_by_allocator); virtual ~CachePolicy(); virtual void prune_stale() = 0; virtual void prune_all(bool force) = 0; CacheType type() { return _type; } - std::shared_ptr<MemTrackerLimiter> mem_tracker() { return _mem_tracker; } - int64_t mem_consumption() { return _mem_tracker->consumption(); } + MemTracker* mem_tracker_by_manual() { Review Comment: warning: method 'mem_tracker_by_manual' can be made const [readability-make-member-function-const] ```suggestion MemTracker* mem_tracker_by_manual() const { ``` ########## be/src/runtime/memory/cache_policy.h: ########## @@ -93,15 +94,30 @@ __builtin_unreachable(); } - CachePolicy(CacheType type, uint32_t stale_sweep_time_s, bool enable_prune); + CachePolicy(CacheType type, uint32_t stale_sweep_time_s, bool enable_prune, + bool tracking_by_allocator); virtual ~CachePolicy(); virtual void prune_stale() = 0; virtual void prune_all(bool force) = 0; CacheType type() { return _type; } - std::shared_ptr<MemTrackerLimiter> mem_tracker() { return _mem_tracker; } - int64_t mem_consumption() { return _mem_tracker->consumption(); } + MemTracker* mem_tracker_by_manual() { + CHECK(!_tracking_by_allocator); + return _mem_tracker_by_manual.get(); + } + std::shared_ptr<MemTrackerLimiter> mem_tracker_by_allocator() { + CHECK(_tracking_by_allocator); + return _mem_tracker_by_allocator; + } + int64_t mem_consumption() { Review Comment: warning: method 'mem_consumption' can be made const [readability-make-member-function-const] ```suggestion int64_t mem_consumption() const { ``` ########## be/src/runtime/memory/lru_cache_value_base.h: ########## @@ -27,25 +27,46 @@ class LRUCacheValueBase { public: LRUCacheValueBase() = delete; LRUCacheValueBase(CachePolicy::CacheType type) { - _mem_tracker = CacheManager::instance()->get_cache(type)->mem_tracker(); + _tracking_by_allocator = CacheManager::instance()->get_cache(type)->tracking_by_allocator(); + if (_tracking_by_allocator) { + _mem_tracker_by_allocator = + CacheManager::instance()->get_cache(type)->mem_tracker_by_allocator(); + } else { + _mem_tracker_by_manual = + CacheManager::instance()->get_cache(type)->mem_tracker_by_manual(); + } + } + LRUCacheValueBase(CachePolicy::CacheType type, + const std::shared_ptr<MemTrackerLimiter>& mem_tracker) + : _mem_tracker_by_allocator(mem_tracker) { + _tracking_by_allocator = CacheManager::instance()->get_cache(type)->tracking_by_allocator(); + CHECK(_tracking_by_allocator == true); Review Comment: warning: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr] ```suggestion CHECK(_tracking_by_allocator); ``` ########## be/src/runtime/thread_context.cpp: ########## @@ -23,20 +23,42 @@ namespace doris { class MemTracker; +QueryThreadContext ThreadContext::query_thread_context() { Review Comment: warning: method 'query_thread_context' can be made static [readability-convert-member-functions-to-static] be/src/runtime/thread_context.h:197: ```diff - QueryThreadContext query_thread_context(); + static QueryThreadContext query_thread_context(); ``` ########## be/src/runtime/group_commit_mgr.cpp: ########## @@ -228,7 +229,9 @@ Status GroupCommitTable::get_first_block_load_queue( std::to_string(_table_id)); } -Status GroupCommitTable::_create_group_commit_load(int be_exe_version) { +Status GroupCommitTable::_create_group_commit_load(int be_exe_version, Review Comment: warning: function '_create_group_commit_load' exceeds recommended size/complexity thresholds [readability-function-size] ```cpp Status GroupCommitTable::_create_group_commit_load(int be_exe_version, ^ ``` <details> <summary>Additional context</summary> **be/src/runtime/group_commit_mgr.cpp:231:** 91 lines including whitespace and comments (threshold 80) ```cpp Status GroupCommitTable::_create_group_commit_load(int be_exe_version, ^ ``` </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: 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