You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mysql> use unsharded;
Database changed
mysql> SET @@ddl_strategy='online';
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE TABLE t1 ( username VARCHAR(20) NOT NULL, logdata BLOB NOT NULL, created DATETIME NOT NULL, PRIMARY KEY(username, created) ) PARTITION BY HASH( TO_DAYS(created) ) PARTITIONS 10;
ERROR 1149 (42000): syntax error at position 166 near 'PARTITION'
mysql> SET @@ddl_strategy='direct';
Query OK, 0 rows affected (0.01 sec)
mysql> CREATE TABLE t1 ( username VARCHAR(20) NOT NULL, logdata BLOB NOT NULL, created DATETIME NOT NULL, PRIMARY KEY(username, created) ) PARTITION BY HASH( TO_DAYS(created) ) PARTITIONS 10;
Query OK, 0 rows affected (0.08 sec)
mysql> show create table t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`username` varchar(20) NOT NULL,
`logdata` blob NOT NULL,
`created` datetime NOT NULL,
PRIMARY KEY (`username`,`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY HASH (to_days(`created`))
PARTITIONS 10 */
1 row in set (0.00 sec)
Commentary:
When DDL is executed directly (mode direct), table creation with partitions work fine
With DDL strategy online, we get a syntax error. This is because of the additional checks in onlineDDLStatementSanity(..) in go/vt/schema/online_ddl.go that depends on the DDL being fully parsed by the Vitess sqlparser.
Scenario:
main
branchdirect
), table creation with partitions work fineonlineDDLStatementSanity(..)
ingo/vt/schema/online_ddl.go
that depends on the DDL being fully parsed by the Vitess sqlparser.CREATE TABLE
flow, this is not normally a problem, since the initialCREATE TABLE
can be run withdirect
mode. However, if the user wants to use declarative online DDL (https://vitess.io/docs/user-guides/schema-changes/declarative-migrations/), they are out of luck.The text was updated successfully, but these errors were encountered: