fix idempotence of offline ddl when drop tenant simulatenously.

This commit is contained in:
obdev
2022-11-24 03:38:03 +00:00
committed by wangzelin.wzl
parent 1afa0ecf7b
commit f32896cc2f
7 changed files with 46 additions and 7 deletions

View File

@ -292,6 +292,7 @@ int ObDDLTask::switch_status(ObDDLTaskStatus new_status, const int ret_code)
int tmp_ret = OB_SUCCESS;
bool is_cancel = false;
int real_ret_code = ret_code;
bool is_tenant_dropped = false;
const ObDDLTaskStatus old_status = task_status_;
if (OB_TMP_FAIL(SYS_TASK_STATUS_MGR.is_task_cancel(trace_id_, is_cancel))) {
LOG_WARN("check task is canceled", K(tmp_ret), K(trace_id_));
@ -310,6 +311,11 @@ int ObDDLTask::switch_status(ObDDLTaskStatus new_status, const int ret_code)
if (OB_ISNULL(root_service = GCTX.root_service_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("error unexpected, root service must not be nullptr", K(ret));
} else if (OB_FAIL(root_service->get_schema_service().check_if_tenant_has_been_dropped(tenant_id_, is_tenant_dropped))) {
LOG_WARN("check if tenant has been dropped failed", K(ret), K(tenant_id_));
} else if (is_tenant_dropped) {
need_retry_ = false;
LOG_INFO("tenant has been dropped, exit anyway", K(ret), K(tenant_id_));
} else if (OB_FAIL(trans.start(&root_service->get_sql_proxy(), tenant_id_))) {
LOG_WARN("start transaction failed", K(ret));
} else {