From 56f9ab9335e5b645c400fd2378266348d97c2c80 Mon Sep 17 00:00:00 2001 From: obdev Date: Thu, 23 Nov 2023 14:45:16 +0000 Subject: [PATCH] remove limit of block mark --- ..._all_virtual_macro_block_marker_status.cpp | 2 +- src/storage/blocksstable/ob_block_manager.cpp | 77 +++++++------------ src/storage/blocksstable/ob_block_manager.h | 1 - .../blocksstable/ob_block_sstable_struct.cpp | 2 - .../blocksstable/ob_block_sstable_struct.h | 2 - 5 files changed, 28 insertions(+), 56 deletions(-) diff --git a/src/observer/virtual_table/ob_all_virtual_macro_block_marker_status.cpp b/src/observer/virtual_table/ob_all_virtual_macro_block_marker_status.cpp index 29a22d590..90a852220 100644 --- a/src/observer/virtual_table/ob_all_virtual_macro_block_marker_status.cpp +++ b/src/observer/virtual_table/ob_all_virtual_macro_block_marker_status.cpp @@ -166,7 +166,7 @@ int ObAllVirtualMacroBlockMarkerStatus::inner_get_next_row(common::ObNewRow *&ro } case OB_APP_MIN_COLUMN_ID + 18: { // whether finished marking - cur_row_.cells_[i].set_bool(marker_status_.mark_finished_); + cur_row_.cells_[i].set_bool(true); break; } case OB_APP_MIN_COLUMN_ID + 19: { diff --git a/src/storage/blocksstable/ob_block_manager.cpp b/src/storage/blocksstable/ob_block_manager.cpp index 0d5f3e715..98face2e9 100644 --- a/src/storage/blocksstable/ob_block_manager.cpp +++ b/src/storage/blocksstable/ob_block_manager.cpp @@ -794,18 +794,15 @@ void ObBlockManager::update_marker_status(const ObMacroBlockMarkerStatus &tmp_st marker_status_.sweep_cost_time_ = tmp_status.sweep_cost_time_; marker_status_.start_time_ = tmp_status.start_time_; marker_status_.last_end_time_ = tmp_status.last_end_time_; - marker_status_.mark_finished_ = tmp_status.mark_finished_; - if (tmp_status.mark_finished_) { - marker_status_.linked_block_count_ = tmp_status.linked_block_count_; - marker_status_.index_block_count_ = tmp_status.index_block_count_; - marker_status_.ids_block_count_ = tmp_status.ids_block_count_; - marker_status_.tmp_file_count_ = tmp_status.tmp_file_count_; - marker_status_.data_block_count_ = tmp_status.data_block_count_; - marker_status_.shared_data_block_count_ = tmp_status.shared_data_block_count_; - marker_status_.pending_free_count_ = tmp_status.pending_free_count_; - marker_status_.shared_meta_block_count_ = tmp_status.shared_meta_block_count_; - marker_status_.hold_info_ = tmp_status.hold_info_; - } + marker_status_.linked_block_count_ = tmp_status.linked_block_count_; + marker_status_.index_block_count_ = tmp_status.index_block_count_; + marker_status_.ids_block_count_ = tmp_status.ids_block_count_; + marker_status_.tmp_file_count_ = tmp_status.tmp_file_count_; + marker_status_.data_block_count_ = tmp_status.data_block_count_; + marker_status_.shared_data_block_count_ = tmp_status.shared_data_block_count_; + marker_status_.pending_free_count_ = tmp_status.pending_free_count_; + marker_status_.shared_meta_block_count_ = tmp_status.shared_meta_block_count_; + marker_status_.hold_info_ = tmp_status.hold_info_; } bool ObBlockManager::GetOldestHoldBlockFunctor::operator()( @@ -960,15 +957,7 @@ void ObBlockManager::mark_and_sweep() skip_mark = true; LOG_INFO("no block alloc/free, no need to mark blocks", K(ret)); } else if (OB_FAIL(mark_macro_blocks(mark_info, macro_id_set, tmp_status))) {//mark - if (OB_EAGAIN == ret) { - tmp_status.mark_finished_ = false; - ret = OB_SUCCESS; - // skip marking - } else { - LOG_WARN("fail to mark macro blocks", K(ret)); - } - } else { - tmp_status.mark_finished_ = true; + LOG_WARN("fail to mark macro blocks", K(ret)); } if (OB_FAIL(ret)) { @@ -1082,30 +1071,24 @@ int ObBlockManager::mark_tenant_blocks( ObTenantTabletIterator tablet_iter(*t3m, iter_allocator); ObTabletHandle handle; while (OB_SUCC(ret)) { - if (!continue_mark()) { - ret = OB_EAGAIN; - LOG_INFO("disk usage exceeds threshold, skip marking", K(io_device_->get_free_block_count()), - K(super_block_.get_total_macro_block_count())); - } else { - handle.reset(); - iter_allocator.reuse(); - if (OB_FAIL(tablet_iter.get_next_tablet(handle))) { - if (OB_ITER_END == ret) { - ret = OB_SUCCESS; - break; - } else { - LOG_WARN("fail to get next in-memory tablet", K(ret)); - } - } else if (handle.get_obj()->is_old_tablet()) { - if (OB_FAIL(mark_tablet_meta_blocks(mark_info, handle, macro_id_set, tmp_status))) { - LOG_WARN("fail to mark tablet meta blocks", K(ret)); - } else if (OB_FAIL(mark_sstable_blocks(mark_info, handle, macro_id_set, tmp_status))) { - LOG_WARN("fail to mark tablet blocks", K(ret)); - } + handle.reset(); + iter_allocator.reuse(); + if (OB_FAIL(tablet_iter.get_next_tablet(handle))) { + if (OB_ITER_END == ret) { + ret = OB_SUCCESS; + break; } else { - if (OB_FAIL(mark_tablet_block(mark_info, handle, macro_id_set, tmp_status))) { - LOG_WARN("fail to mark tablet's macro blocks", K(ret), K(tmp_status), KPC(handle.get_obj())); - } + LOG_WARN("fail to get next in-memory tablet", K(ret)); + } + } else if (handle.get_obj()->is_old_tablet()) { + if (OB_FAIL(mark_tablet_meta_blocks(mark_info, handle, macro_id_set, tmp_status))) { + LOG_WARN("fail to mark tablet meta blocks", K(ret)); + } else if (OB_FAIL(mark_sstable_blocks(mark_info, handle, macro_id_set, tmp_status))) { + LOG_WARN("fail to mark tablet blocks", K(ret)); + } + } else { + if (OB_FAIL(mark_tablet_block(mark_info, handle, macro_id_set, tmp_status))) { + LOG_WARN("fail to mark tablet's macro blocks", K(ret), K(tmp_status), KPC(handle.get_obj())); } } } @@ -1468,12 +1451,6 @@ int ObBlockManager::mark_server_meta_blocks( return ret; } -bool ObBlockManager::continue_mark() -{ - return (double) (io_device_->get_free_block_count()) - / (double) (super_block_.get_total_macro_block_count()) >= MARK_THRESHOLD; -} - int ObBlockManager::update_mark_info( const ObIArray ¯o_block_list, common::hash::ObHashSet ¯o_id_set, diff --git a/src/storage/blocksstable/ob_block_manager.h b/src/storage/blocksstable/ob_block_manager.h index 9c8c98ab2..c6b246be5 100644 --- a/src/storage/blocksstable/ob_block_manager.h +++ b/src/storage/blocksstable/ob_block_manager.h @@ -389,7 +389,6 @@ private: common::hash::ObHashSet ¯o_id_set, ObMacroBlockMarkerStatus &tmp_status); int set_group_id(const uint64_t tenant_id); - bool continue_mark(); int do_sweep(MacroBlkIdMap &mark_info); int update_mark_info( diff --git a/src/storage/blocksstable/ob_block_sstable_struct.cpp b/src/storage/blocksstable/ob_block_sstable_struct.cpp index 4e47f66b9..c587c0262 100644 --- a/src/storage/blocksstable/ob_block_sstable_struct.cpp +++ b/src/storage/blocksstable/ob_block_sstable_struct.cpp @@ -514,7 +514,6 @@ ObMacroBlockMarkerStatus::ObMacroBlockMarkerStatus() sweep_cost_time_(0), start_time_(0), last_end_time_(0), - mark_finished_(false), hold_info_() { } @@ -561,7 +560,6 @@ void ObMacroBlockMarkerStatus::reuse() sweep_cost_time_ = 0; start_time_ = 0; last_end_time_ = 0; - mark_finished_ = false; hold_info_.reset(); } diff --git a/src/storage/blocksstable/ob_block_sstable_struct.h b/src/storage/blocksstable/ob_block_sstable_struct.h index e9d7dd9a9..716f95060 100644 --- a/src/storage/blocksstable/ob_block_sstable_struct.h +++ b/src/storage/blocksstable/ob_block_sstable_struct.h @@ -970,7 +970,6 @@ public: K_(sweep_cost_time), KTIME_(start_time), KTIME_(last_end_time), - K_(mark_finished), K_(hold_info)); public: int64_t total_block_count_; @@ -991,7 +990,6 @@ public: int64_t sweep_cost_time_; int64_t start_time_; int64_t last_end_time_; - bool mark_finished_; ObSimpleMacroBlockInfo hold_info_; };