Fix rebuild 4005 bug

This commit is contained in:
godyangfight 2023-08-04 10:12:30 +00:00 committed by ob-robot
parent 0fc560ea70
commit 558f74a2d6
4 changed files with 41 additions and 22 deletions

View File

@ -1043,7 +1043,6 @@ int ObStartMigrationTask::deal_with_local_ls_()
ObRole role;
int64_t proposal_id = 0;
ObLSMeta local_ls_meta;
DEBUG_SYNC(BEFORE_MIGRATION_DISABLE_VOTE);
if (!is_inited_) {
ret = OB_NOT_INIT;
LOG_WARN("start migration task do not init", K(ret));

View File

@ -725,12 +725,14 @@ int ObStartPrepareMigrationTask::process()
LOG_WARN("failed to deal with local ls", K(ret), K(*ctx_));
} else if (OB_FAIL(wait_transfer_tablets_ready_())) {
LOG_WARN("failed to wait transfer tablets ready", K(ret), KPC(ctx_));
} else if (OB_FAIL(remove_local_incomplete_tablets_())) {
LOG_WARN("failed to remove local incomplete tablets", K(ret), KPC(ctx_));
}
//TODO(muwei.ym) delete it in 4.2 RC3
/*
else if (OB_FAIL(wait_log_replay_sync_())) {
else if (OB_FAIL(remove_local_incomplete_tablets_())) {
LOG_WARN("failed to remove local incomplete tablets", K(ret), KPC(ctx_));
} else if (OB_FAIL(remove_local_incomplete_tablets_())) {
LOG_WARN("failed to remove local incomplete tablets", K(ret), KPC(ctx_));
} else if (OB_FAIL(wait_log_replay_sync_())) {
LOG_WARN("failed to wait log replay sync", K(ret), KPC(ctx_));
} else if (OB_FAIL(wait_ls_checkpoint_scn_push_())) {
LOG_WARN("failed to wait ls checkpoint ts push", K(ret), KPC(ctx_));

View File

@ -18,6 +18,7 @@
#include "rootserver/ob_rs_event_history_table_operator.h"
#include "observer/ob_server.h"
#include "logservice/ob_log_service.h"
#include "observer/ob_server_event_history_table_operator.h"
using namespace oceanbase;
using namespace share;
@ -845,25 +846,42 @@ int ObLSRebuildMgr::do_with_init_status_(const ObLSRebuildInfo &rebuild_info)
if (!is_inited_) {
ret = OB_NOT_INIT;
LOG_WARN("ls rebuild mgr do not init", K(ret));
} else if (!rebuild_info.is_valid() || ObLSRebuildStatus::INIT != rebuild_info.status_) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("do with none status get invalid argument", K(ret), K(rebuild_info));
} else if (OB_ISNULL(ls = ls_handle_.get_ls())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("ls should not be NULL", K(ret), KP(ls), K(rebuild_info));
} else {
ROOTSERVICE_EVENT_ADD("disaster_recovery", "start_rebuild_ls_replica",
"tenant_id", tenant_id,
"ls_id", rebuild_ctx_.ls_id_,
"task_id", rebuild_ctx_.task_id_,
"source", MYADDR,
"destination", MYADDR,
"comment", "");
if (!rebuild_info.is_valid() || ObLSRebuildStatus::INIT != rebuild_info.status_) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("do with none status get invalid argument", K(ret), K(rebuild_info));
} else if (OB_ISNULL(ls = ls_handle_.get_ls())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("ls should not be NULL", K(ret), KP(ls), K(rebuild_info));
} else {
ROOTSERVICE_EVENT_ADD("disaster_recovery", "start_rebuild_ls_replica",
"tenant_id", tenant_id,
"ls_id", rebuild_ctx_.ls_id_,
"task_id", rebuild_ctx_.task_id_,
"source", MYADDR,
"destination", MYADDR,
"comment", "");
DEBUG_SYNC(BEFORE_MIGRATION_DISABLE_VOTE);
if (OB_FAIL(ls->disable_vote(need_check_log_missing))) {
LOG_WARN("failed to disable vote", K(ret), KPC(ls), K(rebuild_info));
} else if (OB_FAIL(switch_next_status_(rebuild_info, ret))) {
LOG_WARN("failed to switch next status", K(ret), K(rebuild_info));
if (OB_FAIL(ls->disable_vote(need_check_log_missing))) {
LOG_WARN("failed to disable vote", K(ret), KPC(ls), K(rebuild_info));
}
if (OB_FAIL(ret)) {
SERVER_EVENT_ADD("storage_ha", "rebuild_disable_vote_failed",
"tenant_id", tenant_id,
"ls_id", rebuild_ctx_.ls_id_.id(),
"task_id", rebuild_ctx_.task_id_,
"destination", MYADDR,
"type", rebuild_info.type_,
"result", ret,
"REBUILD_LS_OP");
}
}
if (OB_SUCCESS != (tmp_ret = switch_next_status_(rebuild_info, ret))) {
ret = OB_SUCCESS == ret ? tmp_ret : ret;
LOG_WARN("failed to switch next status", K(ret), K(tmp_ret), K(rebuild_info));
if (OB_SUCCESS != (tmp_ret = ls->enable_vote())) {
LOG_ERROR("failed to enable vote", K(tmp_ret), K(ret), K(rebuild_info), K(rebuild_ctx_));
}

View File

@ -536,7 +536,7 @@ void ObHATabletGroupCtx::reuse()
ObHATabletGroupMgr::ObHATabletGroupMgr()
: is_inited_(false),
lock_(),
allocator_("HATGMgr"),
allocator_("HATGMgr", OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID()),
tablet_group_ctx_array_(),
index_(0)
{