github-actions[bot] commented on code in PR #43401: URL: https://github.com/apache/doris/pull/43401#discussion_r1832036631
########## be/src/io/cache/block_file_cache.h: ########## @@ -19,6 +19,7 @@ #include <bvar/bvar.h> Review Comment: warning: 'bvar/bvar.h' file not found [clang-diagnostic-error] ```cpp #include <bvar/bvar.h> ^ ``` ########## be/src/io/cache/block_file_cache.h: ########## @@ -27,15 +28,51 @@ #include "io/cache/file_block.h" #include "io/cache/file_cache_common.h" #include "io/cache/file_cache_storage.h" +#include "util/threadpool.h" namespace doris::io { +// Note: the cache_lock is scoped, so do not add do...while(0) here. +#ifdef ENABLE_CACHE_LOCK_DEBUG +#define SCOPED_CACHE_LOCK(MUTEX) \ + std::chrono::time_point<std::chrono::steady_clock> start_time = \ + std::chrono::steady_clock::now(); \ + std::lock_guard cache_lock(MUTEX); \ + std::chrono::time_point<std::chrono::steady_clock> acq_time = \ + std::chrono::steady_clock::now(); \ + auto duration = \ + std::chrono::duration_cast<std::chrono::milliseconds>(acq_time - start_time).count(); \ + if (duration > config::cache_lock_long_tail_threshold) \ + LOG(WARNING) << "Lock wait time " << std::to_string(duration) << "ms. " \ + << get_stack_trace_by_boost() << std::endl; \ + LockScopedTimer cache_lock_timer; +#else +#define SCOPED_CACHE_LOCK(MUTEX) std::lock_guard cache_lock(MUTEX); +#endif + template <class Lock> concept IsXLock = std::same_as<Lock, std::lock_guard<std::mutex>> || std::same_as<Lock, std::unique_lock<std::mutex>>; class FSFileCacheStorage; +class LockScopedTimer { +public: + LockScopedTimer() : start_(std::chrono::steady_clock::now()) {} Review Comment: warning: use '= default' to define a trivial default constructor [modernize-use-equals-default] ```suggestion LockScopedTimer() : start_(std::chrono::steady_clock::now()) = default; ``` -- 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