From 38b30d15f603cc491dea29f4c1c34c8a7b96c185 Mon Sep 17 00:00:00 2001 From: godyangfight Date: Fri, 25 Nov 2022 07:38:10 +0000 Subject: [PATCH] Fix restore copy minor sstable which is same with dest minor sstable condition --- src/storage/high_availability/ob_ls_complete_migration.cpp | 3 +-- src/storage/ls/ob_ls_meta.cpp | 1 + src/storage/tablet/ob_tablet_table_store.cpp | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/storage/high_availability/ob_ls_complete_migration.cpp b/src/storage/high_availability/ob_ls_complete_migration.cpp index 05c2e3701..2f2663e78 100644 --- a/src/storage/high_availability/ob_ls_complete_migration.cpp +++ b/src/storage/high_availability/ob_ls_complete_migration.cpp @@ -1183,7 +1183,6 @@ int ObStartCompleteMigrationTask::update_ls_migration_status_hold_() int ret = OB_SUCCESS; ObLS *ls = nullptr; const ObMigrationStatus hold_status = ObMigrationStatus::OB_MIGRATION_STATUS_HOLD; - int64_t rebuild_seq = 0; if (!is_inited_) { ret = OB_NOT_INIT; @@ -1193,7 +1192,7 @@ int ObStartCompleteMigrationTask::update_ls_migration_status_hold_() } else if (OB_ISNULL(ls = ls_handle_.get_ls())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("failed to change member list", K(ret), KP(ls)); - } else if (OB_FAIL(ls->set_migration_status(hold_status, rebuild_seq))) { + } else if (OB_FAIL(ls->set_migration_status(hold_status, ctx_->rebuild_seq_))) { LOG_WARN("failed to set migration status", K(ret), KPC(ls)); } else { #ifdef ERRSIM diff --git a/src/storage/ls/ob_ls_meta.cpp b/src/storage/ls/ob_ls_meta.cpp index e0c3065e9..654f91376 100644 --- a/src/storage/ls/ob_ls_meta.cpp +++ b/src/storage/ls/ob_ls_meta.cpp @@ -443,6 +443,7 @@ int ObLSMeta::update_ls_meta( replayable_point_ = src_ls_meta.replayable_point_; tablet_change_checkpoint_ts_ = src_ls_meta.tablet_change_checkpoint_ts_; all_id_meta_.update_all_id_meta(src_ls_meta.all_id_meta_); + rebuild_seq_ = tmp.rebuild_seq_; if (update_restore_status) { restore_status_ = ls_restore_status; } diff --git a/src/storage/tablet/ob_tablet_table_store.cpp b/src/storage/tablet/ob_tablet_table_store.cpp index 71a982a1e..f21da2f0d 100644 --- a/src/storage/tablet/ob_tablet_table_store.cpp +++ b/src/storage/tablet/ob_tablet_table_store.cpp @@ -1423,6 +1423,8 @@ int ObTabletTableStore::combin_ha_minor_sstables_( break; } else if (OB_FAIL(new_minor_sstables.push_back(table))) { LOG_WARN("failed to push minor table into array", K(ret), K(old_store_minor_sstables), KPC(table)); + } else { + max_copy_end_log_ts = std::max(table->get_end_log_ts(), max_copy_end_log_ts); } } @@ -1461,6 +1463,10 @@ int ObTabletTableStore::combin_ha_minor_sstables_( if (OB_ISNULL(new_table) || !new_table->is_minor_sstable()) { ret = OB_ERR_UNEXPECTED; LOG_WARN("new table is null or table type is unexpected", K(ret), KPC(new_table)); + } else if (new_table->get_end_log_ts() <= max_copy_end_log_ts) { + //do nothing + //need_add_minor_sstables is copied from src. + //Old table store table will be reused when new table end log ts is smaller than old table. } else if (OB_FAIL(new_minor_sstables.push_back(new_table))) { LOG_WARN("failed to push minor table into array", K(ret), K(new_minor_sstables), KPC(new_table)); } else {