diff --git a/src/share/ob_debug_sync_point.h b/src/share/ob_debug_sync_point.h index dd9138507f..82f3d279ad 100644 --- a/src/share/ob_debug_sync_point.h +++ b/src/share/ob_debug_sync_point.h @@ -434,6 +434,7 @@ class ObString; ACT(MODIFY_HIDDEN_TABLE_NOT_NULL_COLUMN_STATE_BEFORE_PUBLISH_SCHEMA,)\ ACT(AFTER_MIGRATION_FETCH_TABLET_INFO,)\ ACT(BEFORE_SET_LS_MEMBER_LIST,)\ + ACT(BEFORE_MIGRATION_FETCH_TABLET_INFO,)\ ACT(MAX_DEBUG_SYNC_POINT,) DECLARE_ENUM(ObDebugSyncPoint, debug_sync_point, OB_DEBUG_SYNC_POINT_DEF); diff --git a/src/storage/high_availability/ob_ls_migration.cpp b/src/storage/high_availability/ob_ls_migration.cpp index ee025226f2..584b204467 100644 --- a/src/storage/high_availability/ob_ls_migration.cpp +++ b/src/storage/high_availability/ob_ls_migration.cpp @@ -3008,10 +3008,12 @@ int ObDataTabletsMigrationTask::create_or_update_tablets_() LOG_WARN("data tablets migration task do not init", K(ret)); } else if (ctx_->data_tablet_id_array_.empty()) { 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())) { - LOG_WARN("failed to create or update tablets", K(ret), KPC(ctx_)); + } else { + 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; } @@ -3087,7 +3089,12 @@ int ObDataTabletsMigrationTask::build_tablet_group_info_() tablet_group_id_array.reset(); 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()) { ret = OB_ERR_UNEXPECTED; LOG_WARN("tablet simple info is not valid", K(ret), K(tablet_simple_info)); diff --git a/src/storage/high_availability/ob_storage_ha_reader.cpp b/src/storage/high_availability/ob_storage_ha_reader.cpp index 47631360dd..68725569ab 100644 --- a/src/storage/high_availability/ob_storage_ha_reader.cpp +++ b/src/storage/high_availability/ob_storage_ha_reader.cpp @@ -967,83 +967,38 @@ int ObCopyTabletInfoObProducer::get_next_tablet_info(obrpc::ObCopyTabletInfo &ta if (!is_inited_) { ret = OB_NOT_INIT; 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 { - const ObTabletID &tablet_id = tablet_id_array_.at(tablet_index_); - if (OB_ISNULL(ls = ls_handle_.get_ls())) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("log stream should not be NULL", K(ret), KP(ls)); - } else if (OB_FAIL(ls->get_tablet(tablet_id, tablet_handle, timeout_us))) { - LOG_WARN("failed to get tablet", K(ret), K(tablet_id), K(tablet_handle)); - //TODO(muwei.ym) now do not support get tablet info with tablet already deleted. -// if (OB_TABLET_NOT_EXIST == ret) { -// //overwrite ret -// if (OB_FAIL(build_deleted_tablet_info_(ls->get_ls_id(), tablet_id, tablet_info))) { -// LOG_WARN("failed to build delete tablet info", K(ret), KPC(ls), K(tablet_id)); -// } else { -// tablet_index_++; -// } -// } else { -// LOG_WARN("failed to get tablet", K(ret), K(tablet_id), K(tablet_handle)); -// } - } else if (OB_ISNULL(tablet = tablet_handle.get_obj())) { - ret = OB_ERR_UNEXPECTED; - 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_))) { - 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_))) { - LOG_WARN("failed to get sstable size", K(ret), K(tablet_id)); - } else { - tablet_info.tablet_id_ = tablet_id; - tablet_info.status_ = tablet_info.param_.tx_data_.tablet_status_ != ObTabletStatus::DELETED - ? ObCopyTabletStatus::TABLET_EXIST : ObCopyTabletStatus::TABLET_NOT_EXIST; - tablet_index_++; - 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)); + while (OB_SUCC(ret)) { + if (tablet_index_ == tablet_id_array_.count()) { + ret = OB_ITER_END; + } else { + const ObTabletID &tablet_id = tablet_id_array_.at(tablet_index_); + if (OB_ISNULL(ls = ls_handle_.get_ls())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("log stream should not be NULL", K(ret), KP(ls)); + } else if (OB_FAIL(ls->get_tablet(tablet_id, tablet_handle, timeout_us))) { + if (OB_TABLET_NOT_EXIST == ret) { + LOG_INFO("tablet in src not exist", K(ls->get_ls_id()), K(tablet_id)); + tablet_index_++; + ret = OB_SUCCESS; + } else { + LOG_WARN("failed to get tablet", K(ret), K(tablet_id), K(tablet_handle)); + } + } else if (OB_ISNULL(tablet = tablet_handle.get_obj())) { + ret = OB_ERR_UNEXPECTED; + 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_))) { + 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_))) { + LOG_WARN("failed to get sstable size", K(ret), K(tablet_id)); + } else { + tablet_info.tablet_id_ = tablet_id; + tablet_info.status_ = ObCopyTabletStatus::TABLET_EXIST; + tablet_index_++; + LOG_INFO("succeed get copy tablet info", K(tablet_info), K(tablet_index_)); + break; + } + } } } return ret; diff --git a/src/storage/high_availability/ob_storage_ha_reader.h b/src/storage/high_availability/ob_storage_ha_reader.h index 80c627c9bc..1d2feaf006 100644 --- a/src/storage/high_availability/ob_storage_ha_reader.h +++ b/src/storage/high_availability/ob_storage_ha_reader.h @@ -266,11 +266,6 @@ public: const common::ObIArray &tablet_id_array); 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: bool is_inited_;