repending() function is called at the wrong time

This commit is contained in:
obdev
2023-02-24 16:45:45 +08:00
committed by ob-robot
parent 5baf712d68
commit f8ceefb4be
3 changed files with 13 additions and 13 deletions

View File

@ -800,7 +800,8 @@ int ObTableRedefinitionTask::repending(const share::ObDDLTaskStatus next_task_st
bool ObTableRedefinitionTask::check_task_status_before_pending(const share::ObDDLTaskStatus task_status)
{
return task_status == ObDDLTaskStatus::PREPARE || task_status == ObDDLTaskStatus::WAIT_TRANS_END || task_status == ObDDLTaskStatus::LOCK_TABLE;
return task_status == ObDDLTaskStatus::PREPARE || task_status == ObDDLTaskStatus::WAIT_TRANS_END
|| task_status == ObDDLTaskStatus::LOCK_TABLE || task_status == ObDDLTaskStatus::CHECK_TABLE_EMPTY;
}
int ObTableRedefinitionTask::process()
@ -825,18 +826,18 @@ int ObTableRedefinitionTask::process()
}
break;
case ObDDLTaskStatus::LOCK_TABLE:
if (OB_FAIL(lock_table(ObDDLTaskStatus::REPENDING))) {
if (OB_FAIL(lock_table(ObDDLTaskStatus::CHECK_TABLE_EMPTY))) {
LOG_WARN("fail to lock table", K(ret));
}
break;
case ObDDLTaskStatus::REPENDING:
if (OB_FAIL(repending(ObDDLTaskStatus::CHECK_TABLE_EMPTY))) {
LOG_WARN("fail to repending", K(ret));
case ObDDLTaskStatus::CHECK_TABLE_EMPTY:
if (OB_FAIL(check_table_empty(ObDDLTaskStatus::REPENDING))) {
LOG_WARN("fail to check table empty", K(ret));
}
break;
case ObDDLTaskStatus::CHECK_TABLE_EMPTY:
if (OB_FAIL(check_table_empty(ObDDLTaskStatus::REDEFINITION))) {
LOG_WARN("fail to check table empty", K(ret));
case ObDDLTaskStatus::REPENDING:
if (OB_FAIL(repending(ObDDLTaskStatus::REDEFINITION))) {
LOG_WARN("fail to repending", K(ret));
}
break;
case ObDDLTaskStatus::REDEFINITION:

View File

@ -41,7 +41,7 @@ int ObDDLServerClient::create_hidden_table(const obrpc::ObCreateHiddenTableArg &
LOG_WARN("failed to create hidden table", KR(ret), K(arg));
} else if (OB_FAIL(OB_DDL_HEART_BEAT_TASK_CONTAINER.set_register_task_id(res.task_id_, res.tenant_id_))) {
LOG_WARN("failed to set register task id", K(ret), K(res));
} else if (OB_FAIL(wait_table_lock(arg.tenant_id_, res.task_id_, *GCTX.sql_proxy_, session))) {
} else if (OB_FAIL(wait_task_reach_pending(arg.tenant_id_, res.task_id_, *GCTX.sql_proxy_, session))) {
LOG_WARN("failed to wait table lock. remove register task id and abort redef table task.", K(ret), K(arg), K(res));
int tmp_ret = OB_SUCCESS;
obrpc::ObAbortRedefTableArg abort_redef_table_arg;
@ -71,7 +71,7 @@ int ObDDLServerClient::start_redef_table(const obrpc::ObStartRedefTableArg &arg,
LOG_WARN("failed to start redef table", KR(ret), K(arg));
} else if (OB_FAIL(OB_DDL_HEART_BEAT_TASK_CONTAINER.set_register_task_id(res.task_id_, res.tenant_id_))) {
LOG_WARN("failed to set register task id", K(ret), K(res));
} else if (OB_FAIL(wait_table_lock(arg.orig_tenant_id_, res.task_id_, *GCTX.sql_proxy_, session))) {
} else if (OB_FAIL(wait_task_reach_pending(arg.orig_tenant_id_, res.task_id_, *GCTX.sql_proxy_, session))) {
LOG_WARN("failed to wait table lock. remove register task id and abort redef table task.", K(ret), K(arg), K(res));
int tmp_ret = OB_SUCCESS;
obrpc::ObAbortRedefTableArg abort_redef_table_arg;
@ -86,7 +86,6 @@ int ObDDLServerClient::start_redef_table(const obrpc::ObStartRedefTableArg &arg,
}
return ret;
}
int ObDDLServerClient::copy_table_dependents(const obrpc::ObCopyTableDependentsArg &arg)
{
int ret = OB_SUCCESS;
@ -188,7 +187,7 @@ int ObDDLServerClient::build_ddl_single_replica_response(const obrpc::ObDDLBuild
return ret;
}
int ObDDLServerClient::wait_table_lock(const uint64_t tenant_id, const int64_t task_id, ObMySQLProxy &sql_proxy, sql::ObSQLSessionInfo &session)
int ObDDLServerClient::wait_task_reach_pending(const uint64_t tenant_id, const int64_t task_id, ObMySQLProxy &sql_proxy, sql::ObSQLSessionInfo &session)
{
int ret = OB_SUCCESS;
const int64_t retry_interval = 100 * 1000;

View File

@ -32,7 +32,7 @@ public:
static int abort_redef_table(const obrpc::ObAbortRedefTableArg &arg, sql::ObSQLSessionInfo &session);
static int build_ddl_single_replica_response(const obrpc::ObDDLBuildSingleReplicaResponseArg &arg);
private:
static int wait_table_lock(const uint64_t tenant_id, const int64_t task_id, ObMySQLProxy &sql_proxy, sql::ObSQLSessionInfo &session);
static int wait_task_reach_pending(const uint64_t tenant_id, const int64_t task_id, ObMySQLProxy &sql_proxy, sql::ObSQLSessionInfo &session);
static int heart_beat_clear(const int64_t task_id);
};