[CP] fix large_buffer_pool core

This commit is contained in:
taoshuning 2023-10-10 11:44:07 +00:00 committed by ob-robot
parent c63282a624
commit ee1b331ab4

View File

@ -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);