fix migration report -4016 not check transfer seq match

This commit is contained in:
oceanoverflow 2024-02-06 16:54:32 +00:00 committed by ob-robot
parent ae0c63a261
commit 25e5b21d00
4 changed files with 32 additions and 1 deletions

View File

@ -2753,6 +2753,8 @@ int ObTabletMigrationTask::generate_tablet_copy_finish_task_(
LOG_WARN("failed to get ls", K(ret), KPC(ctx_));
} else if (OB_FAIL(ctx_->ha_table_info_mgr_.get_tablet_meta(copy_tablet_ctx_->tablet_id_, src_tablet_meta))) {
LOG_WARN("failed to get src tablet meta", K(ret), KPC(copy_tablet_ctx_));
} else if (OB_FAIL(check_transfer_seq_equal_(src_tablet_meta))) {
LOG_WARN("failed to check transfer seq equal", K(ret), KPC(ctx_), KPC(copy_tablet_ctx_));
} else if (OB_FAIL(tablet_copy_finish_task->init(
copy_tablet_ctx_->tablet_id_, ls, reporter, restore_action, src_tablet_meta, copy_tablet_ctx_))) {
LOG_WARN("failed to init tablet copy finish task", K(ret), KPC(ctx_), KPC(copy_tablet_ctx_));
@ -2912,6 +2914,32 @@ int ObTabletMigrationTask::check_need_copy_sstable_(
return ret;
}
int ObTabletMigrationTask::check_transfer_seq_equal_(
const ObMigrationTabletParam *src_tablet_meta)
{
int ret = OB_SUCCESS;
ObLS *ls = nullptr;
ObTabletHandle tablet_handle;
ObTablet *tablet = nullptr;
ObTabletMigrationDag *tablet_migration_dag = nullptr;
if (OB_ISNULL(src_tablet_meta) || OB_ISNULL(copy_tablet_ctx_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("ctx should not be null", K(ret), KP(src_tablet_meta), KP_(copy_tablet_ctx));
} else if (FALSE_IT(tablet_migration_dag = static_cast<ObTabletMigrationDag *>(dag_))) {
} else if (OB_FAIL(tablet_migration_dag->get_ls(ls))) {
LOG_WARN("failed to get ls", K(ret));
} else if (OB_FAIL(ls->ha_get_tablet(copy_tablet_ctx_->tablet_id_, tablet_handle))) {
LOG_WARN("failed to get tablet", K(ret));
} else if (OB_ISNULL(tablet = tablet_handle.get_obj())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("tablet should not be NULL", K(ret));
} else if (tablet->get_tablet_meta().transfer_info_.transfer_seq_ != src_tablet_meta->transfer_info_.transfer_seq_) {
ret = OB_TABLET_TRANSFER_SEQ_NOT_MATCH;
LOG_WARN("tablet transfer seq not eq with transfer seq", KPC(tablet), KPC(src_tablet_meta));
}
return ret;
}
int ObTabletMigrationTask::check_tablet_replica_validity_(const common::ObTabletID &tablet_id)
{
int ret = OB_SUCCESS;

View File

@ -375,6 +375,8 @@ private:
int check_need_copy_sstable_(
const ObITable::TableKey &table_key,
bool &need_copy);
int check_transfer_seq_equal_(
const ObMigrationTabletParam *src_tablet_meta);
private:
bool is_inited_;

View File

@ -1015,6 +1015,7 @@ bool ObMigrationUtils::is_need_retry_error(const int err)
case OB_TRANSFER_SYS_ERROR :
case OB_INVALID_TABLE_STORE :
case OB_UNEXPECTED_TABLET_STATUS :
case OB_TABLET_TRANSFER_SEQ_NOT_MATCH:
bret = false;
break;
default:

View File

@ -2776,7 +2776,7 @@ int ObStorageHATabletBuilderUtil::inner_update_tablet_table_store_with_minor_(
ret = OB_INVALID_ARGUMENT;
LOG_WARN("inner update tablet table store with minor get invalid argument", K(ret), KP(ls), KP(tablet));
} else if (need_tablet_meta_merge && OB_FAIL(check_need_merge_tablet_meta_(src_tablet_meta, tablet, need_merge))) {
LOG_WARN("failedto check remote logical sstable exist", K(ret), KPC(tablet));
LOG_WARN("failed to check remote logical sstable exist", K(ret), KPC(tablet));
} else {
const ObTabletID &tablet_id = tablet->get_tablet_meta().tablet_id_;
update_table_store_param.tablet_meta_ = need_merge ? src_tablet_meta : nullptr;