From ee1b331ab4a0192b241e397bff370ec5e4d4e51c Mon Sep 17 00:00:00 2001 From: taoshuning <616811991@qq.com> Date: Tue, 10 Oct 2023 11:44:07 +0000 Subject: [PATCH] [CP] fix large_buffer_pool core --- src/logservice/archiveservice/large_buffer_pool.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/logservice/archiveservice/large_buffer_pool.cpp b/src/logservice/archiveservice/large_buffer_pool.cpp index 9850902fb..429cbccf5 100644 --- a/src/logservice/archiveservice/large_buffer_pool.cpp +++ b/src/logservice/archiveservice/large_buffer_pool.cpp @@ -75,9 +75,9 @@ char *LargeBufferPool::acquire(const int64_t size) char *data = NULL; int ret = OB_SUCCESS; - // try acquire from curent buffer pool with rlock + common::ObTimeGuard time_guard("acquire", 10 * 1000L); + WLockGuard guard(rwlock_); { - RLockGuard guard(rwlock_); if (OB_UNLIKELY(! inited_)) { ret = OB_NOT_INIT; ARCHIVE_LOG(WARN, "large buffer pool not init", K(ret)); @@ -86,9 +86,7 @@ char *LargeBufferPool::acquire(const int64_t size) } } - // if not get, reserve and acquire with wlock if (NULL == data && OB_SUCC(ret)) { - WLockGuard guard(rwlock_); if (OB_FAIL(reserve_())) { ARCHIVE_LOG(WARN, "reserve failed", K(ret)); } else if (OB_FAIL(acquire_(size, data))) { @@ -100,7 +98,8 @@ char *LargeBufferPool::acquire(const int64_t size) void LargeBufferPool::reclaim(void *ptr) { - RLockGuard guard(rwlock_); + common::ObTimeGuard time_guard("reclaim", 10 * 1000L); + WLockGuard guard(rwlock_); if (NULL != ptr) { reclaim_(ptr); } @@ -112,6 +111,7 @@ void LargeBufferPool::weed_out() bool is_purged = false; const int64_t purge_threshold = common::ObTimeUtility::fast_current_time() - BUFFER_PURGE_THRESHOLD; + common::ObTimeGuard time_guard("weed_out", 10 * 1000L); WLockGuard guard(rwlock_); for (int64_t i = array_.count() - 1; OB_SUCC(ret) && i >= 0; i--) { BufferNode &node = array_.at(i);