diff --git a/src/storage/blocksstable/ob_block_manager.cpp b/src/storage/blocksstable/ob_block_manager.cpp index 586a36843c..57e1e175ad 100644 --- a/src/storage/blocksstable/ob_block_manager.cpp +++ b/src/storage/blocksstable/ob_block_manager.cpp @@ -956,7 +956,7 @@ void ObBlockManager::mark_and_sweep() LOG_WARN("fail to get pending free blocks", K(ret)); } else if (0 == (alloc_num = ATOMIC_SET(&alloc_num_, 0)) && 0 == mark_info.count()) { skip_mark = true; - LOG_INFO("no block alloc/free, no need to mark blocks", K(ret)); + LOG_INFO("no block alloc/free, no need to mark blocks", K(ret), K(mark_info.count())); } else if (OB_FAIL(mark_macro_blocks(mark_info, macro_id_set, tmp_status))) {//mark LOG_WARN("fail to mark macro blocks", K(ret)); } @@ -981,14 +981,28 @@ void ObBlockManager::mark_and_sweep() } else { update_marker_status(tmp_status); } + } else { + update_partial_status(tmp_status); } } - FLOG_INFO("finish once mark and sweep", K(ret), K(alloc_num), K_(marker_status), "map_cnt", block_map_.count()); + FLOG_INFO("finish once mark and sweep", K(ret), K(alloc_num), K(mark_info.count()), K_(marker_status), "map_cnt", block_map_.count()); } } macro_id_set.destroy(); } +void ObBlockManager::update_partial_status(const ObMacroBlockMarkerStatus &tmp_status) +{ + SpinWLockGuard guard(marker_lock_); + marker_status_.pending_free_count_ = tmp_status.pending_free_count_; + marker_status_.last_end_time_ = ObTimeUtility::fast_current_time(); + marker_status_.mark_cost_time_ = tmp_status.mark_cost_time_; + marker_status_.sweep_cost_time_ = 0; + marker_status_.start_time_ = tmp_status.start_time_; + marker_status_.hold_count_ = tmp_status.hold_count_; + marker_status_.free_count_ = get_free_macro_block_count(); +} + int ObBlockManager::mark_macro_blocks( MacroBlkIdMap &mark_info, 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 3ce31a4cfc..f34cc43360 100644 --- a/src/storage/blocksstable/ob_block_manager.h +++ b/src/storage/blocksstable/ob_block_manager.h @@ -335,6 +335,7 @@ private: }; private: + void update_partial_status(const ObMacroBlockMarkerStatus &tmp_status); int get_macro_block_info(const MacroBlockId ¯o_id, ObMacroBlockInfo ¯o_block_info) const; bool is_bad_block(const MacroBlockId ¯o_block_id); int mark_macro_blocks(