Drop/truncate part/table/db without ddl retry task

This commit is contained in:
Hongqin-Li
2023-08-08 04:48:26 +00:00
committed by ob-robot
parent ca5f363b3d
commit 51bb12a3f6
10 changed files with 8 additions and 72 deletions

View File

@ -188,6 +188,7 @@ int ObDropDatabaseExecutor::execute(ObExecContext &ctx, ObDropDatabaseStmt &stmt
const obrpc::ObDropDatabaseArg &drop_database_arg = stmt.get_drop_database_arg();
obrpc::ObDropDatabaseArg &tmp_arg = const_cast<obrpc::ObDropDatabaseArg&>(drop_database_arg);
ObString first_stmt;
uint64_t database_id = 0;
if (OB_FAIL(stmt.get_first_stmt(first_stmt))) {
SQL_ENG_LOG(WARN, "fail to get first stmt" , K(ret));
} else {
@ -229,25 +230,12 @@ int ObDropDatabaseExecutor::execute(ObExecContext &ctx, ObDropDatabaseStmt &stmt
} else if (OB_FAIL(ctx.get_my_session()->set_default_database(null_string, server_coll_type))) {
SQL_ENG_LOG(WARN, "fail to set default database", K(ret), K(stmt.get_server_collation()), K(server_coll_type));
} else {
ctx.get_physical_plan_ctx()->set_affected_rows(drop_database_res.affected_row_);
ctx.get_my_session()->set_database_id(OB_INVALID_ID);
}
}
}
if (OB_SUCC(ret) && drop_database_res.is_valid()) {
int64_t affected_rows = 0;
ObSQLSessionInfo *my_session = nullptr;
if (OB_ISNULL(my_session = ctx.get_my_session())) {
ret = OB_ERR_UNEXPECTED;
SQL_ENG_LOG(WARN, "my_session is nullptr", K(ret));
} else if (drop_database_res.is_valid() &&
OB_FAIL(ObDDLExecutorUtil::wait_ddl_retry_task_finish(drop_database_res.ddl_res_.tenant_id_,
drop_database_res.ddl_res_.task_id_,
*my_session, common_rpc_proxy, affected_rows))) {
SQL_ENG_LOG(WARN, "wait ddl finish failed", K(ret));
} else {
ctx.get_physical_plan_ctx()->set_affected_rows(affected_rows);
}
if (OB_SUCC(ret)) {
ctx.get_physical_plan_ctx()->set_affected_rows(drop_database_res.affected_row_);
}
}
SQL_ENG_LOG(INFO, "finish execute drop database.", K(ret), K(stmt));

View File

@ -1231,21 +1231,15 @@ int ObAlterTableExecutor::execute(ObExecContext &ctx, ObAlterTableStmt &stmt)
}
if (OB_SUCC(ret)) {
const bool is_ddl_retry_task = is_drop_schema_block_concurrent_trans(res.ddl_type_);
const bool need_wait_ddl_finish = is_double_table_long_running_ddl(res.ddl_type_)
|| is_simple_table_long_running_ddl(res.ddl_type_)
|| is_ddl_retry_task;
|| is_simple_table_long_running_ddl(res.ddl_type_);
if (OB_SUCC(ret) && need_wait_ddl_finish) {
int64_t affected_rows = 0;
if (OB_FAIL(refresh_schema_for_table(alter_table_arg.exec_tenant_id_))) {
LOG_WARN("refresh_schema_for_table failed", K(ret));
} else if (!is_ddl_retry_task && OB_FAIL(ObDDLExecutorUtil::wait_ddl_finish(tenant_id, res.task_id_,
} else if (OB_FAIL(ObDDLExecutorUtil::wait_ddl_finish(tenant_id, res.task_id_,
*my_session, common_rpc_proxy))) {
LOG_WARN("fail to wait ddl finish", K(ret), K(tenant_id), K(res));
} else if (is_ddl_retry_task && OB_FAIL(ObDDLExecutorUtil::wait_ddl_retry_task_finish(tenant_id, res.task_id_,
*my_session, common_rpc_proxy,
affected_rows))) {
LOG_WARN("fail to wait ddl retry task finish", K(ret), K(tenant_id), K(res));
}
}
}