The DDL execution engine in PolarDB-X 1.0 introduces task management for DDL operations. This changes how DDL statements behave compared to earlier versions. This topic covers what to expect when running DDL tasks and the hard limits you must stay within.
Usage notes
Completed DDL tasks are automatically deleted from the task queue. Once a DDL statement finishes executing, ignore the task status — the task is gone.
After a DDL task completes, run
CHECK TABLEimmediately to verify that the corresponding logical tables are consistent.After you resume, roll back, or delete a DDL task using a task management statement, run
CHECK TABLEto verify logical table consistency.If a DDL statement fails, an error code and error message are returned. Run
SHOW DDLto see the failure cause in theREMARKfield of the pending task.ImportantBefore resuming, rolling back, or deleting a failed DDL task, identify the root cause and confirm the correct recovery action. Running a task management statement without understanding the failure may cause the statement itself to fail.
If a DDL task fails and enters the pending state, the affected table becomes inaccessible for security reasons. Statements such as
SHOW TABLESreturn no results, and DML statements may return errors likethe table is unknownordoes not exist. The table becomes accessible again only after the pending DDL task is resumed or rolled back, which restores it to a consistent state.If you use
IF NOT EXISTSin aCREATE TABLEstatement orIF EXISTSin aDROP TABLEstatement, some errors during execution do not cause the statement to fail — instead, they are recorded as warnings. After executing such a statement, check whether the output includes a warning count (for example,1 warning). RunSHOW WARNINGSto review the details and avoid missing important information.On clients such as Data Management (DMS), set
PURE_ASYNC_DDL_MODEto run DDL statements asynchronously. This prevents client-side timeout from interrupting long-running DDL operations. Use this when the execution time of a DDL statement cannot be estimated and the client has a connection timeout configured for PolarDB-X 1.0. After the statement is submitted, runSHOW DDLto check the task status.
Limitations
Only
CREATE TABLEandRENAME TABLEoperations can be rolled back.RECOVER DDLandROLLBACK DDLcannot be combined or repeated for the same pending DDL task. For example, rolling back a task withROLLBACK DDLand then attemptingRECOVER DDLafter the rollback fails may cause logical table inconsistency. If your scenario requires combining these operations, contact technical support.Run
REMOVE DDLonly when the database security is ensured. RunningREMOVE DDLon a database in an uncertain state may expose DDL task intermediate states and leave logical tables inconsistent. If data integrity issues occur due to misuse ofREMOVE DDL, contact technical support.By default, each physical database supports a maximum of 128 table shards. Exceeding this limit returns an error:
mysql> CREATE TABLE test_mdb_mtb (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 VARCHAR(10), c3 DATE) -> DBPARTITION BY HASH(c1) TBPARTITION BY HASH(c1) TBPARTITIONS 129; ERROR 4647 (HY000): [f5bd90594800000][30.25.86.55:8527][JICHEN_LOCAL_APP]ERR-CODE: [TDDL-4647][ERR_TABLE_PARTITIONS_EXCEED_LIMIT] The number of table partitions '129' exceeds the upper limit '128'. Please specify less table partitions or adjust the value of the parameter MAX_TABLE_PARTITIONS_PER_DB.To increase the limit, pass
MAX_TABLE_PARTITIONS_PER_DBas a hint:mysql> /*+TDDL:cmd_extra(MAX_TABLE_PARTITIONS_PER_DB=400)*/CREATE TABLE test_mdb_mtb (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 VARCHAR(10), c3 DATE) -> DBPARTITION BY HASH(c1) TBPARTITION BY HASH(c1) TBPARTITIONS 129; Query OK, 0 rows affected (2.64 sec)The DDL execution engine task queue holds a maximum of 65,535 pending DDL tasks. If this limit is reached, no new DDL statements can be executed. To free up space, first list pending tasks to identify the ones to remove, then remove them:
SHOW DDL;REMOVE DDL <task_id>;This limit cannot be changed by modifying parameters.