Fix ls rebuild prepare wait transfer out tablet ready bug.

This commit is contained in:
godyangfight
2023-08-17 10:32:15 +00:00
committed by ob-robot
parent cb50e79964
commit 7cc45ec817
3 changed files with 36 additions and 4 deletions

View File

@ -30,6 +30,7 @@ using namespace common;
using namespace share; using namespace share;
using namespace storage; using namespace storage;
ERRSIM_POINT_DEF(WAIT_CLOG_SYNC_FAILED);
/******************ObLSCompleteMigrationCtx*********************/ /******************ObLSCompleteMigrationCtx*********************/
ObLSCompleteMigrationCtx::ObLSCompleteMigrationCtx() ObLSCompleteMigrationCtx::ObLSCompleteMigrationCtx()
: ObIHADagNetCtx(), : ObIHADagNetCtx(),
@ -1058,6 +1059,15 @@ int ObStartCompleteMigrationTask::wait_log_sync_()
LOG_WARN("log is not sync", K(ret), KPC(ctx_), K(cost_ts)); LOG_WARN("log is not sync", K(ret), KPC(ctx_), K(cost_ts));
} }
} }
#ifdef ERRSIM
if (OB_SUCC(ret)) {
ret = WAIT_CLOG_SYNC_FAILED ? : OB_SUCCESS;
if (OB_FAIL(ret)) {
STORAGE_LOG(ERROR, "fake WAIT_CLOG_SYNC_FAILED", K(ret));
}
}
#endif
return ret; return ret;
} }

View File

@ -568,7 +568,8 @@ int ObLSMigrationHandler::do_init_status_()
|| ObMigrationStatus::OB_MIGRATION_STATUS_REBUILD == migration_status) { || ObMigrationStatus::OB_MIGRATION_STATUS_REBUILD == migration_status) {
//do nothing //do nothing
} else if (ObMigrationStatus::OB_MIGRATION_STATUS_ADD_FAIL != migration_status } else if (ObMigrationStatus::OB_MIGRATION_STATUS_ADD_FAIL != migration_status
&& ObMigrationStatus::OB_MIGRATION_STATUS_MIGRATE_FAIL != migration_status) { && ObMigrationStatus::OB_MIGRATION_STATUS_MIGRATE_FAIL != migration_status
&& ObMigrationStatus::OB_MIGRATION_STATUS_GC != migration_status) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("ls migration handler in init status but ls migration status is in failed status", LOG_WARN("ls migration handler in init status but ls migration status is in failed status",
K(ret), K(is_empty), K(migration_status), KPC(ls_)); K(ret), K(is_empty), K(migration_status), KPC(ls_));
@ -1004,13 +1005,21 @@ int ObLSMigrationHandler::check_can_skip_prepare_status_(bool &can_skip)
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
ObLSMigrationTask task; ObLSMigrationTask task;
can_skip = false; can_skip = false;
ObMigrationStatus status = ObMigrationStatus::OB_MIGRATION_STATUS_MAX;
if (!is_inited_) { if (!is_inited_) {
ret = OB_NOT_INIT; ret = OB_NOT_INIT;
LOG_WARN("ls migration handler do not init", K(ret)); LOG_WARN("ls migration handler do not init", K(ret));
} else if (OB_FAIL(get_ls_migration_task_(task))) { } else if (OB_FAIL(get_ls_migration_task_(task))) {
LOG_WARN("failed to get ls migration task", K(ret), KPC(ls_)); LOG_WARN("failed to get ls migration task", K(ret), KPC(ls_));
} else if (ObMigrationOpType::REBUILD_LS_OP == task.arg_.type_) { } else if (ObMigrationOpType::REBUILD_LS_OP == task.arg_.type_) {
can_skip = false; if (OB_FAIL(ls_->get_migration_status(status))) {
LOG_WARN("failed to get migration status", K(ret), K(status));
} else if (ObMigrationStatus::OB_MIGRATION_STATUS_NONE == status) {
can_skip = false;
} else {
can_skip = true;
LOG_INFO("skip ls migration prepare status", K(status));
}
} else { } else {
can_skip = true; can_skip = true;
} }

View File

@ -24,6 +24,7 @@ namespace oceanbase
{ {
namespace storage namespace storage
{ {
ERRSIM_POINT_DEF(EN_REBUILD_FAILED_STATUS);
/******************ObMigrationOpType*********************/ /******************ObMigrationOpType*********************/
static const char *migration_op_type_strs[] = { static const char *migration_op_type_strs[] = {
@ -590,7 +591,8 @@ int ObMigrationStatusHelper::check_can_change_status(
case OB_MIGRATION_STATUS_REBUILD: { case OB_MIGRATION_STATUS_REBUILD: {
if (OB_MIGRATION_STATUS_NONE == change_status if (OB_MIGRATION_STATUS_NONE == change_status
|| OB_MIGRATION_STATUS_REBUILD == change_status || OB_MIGRATION_STATUS_REBUILD == change_status
|| OB_MIGRATION_STATUS_REBUILD_WAIT == change_status) { || OB_MIGRATION_STATUS_REBUILD_WAIT == change_status
|| OB_MIGRATION_STATUS_REBUILD_FAIL == change_status) {
can_change = true; can_change = true;
} }
break; break;
@ -635,7 +637,8 @@ int ObMigrationStatusHelper::check_can_change_status(
case OB_MIGRATION_STATUS_REBUILD_WAIT: { case OB_MIGRATION_STATUS_REBUILD_WAIT: {
if (OB_MIGRATION_STATUS_NONE == change_status if (OB_MIGRATION_STATUS_NONE == change_status
|| OB_MIGRATION_STATUS_REBUILD_WAIT == change_status || OB_MIGRATION_STATUS_REBUILD_WAIT == change_status
|| OB_MIGRATION_STATUS_REBUILD == change_status) { || OB_MIGRATION_STATUS_REBUILD == change_status
|| OB_MIGRATION_STATUS_REBUILD_FAIL == change_status) {
can_change = true; can_change = true;
} }
break; break;
@ -684,6 +687,16 @@ int ObMigrationStatusHelper::trans_rebuild_fail_status(
} else { } else {
fail_status = OB_MIGRATION_STATUS_REBUILD; fail_status = OB_MIGRATION_STATUS_REBUILD;
} }
#ifdef ERRSIM
if (OB_SUCC(ret)) {
ret = EN_REBUILD_FAILED_STATUS ? : OB_SUCCESS;
if (OB_FAIL(ret)) {
fail_status = OB_MIGRATION_STATUS_REBUILD_FAIL;
ret = OB_SUCCESS;
}
}
#endif
return ret; return ret;
} }