diff --git a/src/storage/blocksstable/ob_store_file.cpp b/src/storage/blocksstable/ob_store_file.cpp index e37ef46f06993c32768f7c366c46af9bbd7ba000..4f6b66f2cc8a43a6941cf360233ba2a03a03e616 100644 --- a/src/storage/blocksstable/ob_store_file.cpp +++ b/src/storage/blocksstable/ob_store_file.cpp @@ -430,7 +430,8 @@ ObStoreFile::ObStoreFile() cond_(), is_fs_support_punch_hole_(true), block_file_fd_(OB_INVALID_FD), - alloc_lock_() + alloc_lock_(), + resize_file_lock_() { MEMSET(used_macro_cnt_, 0, sizeof(used_macro_cnt_)); } @@ -1180,7 +1181,7 @@ int ObStoreFile::mark_macro_blocks() // should lock before using to protect free_block_cnt_ opt int ObStoreFile::extend_file_size_task() { - lib::ObMutexGuard guard(block_lock_); // lock block info update opt + lib::ObMutexGuard guard(resize_file_lock_); // lock resize file opt int ret = OB_SUCCESS; if (OB_ISNULL(store_file_system_)) { } else { @@ -1204,6 +1205,7 @@ int ObStoreFile::extend_file_size_task() if (OB_FAIL(wait_mark_sweep_finish())) { LOG_WARN("fail to wait mark and sweep finish", K(ret)); } else { + lib::ObMutexGuard guard(block_lock_); // lock block info update opt bool is_extend_size = false; int64_t total_block_cnt = store_file_system_->get_total_macro_block_count(); int64_t free_block_cnt_to_extend = @@ -1543,11 +1545,12 @@ int ObStoreFile::resize_file( if (OB_ISNULL(store_file_system_)) { LOG_DEBUG("Do resize file fail, store_file_system_ is null pointer"); } else { - lib::ObMutexGuard guard(block_lock_); + lib::ObMutexGuard guard(resize_file_lock_); disable_mark_sweep(); if (OB_FAIL(wait_mark_sweep_finish())) { LOG_WARN("fail to wait mark and sweep finish", K(ret)); } else { + lib::ObMutexGuard guard(block_lock_); if (OB_FAIL(store_file_system_->resize_file(new_data_file_size, new_data_file_disk_percentage))) { LOG_WARN("fail to resize file", K(ret)); } else if (OB_FAIL(refresh_block_meta())) { diff --git a/src/storage/blocksstable/ob_store_file.h b/src/storage/blocksstable/ob_store_file.h index 07ebb7c802eb1e1d3f1ae3ccd64fa3acef75c955..49a00467d31edf345b3fe09e8266c1af9200feae 100644 --- a/src/storage/blocksstable/ob_store_file.h +++ b/src/storage/blocksstable/ob_store_file.h @@ -445,6 +445,7 @@ private: bool is_fs_support_punch_hole_; int block_file_fd_; lib::ObMutex alloc_lock_; + lib::ObMutex resize_file_lock_; }; OB_INLINE bool ObStoreFile::is_valid(const MacroBlockId macro_id)