|
|
|
|
@ -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> ¯o_block_list,
|
|
|
|
|
common::hash::ObHashSet<MacroBlockId, common::hash::NoPthreadDefendMode> ¯o_id_set,
|
|
|
|
|
|