From 3bd554b0dbeaee01db039e2df21e4ab7b05994cc Mon Sep 17 00:00:00 2001 From: godyangfight Date: Fri, 9 Feb 2024 20:59:26 +0000 Subject: [PATCH] Fix transfer src ls do not start replay clog when it is already remove from member list. --- src/storage/high_availability/ob_storage_ha_struct.cpp | 10 ++++++++++ src/storage/high_availability/ob_storage_ha_struct.h | 2 ++ src/storage/high_availability/ob_transfer_service.cpp | 3 ++- src/storage/ls/ob_ls.cpp | 3 +-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/storage/high_availability/ob_storage_ha_struct.cpp b/src/storage/high_availability/ob_storage_ha_struct.cpp index ff12a29862..3cc86fc18b 100644 --- a/src/storage/high_availability/ob_storage_ha_struct.cpp +++ b/src/storage/high_availability/ob_storage_ha_struct.cpp @@ -834,6 +834,16 @@ int ObMigrationStatusHelper::check_migration_in_final_state( return ret; } +bool ObMigrationStatusHelper::can_gc_ls_without_check_dependency( + const ObMigrationStatus &cur_status) +{ + bool allow_gc = false; + if (check_migration_status_is_fail_(cur_status)) { + allow_gc = true; + } + return allow_gc; +} + /******************ObMigrationOpArg*********************/ ObMigrationOpArg::ObMigrationOpArg() : ls_id_(), diff --git a/src/storage/high_availability/ob_storage_ha_struct.h b/src/storage/high_availability/ob_storage_ha_struct.h index 54df630d08..91688b2d23 100644 --- a/src/storage/high_availability/ob_storage_ha_struct.h +++ b/src/storage/high_availability/ob_storage_ha_struct.h @@ -98,6 +98,8 @@ public: const ObMigrationStatus &status, bool &in_final_state); static bool check_is_running_migration(const ObMigrationStatus &cur_status); + static bool can_gc_ls_without_check_dependency( + const ObMigrationStatus &cur_status); private: static int check_ls_transfer_tablet_( const share::ObLSID &ls_id, diff --git a/src/storage/high_availability/ob_transfer_service.cpp b/src/storage/high_availability/ob_transfer_service.cpp index 707d00bb65..d4ee45e654 100644 --- a/src/storage/high_availability/ob_transfer_service.cpp +++ b/src/storage/high_availability/ob_transfer_service.cpp @@ -14,6 +14,7 @@ #include "ob_transfer_service.h" #include "storage/tx_storage/ob_ls_handle.h" #include "observer/ob_server_struct.h" +#include "storage/slog_ckpt/ob_server_checkpoint_slog_handler.h" namespace oceanbase { @@ -130,7 +131,7 @@ void ObTransferService::run1() while (!has_set_stop()) { ls_id_array_.reset(); - if (observer::ObServiceStatus::SS_SERVING != GCTX.status_) { + if (!ObServerCheckpointSlogHandler::get_instance().is_started()) { ret = OB_SERVER_IS_INIT; LOG_WARN("server is not serving", K(ret), K(GCTX.status_)); } else if (OB_FAIL(get_ls_id_array_())) { diff --git a/src/storage/ls/ob_ls.cpp b/src/storage/ls/ob_ls.cpp index 748a400645..0eb5459742 100644 --- a/src/storage/ls/ob_ls.cpp +++ b/src/storage/ls/ob_ls.cpp @@ -458,7 +458,7 @@ bool ObLS::is_need_gc() const bool_ret = true; } else if (OB_FAIL(ls_meta_.get_migration_status(migration_status))) { LOG_WARN("get migration status failed", K(ret), K(ls_meta_.ls_id_)); - } else if (ObMigrationStatusHelper::check_allow_gc_abandoned_ls(migration_status)) { + } else if (ObMigrationStatusHelper::can_gc_ls_without_check_dependency(migration_status)) { bool_ret = true; } if (bool_ret) { @@ -2510,7 +2510,6 @@ int ObLS::set_ls_migration_gc( } else if (OB_FAIL(ls_meta_.set_migration_status(change_status, write_slog))) { LOG_WARN("failed to set migration status", K(ret), K(change_status)); } else { - ls_tablet_svr_.disable_to_read(); allow_gc = true; } return ret;