dataroaring commented on code in PR #41818:
URL: https://github.com/apache/doris/pull/41818#discussion_r1804035921
##########
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;
\
Review Comment:
We should limit frequency of the log.
--
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]