Fix ls migration failed when tablet deleted before fetch tablet info
This commit is contained in:
@ -434,6 +434,7 @@ class ObString;
|
|||||||
ACT(MODIFY_HIDDEN_TABLE_NOT_NULL_COLUMN_STATE_BEFORE_PUBLISH_SCHEMA,)\
|
ACT(MODIFY_HIDDEN_TABLE_NOT_NULL_COLUMN_STATE_BEFORE_PUBLISH_SCHEMA,)\
|
||||||
ACT(AFTER_MIGRATION_FETCH_TABLET_INFO,)\
|
ACT(AFTER_MIGRATION_FETCH_TABLET_INFO,)\
|
||||||
ACT(BEFORE_SET_LS_MEMBER_LIST,)\
|
ACT(BEFORE_SET_LS_MEMBER_LIST,)\
|
||||||
|
ACT(BEFORE_MIGRATION_FETCH_TABLET_INFO,)\
|
||||||
ACT(MAX_DEBUG_SYNC_POINT,)
|
ACT(MAX_DEBUG_SYNC_POINT,)
|
||||||
|
|
||||||
DECLARE_ENUM(ObDebugSyncPoint, debug_sync_point, OB_DEBUG_SYNC_POINT_DEF);
|
DECLARE_ENUM(ObDebugSyncPoint, debug_sync_point, OB_DEBUG_SYNC_POINT_DEF);
|
||||||
|
|||||||
@ -3008,10 +3008,12 @@ int ObDataTabletsMigrationTask::create_or_update_tablets_()
|
|||||||
LOG_WARN("data tablets migration task do not init", K(ret));
|
LOG_WARN("data tablets migration task do not init", K(ret));
|
||||||
} else if (ctx_->data_tablet_id_array_.empty()) {
|
} else if (ctx_->data_tablet_id_array_.empty()) {
|
||||||
LOG_INFO("data tablet is is empty, no need create or update", KPC(ctx_));
|
LOG_INFO("data tablet is is empty, no need create or update", KPC(ctx_));
|
||||||
} else if (OB_FAIL(ha_tablets_builder_.create_or_update_tablets())) {
|
} else {
|
||||||
LOG_WARN("failed to create or update tablets", K(ret), KPC(ctx_));
|
DEBUG_SYNC(BEFORE_MIGRATION_FETCH_TABLET_INFO);
|
||||||
|
if (OB_FAIL(ha_tablets_builder_.create_or_update_tablets())) {
|
||||||
|
LOG_WARN("failed to create or update tablets", K(ret), KPC(ctx_));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3087,7 +3089,12 @@ int ObDataTabletsMigrationTask::build_tablet_group_info_()
|
|||||||
tablet_group_id_array.reset();
|
tablet_group_id_array.reset();
|
||||||
|
|
||||||
if (OB_FAIL(tablet_simple_info_map.get_refactored(tablet_id, tablet_simple_info))) {
|
if (OB_FAIL(tablet_simple_info_map.get_refactored(tablet_id, tablet_simple_info))) {
|
||||||
LOG_WARN("failed to get tablet simple info", K(ret), K(tablet_id));
|
if (OB_HASH_NOT_EXIST == ret) {
|
||||||
|
FLOG_INFO("tablet do not exist in src ls, skip it", K(tablet_id));
|
||||||
|
ret = OB_SUCCESS;
|
||||||
|
} else {
|
||||||
|
LOG_WARN("failed to get tablet simple info", K(ret), K(tablet_id));
|
||||||
|
}
|
||||||
} else if (!tablet_simple_info.is_valid()) {
|
} else if (!tablet_simple_info.is_valid()) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("tablet simple info is not valid", K(ret), K(tablet_simple_info));
|
LOG_WARN("tablet simple info is not valid", K(ret), K(tablet_simple_info));
|
||||||
|
|||||||
@ -967,83 +967,38 @@ int ObCopyTabletInfoObProducer::get_next_tablet_info(obrpc::ObCopyTabletInfo &ta
|
|||||||
if (!is_inited_) {
|
if (!is_inited_) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("copy tablet info ob producer do not init", K(ret));
|
LOG_WARN("copy tablet info ob producer do not init", K(ret));
|
||||||
} else if (tablet_index_ == tablet_id_array_.count()) {
|
|
||||||
ret = OB_ITER_END;
|
|
||||||
} else {
|
} else {
|
||||||
const ObTabletID &tablet_id = tablet_id_array_.at(tablet_index_);
|
while (OB_SUCC(ret)) {
|
||||||
if (OB_ISNULL(ls = ls_handle_.get_ls())) {
|
if (tablet_index_ == tablet_id_array_.count()) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ITER_END;
|
||||||
LOG_WARN("log stream should not be NULL", K(ret), KP(ls));
|
} else {
|
||||||
} else if (OB_FAIL(ls->get_tablet(tablet_id, tablet_handle, timeout_us))) {
|
const ObTabletID &tablet_id = tablet_id_array_.at(tablet_index_);
|
||||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id), K(tablet_handle));
|
if (OB_ISNULL(ls = ls_handle_.get_ls())) {
|
||||||
//TODO(muwei.ym) now do not support get tablet info with tablet already deleted.
|
ret = OB_ERR_UNEXPECTED;
|
||||||
// if (OB_TABLET_NOT_EXIST == ret) {
|
LOG_WARN("log stream should not be NULL", K(ret), KP(ls));
|
||||||
// //overwrite ret
|
} else if (OB_FAIL(ls->get_tablet(tablet_id, tablet_handle, timeout_us))) {
|
||||||
// if (OB_FAIL(build_deleted_tablet_info_(ls->get_ls_id(), tablet_id, tablet_info))) {
|
if (OB_TABLET_NOT_EXIST == ret) {
|
||||||
// LOG_WARN("failed to build delete tablet info", K(ret), KPC(ls), K(tablet_id));
|
LOG_INFO("tablet in src not exist", K(ls->get_ls_id()), K(tablet_id));
|
||||||
// } else {
|
tablet_index_++;
|
||||||
// tablet_index_++;
|
ret = OB_SUCCESS;
|
||||||
// }
|
} else {
|
||||||
// } else {
|
LOG_WARN("failed to get tablet", K(ret), K(tablet_id), K(tablet_handle));
|
||||||
// LOG_WARN("failed to get tablet", K(ret), K(tablet_id), K(tablet_handle));
|
}
|
||||||
// }
|
} else if (OB_ISNULL(tablet = tablet_handle.get_obj())) {
|
||||||
} else if (OB_ISNULL(tablet = tablet_handle.get_obj())) {
|
ret = OB_ERR_UNEXPECTED;
|
||||||
ret = OB_ERR_UNEXPECTED;
|
LOG_WARN("tablet should not be NULL", K(ret), KP(tablet), K(tablet_id));
|
||||||
LOG_WARN("tablet should not be NULL", K(ret), KP(tablet), K(tablet_id));
|
} else if (OB_FAIL(tablet->build_migration_tablet_param(tablet_info.param_))) {
|
||||||
} else if (OB_FAIL(tablet->build_migration_tablet_param(tablet_info.param_))) {
|
LOG_WARN("failed to build migration tablet param", K(ret), K(tablet_id));
|
||||||
LOG_WARN("failed to build migration tablet param", K(ret), K(tablet_id));
|
} else if (OB_FAIL(tablet->get_ha_sstable_size(tablet_info.data_size_))) {
|
||||||
} else if (OB_FAIL(tablet->get_ha_sstable_size(tablet_info.data_size_))) {
|
LOG_WARN("failed to get sstable size", K(ret), K(tablet_id));
|
||||||
LOG_WARN("failed to get sstable size", K(ret), K(tablet_id));
|
} else {
|
||||||
} else {
|
tablet_info.tablet_id_ = tablet_id;
|
||||||
tablet_info.tablet_id_ = tablet_id;
|
tablet_info.status_ = ObCopyTabletStatus::TABLET_EXIST;
|
||||||
tablet_info.status_ = tablet_info.param_.tx_data_.tablet_status_ != ObTabletStatus::DELETED
|
tablet_index_++;
|
||||||
? ObCopyTabletStatus::TABLET_EXIST : ObCopyTabletStatus::TABLET_NOT_EXIST;
|
LOG_INFO("succeed get copy tablet info", K(tablet_info), K(tablet_index_));
|
||||||
tablet_index_++;
|
break;
|
||||||
LOG_INFO("succeed get copy tablet info", K(tablet_info), K(tablet_index_));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ObCopyTabletInfoObProducer::build_deleted_tablet_info_(
|
|
||||||
const share::ObLSID &ls_id,
|
|
||||||
const ObTabletID &tablet_id,
|
|
||||||
obrpc::ObCopyTabletInfo &tablet_info)
|
|
||||||
{
|
|
||||||
int ret = OB_SUCCESS;
|
|
||||||
|
|
||||||
if (!is_inited_) {
|
|
||||||
ret = OB_NOT_INIT;
|
|
||||||
LOG_WARN("copy tablet info ob producer do not init", K(ret));
|
|
||||||
} else {
|
|
||||||
const ObTabletRestoreStatus::STATUS restore_status = ObTabletRestoreStatus::FULL;
|
|
||||||
const ObTabletDataStatus::STATUS data_status = ObTabletDataStatus::COMPLETE;
|
|
||||||
tablet_info.tablet_id_ = tablet_id;
|
|
||||||
tablet_info.status_ = ObCopyTabletStatus::TABLET_NOT_EXIST;
|
|
||||||
tablet_info.param_.ls_id_ = ls_id;
|
|
||||||
tablet_info.param_.tablet_id_ = tablet_id;
|
|
||||||
tablet_info.param_.data_tablet_id_ = tablet_id;
|
|
||||||
tablet_info.param_.create_scn_ = ObTabletMeta::INIT_CREATE_SCN;
|
|
||||||
tablet_info.param_.start_scn_ = ObTabletMeta::INIT_CLOG_CHECKPOINT_SCN;
|
|
||||||
tablet_info.param_.clog_checkpoint_scn_ = ObTabletMeta::INIT_CLOG_CHECKPOINT_SCN;
|
|
||||||
tablet_info.param_.compat_mode_ = lib::Worker::get_compatibility_mode();
|
|
||||||
tablet_info.param_.multi_version_start_ = 0;
|
|
||||||
tablet_info.param_.snapshot_version_ = 0;
|
|
||||||
tablet_info.param_.tx_data_.tablet_status_ = ObTabletStatus::DELETING;
|
|
||||||
tablet_info.param_.tx_data_.tx_scn_ = SCN::min_scn();
|
|
||||||
|
|
||||||
if (OB_FAIL(tablet_info.param_.ha_status_.set_restore_status(restore_status))) {
|
|
||||||
LOG_WARN("failed to set restore status", K(ret), K(restore_status));
|
|
||||||
} else if (OB_FAIL(tablet_info.param_.ha_status_.set_data_status(data_status))) {
|
|
||||||
LOG_WARN("failed to set data status", K(ret), K(data_status));
|
|
||||||
} else if (OB_FAIL(ObMigrationTabletParam::construct_placeholder_storage_schema_and_medium(
|
|
||||||
tablet_info.param_.allocator_,
|
|
||||||
tablet_info.param_.storage_schema_,
|
|
||||||
tablet_info.param_.medium_info_list_))) {
|
|
||||||
LOG_WARN("failed to construct placeholder storage schema");
|
|
||||||
} else if (!tablet_info.param_.is_valid()) {
|
|
||||||
ret = OB_INVALID_ARGUMENT;
|
|
||||||
LOG_WARN("create tablet param is invalid", K(ret), K(tablet_info));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@ -266,11 +266,6 @@ public:
|
|||||||
const common::ObIArray<common::ObTabletID> &tablet_id_array);
|
const common::ObIArray<common::ObTabletID> &tablet_id_array);
|
||||||
|
|
||||||
int get_next_tablet_info(obrpc::ObCopyTabletInfo &tablet_info);
|
int get_next_tablet_info(obrpc::ObCopyTabletInfo &tablet_info);
|
||||||
private:
|
|
||||||
int build_deleted_tablet_info_(
|
|
||||||
const share::ObLSID &ls_id,
|
|
||||||
const ObTabletID &tablet_id,
|
|
||||||
obrpc::ObCopyTabletInfo &tablet_info);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_inited_;
|
bool is_inited_;
|
||||||
|
|||||||
Reference in New Issue
Block a user