Fix false positives during transfer replacement phase
This commit is contained in:
@ -1601,32 +1601,6 @@ int ObTransferReplaceTableTask::check_src_tablet_sstables_(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferReplaceTableTask::check_tablet_after_replace_(ObLS *ls, const common::ObTabletID &tablet_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTablet *tablet = nullptr;
|
||||
ObTabletMemberWrapper<ObTabletTableStore> wrapper;
|
||||
if (OB_FAIL(ls->get_tablet(tablet_id, tablet_handle))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id));
|
||||
} else if (OB_ISNULL(tablet = tablet_handle.get_obj())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet should not be NULL", K(ret), KPC(tablet));
|
||||
} else if (OB_FAIL(tablet->fetch_table_store(wrapper))) {
|
||||
LOG_WARN("fetch table store fail", K(ret), KPC(tablet));
|
||||
} else if (tablet->get_tablet_meta().ha_status_.is_restore_status_full()
|
||||
&& wrapper.get_member()->get_major_sstables().empty()) {
|
||||
// In case of restore, if restore status is FULL, major sstable must be exist after replace.
|
||||
ret = OB_INVALID_TABLE_STORE;
|
||||
LOG_WARN("tablet should be exist major sstable", K(ret), KPC(tablet));
|
||||
} else if (tablet->get_tablet_meta().has_transfer_table()) {
|
||||
ret = OB_TRANSFER_SYS_ERROR;
|
||||
LOG_WARN("replace should be exist transfer table", K(ret), K(tablet->get_tablet_meta()));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferReplaceTableTask::transfer_replace_tables_(
|
||||
ObLS *ls,
|
||||
const ObTabletBackfillInfo &tablet_info,
|
||||
@ -1684,8 +1658,6 @@ int ObTransferReplaceTableTask::transfer_replace_tables_(
|
||||
|
||||
if (FAILEDx(ls->build_ha_tablet_new_table_store(tablet_info.tablet_id_, param))) {
|
||||
LOG_WARN("failed to build ha tablet new table store", K(ret), K(param), K(tablet_info));
|
||||
} else if (OB_FAIL(check_tablet_after_replace_(ls, tablet_info.tablet_id_))) {
|
||||
LOG_WARN("failed to check tablet after replace", K(ret), K(param), K(tablet_info));
|
||||
} else {
|
||||
LOG_INFO("[TRANSFER_BACKFILL]succ transfer replace tables", K(ret), K(param), K(tablet_info), KPC_(ctx));
|
||||
}
|
||||
|
||||
@ -235,7 +235,6 @@ private:
|
||||
const ObTabletMemberWrapper<ObTabletTableStore> &wrapper,
|
||||
const ObTablet *dest_tablet,
|
||||
bool &need_fill_minor);
|
||||
int check_tablet_after_replace_(ObLS *ls, const common::ObTabletID &tablet_id);
|
||||
int fill_empty_minor_sstable(
|
||||
ObTablet *tablet,
|
||||
bool need_fill_minor,
|
||||
|
||||
@ -609,6 +609,31 @@ int ObTablet::init_for_defragment(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTablet::handle_transfer_replace_(const ObBatchUpdateTableStoreParam ¶m)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletMemberWrapper<ObTabletTableStore> wrapper;
|
||||
if (!param.is_valid() || !param.is_transfer_replace_) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid args", K(ret), K(param));
|
||||
} else if (OB_FAIL(tablet_meta_.reset_transfer_table())) {
|
||||
LOG_WARN("failed to set finish tansfer replace", K(ret), K(tablet_meta_), K(param));
|
||||
} else if (OB_FAIL(tablet_meta_.ha_status_.set_restore_status(param.restore_status_))) {
|
||||
LOG_WARN("failed to set tablet restore status", K(ret), "restore_status", param.restore_status_);
|
||||
} else if (OB_FAIL(fetch_table_store(wrapper))) {
|
||||
LOG_WARN("failed to fetch table store", K(ret), "tablet_id", tablet_meta_.tablet_id_);
|
||||
} else if (tablet_meta_.ha_status_.is_restore_status_full()
|
||||
&& wrapper.get_member()->get_major_sstables().empty()) {
|
||||
// In case of restore, if restore status is FULL, major sstable must be exist after replace.
|
||||
ret = OB_INVALID_TABLE_STORE;
|
||||
LOG_WARN("tablet should be exist major sstable", K(ret), "tablet_id", tablet_meta_.tablet_id_);
|
||||
} else if (tablet_meta_.has_transfer_table()) {
|
||||
ret = OB_TRANSFER_SYS_ERROR;
|
||||
LOG_WARN("transfer table should not exist", K(ret), K_(tablet_meta));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTablet::init_for_sstable_replace(
|
||||
common::ObArenaAllocator &allocator,
|
||||
const ObBatchUpdateTableStoreParam ¶m,
|
||||
@ -616,7 +641,6 @@ int ObTablet::init_for_sstable_replace(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
allocator_ = &allocator;
|
||||
SCN max_clog_checkpoint_scn;
|
||||
common::ObArenaAllocator tmp_arena_allocator(common::ObMemAttr(MTL_ID(), "InitTablet"));
|
||||
ObTabletMemberWrapper<ObTabletTableStore> old_table_store_wrapper;
|
||||
const ObTabletTableStore *old_table_store = nullptr;
|
||||
@ -637,8 +661,6 @@ int ObTablet::init_for_sstable_replace(
|
||||
|| OB_ISNULL(log_handler_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet pointer handle is invalid", K(ret), K_(pointer_hdl), K_(memtable_mgr), K_(log_handler));
|
||||
} else if (param.is_transfer_replace_ && OB_FAIL(param.get_max_clog_checkpoint_scn(max_clog_checkpoint_scn))) {
|
||||
LOG_WARN("failed to get max clog checkpoint ts", K(ret), K(param));
|
||||
} else if (OB_FAIL(old_tablet.load_storage_schema(tmp_arena_allocator, old_storage_schema))) {
|
||||
LOG_WARN("failed to load storage schema", K(ret), K(old_tablet));
|
||||
} else if (OB_FAIL(old_tablet.fetch_table_store(old_table_store_wrapper))) {
|
||||
@ -675,10 +697,8 @@ int ObTablet::init_for_sstable_replace(
|
||||
LOG_WARN("failed to check medium list", K(ret), K(param), K(old_tablet));
|
||||
} else if (OB_FAIL(check_sstable_column_checksum())) {
|
||||
LOG_WARN("failed to check sstable column checksum", K(ret), KPC(this));
|
||||
} else if (param.is_transfer_replace_ && OB_FAIL(tablet_meta_.reset_transfer_table())) {
|
||||
LOG_WARN("failed to set finish tansfer replace", K(ret), K(tablet_meta_), K(param));
|
||||
} else if (param.is_transfer_replace_ && OB_FAIL(tablet_meta_.ha_status_.set_restore_status(param.restore_status_))) {
|
||||
LOG_WARN("failed to set tablet restore status", K(ret));
|
||||
} else if (param.is_transfer_replace_ && OB_FAIL(handle_transfer_replace_(param))) {
|
||||
LOG_WARN("failed to handle transfer replace", K(ret), K(param));
|
||||
} else if (FALSE_IT(set_mem_addr())) {
|
||||
} else if (OB_FAIL(inner_inc_macro_ref_cnt())) {
|
||||
LOG_WARN("failed to increase macro ref cnt", K(ret));
|
||||
|
||||
@ -727,6 +727,7 @@ private:
|
||||
int wait_release_memtables_();
|
||||
int mark_mds_table_switched_to_empty_shell_();
|
||||
int fetch_autoinc_seq(ObTabletMemberWrapper<share::ObTabletAutoincSeq> &wrapper) const;
|
||||
int handle_transfer_replace_(const ObBatchUpdateTableStoreParam ¶m);
|
||||
private:
|
||||
// ObTabletDDLKvMgr::MAX_DDL_KV_CNT_IN_STORAGE
|
||||
// Array size is too large, need to shrink it if possible
|
||||
|
||||
Reference in New Issue
Block a user