From ac0ac0671b9c7d8376532d03a7439c695f86b5a7 Mon Sep 17 00:00:00 2001 From: godyangfight Date: Thu, 29 Jun 2023 13:12:31 +0000 Subject: [PATCH] Fix transfer with migrate ls return sstable not exist bug. --- .../high_availability/ob_storage_ha_tablet_builder.cpp | 2 +- src/storage/ls/ob_ls_tablet_service.cpp | 3 +-- src/storage/tablet/ob_tablet.cpp | 5 +---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/storage/high_availability/ob_storage_ha_tablet_builder.cpp b/src/storage/high_availability/ob_storage_ha_tablet_builder.cpp index 73bba6135c..7b81042f17 100755 --- a/src/storage/high_availability/ob_storage_ha_tablet_builder.cpp +++ b/src/storage/high_availability/ob_storage_ha_tablet_builder.cpp @@ -873,7 +873,7 @@ int ObStorageHATabletsBuilder::get_remote_logical_minor_scn_range_( } else if (tablet->get_tablet_meta().has_transfer_table()) { //transfer tablet should copy whole sstable from src; scn_range.start_scn_ = ObTabletMeta::INIT_CLOG_CHECKPOINT_SCN; - scn_range.end_scn_.set_max(); + scn_range.end_scn_ = tablet->get_clog_checkpoint_scn(); } else if (minor_sstable_array.count() > 0 && OB_FAIL(minor_sstable_array.get_all_tables(sstables))) { LOG_WARN("failed to get all tables", K(ret), K(param_)); } else { diff --git a/src/storage/ls/ob_ls_tablet_service.cpp b/src/storage/ls/ob_ls_tablet_service.cpp index 6ae4a1f32f..13d677b4cd 100755 --- a/src/storage/ls/ob_ls_tablet_service.cpp +++ b/src/storage/ls/ob_ls_tablet_service.cpp @@ -5854,8 +5854,7 @@ int ObLSTabletService::set_allow_to_read_(ObLS *ls) if (OB_FAIL(ls->get_migration_and_restore_status(migration_status, restore_status))) { LOG_WARN("failed to get ls migration and restore status", K(ret), KPC(ls)); } else if (ObMigrationStatus::OB_MIGRATION_STATUS_NONE != migration_status - && ObLSRestoreStatus::RESTORE_MAJOR_DATA != restore_status - && ObLSRestoreStatus::RESTORE_NONE != restore_status) { + || ObLSRestoreStatus::RESTORE_NONE != restore_status) { allow_to_read_mgr_.disable_to_read(); FLOG_INFO("set ls do not allow to read", KPC(ls), K(migration_status), K(restore_status)); } else { diff --git a/src/storage/tablet/ob_tablet.cpp b/src/storage/tablet/ob_tablet.cpp index 0247b8035c..1d076c88d8 100755 --- a/src/storage/tablet/ob_tablet.cpp +++ b/src/storage/tablet/ob_tablet.cpp @@ -4880,7 +4880,6 @@ int ObTablet::build_transfer_in_tablet_status_( common::ObIAllocator &allocator) { int ret = OB_SUCCESS; - ObTabletCreateDeleteMdsUserData new_user_data; if (OB_UNLIKELY(!is_inited_)) { ret = OB_NOT_INIT; @@ -4888,7 +4887,6 @@ int ObTablet::build_transfer_in_tablet_status_( } else if (OB_FAIL(new_user_data.assign(user_data))) { LOG_WARN("assign user data failed", K(ret), K_(is_inited)); } else { - mds_data.tablet_status_.committed_kv_.get_ptr()->reset(); new_user_data.tablet_status_ = ObTabletStatus::TRANSFER_IN; new_user_data.transfer_ls_id_ = tablet_meta_.ls_id_; new_user_data.data_type_ = ObTabletMdsUserDataType::START_TRANSFER_IN; @@ -4904,7 +4902,6 @@ int ObTablet::build_transfer_in_tablet_status_( } else { mds::MdsDumpKV *uncommitted_kv = mds_data.tablet_status_.uncommitted_kv_.ptr_; const mds::MdsDumpKV *committed_kv = mds_data.tablet_status_.committed_kv_.ptr_; - if (OB_ISNULL(uncommitted_kv) || OB_ISNULL(committed_kv)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("dump kv is null", K(ret), KP(uncommitted_kv), KP(committed_kv)); @@ -4914,8 +4911,8 @@ int ObTablet::build_transfer_in_tablet_status_( mds::MdsDumpNode &node = uncommitted_kv->v_; node.allocator_ = &allocator; node.user_data_.assign(buffer, length); + mds_data.tablet_status_.committed_kv_.get_ptr()->reset(); } - } } return ret;