Fix ls rebuild clear rebuild info when server is restart.
This commit is contained in:
@ -31,6 +31,7 @@ using namespace share;
|
|||||||
using namespace storage;
|
using namespace storage;
|
||||||
|
|
||||||
ERRSIM_POINT_DEF(WAIT_CLOG_SYNC_FAILED);
|
ERRSIM_POINT_DEF(WAIT_CLOG_SYNC_FAILED);
|
||||||
|
ERRSIM_POINT_DEF(SERVER_STOP_BEFORE_UPDATE_MIGRATION_STATUS);
|
||||||
/******************ObLSCompleteMigrationCtx*********************/
|
/******************ObLSCompleteMigrationCtx*********************/
|
||||||
ObLSCompleteMigrationCtx::ObLSCompleteMigrationCtx()
|
ObLSCompleteMigrationCtx::ObLSCompleteMigrationCtx()
|
||||||
: ObIHADagNetCtx(),
|
: ObIHADagNetCtx(),
|
||||||
@ -347,6 +348,7 @@ int ObLSCompleteMigrationDagNet::trans_rebuild_fail_status_(
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObLSCompleteMigrationDagNet::update_migration_status_(ObLS *ls)
|
int ObLSCompleteMigrationDagNet::update_migration_status_(ObLS *ls)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
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 current_migration_status = ObMigrationStatus::OB_MIGRATION_STATUS_MAX;
|
||||||
ObMigrationStatus new_migration_status = ObMigrationStatus::OB_MIGRATION_STATUS_MAX;
|
ObMigrationStatus new_migration_status = ObMigrationStatus::OB_MIGRATION_STATUS_MAX;
|
||||||
bool need_update_status = true;
|
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()) {
|
if (ls->is_stopped()) {
|
||||||
ret = OB_NOT_RUNNING;
|
ret = OB_NOT_RUNNING;
|
||||||
LOG_WARN("ls is not running, stop migration dag net", K(ret), K(ctx_));
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -724,6 +724,11 @@ int ObRebuildService::check_can_rebuild_(
|
|||||||
FLOG_INFO("leader cannot rebuild", KPC(ls));
|
FLOG_INFO("leader cannot rebuild", KPC(ls));
|
||||||
} else {
|
} else {
|
||||||
can_rebuild = true;
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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));
|
LOG_WARN("invalid rebuild info", K(ret), K(rebuild_info_), K(rebuild_info));
|
||||||
} else if (rebuild_info_ == rebuild_info) {
|
} else if (rebuild_info_ == rebuild_info) {
|
||||||
//do nothing
|
//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 {
|
} else {
|
||||||
ObLSMeta tmp(*this);
|
ObLSMeta tmp(*this);
|
||||||
tmp.rebuild_info_ = rebuild_info;
|
tmp.rebuild_info_ = rebuild_info;
|
||||||
|
|||||||
Reference in New Issue
Block a user