From efa23e5feeff196091738aef133ba981c8364dd0 Mon Sep 17 00:00:00 2001 From: oceanoverflow Date: Tue, 12 Mar 2024 12:15:14 +0000 Subject: [PATCH] [CP] reset multi_version_start at restore start --- src/storage/high_availability/ob_ls_restore.cpp | 17 +++++++++++++++++ src/storage/high_availability/ob_ls_restore.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/storage/high_availability/ob_ls_restore.cpp b/src/storage/high_availability/ob_ls_restore.cpp index 82719f348..228b9c532 100644 --- a/src/storage/high_availability/ob_ls_restore.cpp +++ b/src/storage/high_availability/ob_ls_restore.cpp @@ -1063,6 +1063,8 @@ int ObStartLSRestoreTask::update_ls_meta_and_create_all_tablets_() && OB_FAIL(ctx_->sys_tablet_id_array_.push_back(tablet_info.param_.tablet_id_))) { LOG_WARN("failed to push sys tablet id into array", K(ret), "array count", ctx_->sys_tablet_id_array_.count()); } else if (!tablet_info.param_.is_empty_shell() && OB_FALSE_IT(set_tablet_to_restore(tablet_info.param_))) { + } else if (OB_FAIL(reset_multi_version_start_(tablet_info.param_))) { + LOG_WARN("failed to reset multi version start", K(ret), K(tablet_info)); } else if (OB_FAIL(create_tablet_(tablet_info.param_, ls))) { LOG_WARN("failed to create tablet", K(ret)); } else { @@ -1181,6 +1183,21 @@ int ObStartLSRestoreTask::generate_tablets_restore_dag_() return ret; } +int ObStartLSRestoreTask::reset_multi_version_start_(ObMigrationTabletParam ¶m) +{ + int ret = OB_SUCCESS; + if (!param.is_valid()) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("param is not valid", K(ret), K(param)); + } else { + // We reset the multi version start of the tablet migration parameter that is backup in backup consistent SCN stage. + // This stage does not have any SSTables and only serves as a placeholder. + // So the multi version start can be reset to 0 and then pushed up in the restore minor stage and restore major stage. + param.multi_version_start_ = 0; + } + return ret; +} + /******************ObSysTabletsRestoreDag*********************/ ObSysTabletsRestoreDag::ObSysTabletsRestoreDag() : ObLSRestoreDag(ObDagType::DAG_TYPE_SYS_TABLETS_RESTORE), diff --git a/src/storage/high_availability/ob_ls_restore.h b/src/storage/high_availability/ob_ls_restore.h index d81c6f8d2..84aba4174 100644 --- a/src/storage/high_availability/ob_ls_restore.h +++ b/src/storage/high_availability/ob_ls_restore.h @@ -213,6 +213,7 @@ private: void free_copy_ls_view_reader_(ObICopyLSViewInfoReader *&reader); int generate_tablet_id_array_( const ObIArray &tablet_id_array); + int reset_multi_version_start_(ObMigrationTabletParam ¶m); private: bool is_inited_; ObLSRestoreCtx *ctx_;