fix table_redefinint_task before call finish_redef_task() reach after repending status

This commit is contained in:
obdev
2023-06-07 03:42:52 +00:00
committed by ob-robot
parent 030affc1d8
commit 06dba0282f
3 changed files with 16 additions and 12 deletions

View File

@ -828,10 +828,9 @@ int ObTableRedefinitionTask::repending(const share::ObDDLTaskStatus next_task_st
return ret;
}
bool ObTableRedefinitionTask::check_task_status_before_pending(const share::ObDDLTaskStatus task_status)
bool ObTableRedefinitionTask::check_task_status_is_pending(const share::ObDDLTaskStatus task_status)
{
return task_status == ObDDLTaskStatus::PREPARE || task_status == ObDDLTaskStatus::WAIT_TRANS_END
|| task_status == ObDDLTaskStatus::LOCK_TABLE || task_status == ObDDLTaskStatus::CHECK_TABLE_EMPTY;
return task_status == ObDDLTaskStatus::REPENDING;
}
int ObTableRedefinitionTask::process()

View File

@ -65,7 +65,7 @@ public:
virtual bool support_longops_monitoring() const override { return true; }
virtual void flt_set_task_span_tag() const override;
virtual void flt_set_status_span_tag() const override;
static bool check_task_status_before_pending(const share::ObDDLTaskStatus task_status);
static bool check_task_status_is_pending(const share::ObDDLTaskStatus task_status);
INHERIT_TO_STRING_KV("ObDDLRedefinitionTask", ObDDLRedefinitionTask,
K(has_rebuild_index_), K(has_rebuild_constraint_), K(has_rebuild_foreign_key_),
K(is_copy_indexes_), K(is_copy_triggers_), K(is_copy_constraints_),

View File

@ -287,6 +287,18 @@ int ObDDLServerClient::wait_task_reach_pending(const uint64_t tenant_id, const i
} else if (OB_FAIL(result->next())) {
if (OB_LIKELY(OB_ITER_END == ret)) {
ret = OB_ENTRY_NOT_EXIST;
ObAddr unused_addr;
int64_t forward_user_msg_len = 0;
ObDDLErrorMessageTableOperator::ObBuildDDLErrorMessage error_message;
if (OB_SUCCESS == ObDDLErrorMessageTableOperator::get_ddl_error_message(
tenant_id, task_id, -1 /* target_object_id */,
unused_addr, true /* is_ddl_retry_task */,
*GCTX.sql_proxy_, error_message, forward_user_msg_len)) {
if (OB_SUCCESS != error_message.ret_code_) {
ret = error_message.ret_code_;
}
}
LOG_WARN("ddl task execute end", K(ret));
} else {
LOG_WARN("fail to get next row", K(ret));
}
@ -295,14 +307,7 @@ int ObDDLServerClient::wait_task_reach_pending(const uint64_t tenant_id, const i
EXTRACT_INT_FIELD_MYSQL(*result, "status", task_status, int);
EXTRACT_UINT_FIELD_MYSQL(*result, "snapshot_version", snapshot_version, uint64_t);
share::ObDDLTaskStatus task_cur_status = static_cast<share::ObDDLTaskStatus>(task_status);
if (rootserver::ObTableRedefinitionTask::check_task_status_before_pending(task_cur_status)) {
LOG_INFO("task status not equal REPENDING, Please Keep Waiting", K(task_status));
if (OB_FAIL(sql::ObDDLExecutorUtil::handle_session_exception(session))) {
break;
} else {
ob_usleep(retry_interval);
}
} else {
if (rootserver::ObTableRedefinitionTask::check_task_status_is_pending(task_cur_status)) {
break;
}
}