Fix ls rebuild clear rebuild info when server is restart.

This commit is contained in:
godyangfight
2023-10-24 02:15:22 +00:00
committed by ob-robot
parent 2d6c20d8bc
commit 9924d93c54
3 changed files with 32 additions and 0 deletions

View File

@ -31,6 +31,7 @@ using namespace share;
using namespace storage;
ERRSIM_POINT_DEF(WAIT_CLOG_SYNC_FAILED);
ERRSIM_POINT_DEF(SERVER_STOP_BEFORE_UPDATE_MIGRATION_STATUS);
/******************ObLSCompleteMigrationCtx*********************/
ObLSCompleteMigrationCtx::ObLSCompleteMigrationCtx()
: ObIHADagNetCtx(),
@ -347,6 +348,7 @@ int ObLSCompleteMigrationDagNet::trans_rebuild_fail_status_(
}
return ret;
}
int ObLSCompleteMigrationDagNet::update_migration_status_(ObLS *ls)
{
int ret = OB_SUCCESS;
@ -377,6 +379,17 @@ int ObLSCompleteMigrationDagNet::update_migration_status_(ObLS *ls)
ObMigrationStatus current_migration_status = ObMigrationStatus::OB_MIGRATION_STATUS_MAX;
ObMigrationStatus new_migration_status = ObMigrationStatus::OB_MIGRATION_STATUS_MAX;
bool need_update_status = true;
#ifdef ERRSIM
if (OB_SUCC(ret)) {
ret = SERVER_STOP_BEFORE_UPDATE_MIGRATION_STATUS ? : OB_SUCCESS;
if (OB_FAIL(ret)) {
STORAGE_LOG(ERROR, "fake SERVER_STOP_BEFORE_UPDATE_MIGRATION_STATUS", K(ret));
break;
}
}
#endif
if (ls->is_stopped()) {
ret = OB_NOT_RUNNING;
LOG_WARN("ls is not running, stop migration dag net", K(ret), K(ctx_));
@ -443,6 +456,14 @@ int ObLSCompleteMigrationDagNet::update_migration_status_(ObLS *ls)
}
}
}
if (OB_FAIL(ret)) {
int tmp_ret = OB_SUCCESS;
const bool need_retry = false;
if (OB_SUCCESS != (tmp_ret = ctx_.set_result(ret, need_retry))) {
LOG_ERROR("failed to set result", K(ret), K(ret), K(tmp_ret), K(ctx_));
}
}
return ret;
}

View File

@ -724,6 +724,11 @@ int ObRebuildService::check_can_rebuild_(
FLOG_INFO("leader cannot rebuild", KPC(ls));
} else {
can_rebuild = true;
if (ObLSRebuildType::CLOG == rebuild_ctx.type_
&& is_primary_tenant
&& member_list.contains(self_addr)) {
LOG_ERROR("paxos member lost clog, need rebuild", "ls_id", ls->get_ls_id(), K(role));
}
}
return ret;
}

View File

@ -729,6 +729,12 @@ int ObLSMeta::set_rebuild_info(const ObLSRebuildInfo &rebuild_info)
LOG_WARN("invalid rebuild info", K(ret), K(rebuild_info_), K(rebuild_info));
} else if (rebuild_info_ == rebuild_info) {
//do nothing
} else if (ObLSRebuildStatus::CLEANUP == rebuild_info.status_
&& ObMigrationStatus::OB_MIGRATION_STATUS_NONE != migration_status_
&& ObMigrationStatus::OB_MIGRATION_STATUS_REBUILD_FAIL != migration_status_) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("migration status in unexpected, can not set rebuild info to cleanup", K(ret),
K(rebuild_info), K(migration_status_), KPC(this));
} else {
ObLSMeta tmp(*this);
tmp.rebuild_info_ = rebuild_info;