Observer adapted rs wake-up transfer task retry mechanism

This commit is contained in:
obdev
2023-12-05 17:12:09 +00:00
committed by ob-robot
parent 5c7d80971b
commit c1e3aac184
8 changed files with 73 additions and 42 deletions

View File

@ -20,6 +20,7 @@
#include "ob_transfer_service.h"
#include "storage/tablet/ob_tablet.h"
#include "ob_rebuild_service.h"
#include "ob_storage_ha_utils.h"
using namespace oceanbase;
using namespace common;
@ -756,8 +757,7 @@ int ObStartPrepareMigrationTask::deal_with_local_ls_()
int ret = OB_SUCCESS;
ObLSHandle ls_handle;
ObLS *ls = nullptr;
ObRole role;
int64_t proposal_id = 0;
bool is_leader = false;
ObLSSavedInfo saved_info;
if (!is_inited_) {
@ -768,18 +768,19 @@ int ObStartPrepareMigrationTask::deal_with_local_ls_()
} else if (OB_ISNULL(ls = ls_handle.get_ls())) {
ret = OB_ERR_SYS;
LOG_ERROR("log stream should not be NULL", K(ret), K(*ctx_));
} else if (OB_FAIL(ls->get_log_handler()->get_role(role, proposal_id))) {
LOG_WARN("failed to get role", K(ret), "arg", ctx_->arg_);
} else if (is_strong_leader(role)) {
} else if (OB_FAIL(ObStorageHAUtils::check_ls_is_leader(
ctx_->tenant_id_, ctx_->arg_.ls_id_, is_leader))) {
LOG_WARN("failed to check ls leader", K(ret), KPC(ctx_));
} else if (is_leader) {
if (ObMigrationOpType::REBUILD_LS_OP == ctx_->arg_.type_) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("leader can not as rebuild dst", K(ret), K(role), "myaddr", MYADDR, "arg", ctx_->arg_);
LOG_ERROR("leader can not as rebuild dst", K(ret), K(is_leader), "myaddr", MYADDR, "arg", ctx_->arg_);
} else if (ObMigrationOpType::ADD_LS_OP == ctx_->arg_.type_
|| ObMigrationOpType::MIGRATE_LS_OP == ctx_->arg_.type_
|| ObMigrationOpType::CHANGE_LS_OP == ctx_->arg_.type_) {
ret = OB_ERR_SYS;
LOG_WARN("leader cannot as add, migrate, change dst",
K(ret), K(role), "myaddr", MYADDR, "arg", ctx_->arg_);
K(ret), K(is_leader), "myaddr", MYADDR, "arg", ctx_->arg_);
}
}