From e6bf768b9756e399b7873f9591bc52ff166ea43a Mon Sep 17 00:00:00 2001 From: Tyshawn Date: Thu, 27 Jul 2023 06:42:26 +0000 Subject: [PATCH] [BUG.FIX] fix hang in allocate extents of tmp file store --- src/storage/blocksstable/ob_tmp_file_store.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/storage/blocksstable/ob_tmp_file_store.cpp b/src/storage/blocksstable/ob_tmp_file_store.cpp index ecd50e434f..3bcad7e216 100644 --- a/src/storage/blocksstable/ob_tmp_file_store.cpp +++ b/src/storage/blocksstable/ob_tmp_file_store.cpp @@ -1003,10 +1003,16 @@ int ObTmpTenantFileStore::alloc(const int64_t dir_id, const uint64_t tenant_id, ret = OB_INVALID_ARGUMENT; STORAGE_LOG(WARN, "invalid argument", K(alloc_size), K(block_size)); } else { + const int64_t timeout_ts = THIS_WORKER.get_timeout_ts(); ret = OB_STATE_NOT_MATCH; while (OB_STATE_NOT_MATCH == ret || OB_SIZE_OVERFLOW == ret) { - if (OB_FAIL(tmp_mem_block_manager_.cleanup())) { - STORAGE_LOG(WARN, "fail to try wash tmp macro block", K(ret), K(dir_id), K(tenant_id)); + if (OB_UNLIKELY(timeout_ts <= ObTimeUtility::current_time())) { + ret = OB_TIMEOUT; + STORAGE_LOG(WARN, "it's timeout", K(ret), K(timeout_ts), K(ObTimeUtility::current_time())); + } else if (OB_FAIL(tmp_mem_block_manager_.cleanup())) { + if (OB_STATE_NOT_MATCH != ret) { + STORAGE_LOG(WARN, "fail to try wash tmp macro block", K(ret), K(dir_id), K(tenant_id)); + } } SpinWLockGuard guard(lock_); if (OB_SUCC(ret)) {