remove limit of block mark

This commit is contained in:
obdev 2023-11-23 14:45:16 +00:00 committed by ob-robot
parent 4b0b4cadb8
commit 56f9ab9335
5 changed files with 28 additions and 56 deletions

View File

@ -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: {

View File

@ -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<MacroBlockId> &macro_block_list,
common::hash::ObHashSet<MacroBlockId, common::hash::NoPthreadDefendMode> &macro_id_set,

View File

@ -389,7 +389,6 @@ private:
common::hash::ObHashSet<MacroBlockId, common::hash::NoPthreadDefendMode> &macro_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(

View File

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

View File

@ -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_;
};