vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.42k stars 2.08k forks source link

Tracking: Online DDL partitioning changes improved support #15674

Open shlomi-noach opened 5 months ago

shlomi-noach commented 5 months ago

Feature Description

Partitioning changes are quite nuanced. Some are perfectly applicable to Online DDL, some are expected to run directly, and some outright have to run directly and are incorrect to run through Online DDL.

We want Vitess Online DDL, likely through schemadiff, to be more aware of partitioning nuances. Examples:

There is furthermore the fact that MySQL does not support mixing and matching partitioning and non-partitioning changes in a single ALTER TABLE statement. e.g. one cannot ADD COLUMN and DROP PARTITION in the same statement. Also, one cannot add two partitions on a RANGE partitioned table, and likewise one cannot both ADD and DROP partitions in the same statement. Interestingly it's OK to DROP multiple RANGE partitions. schemadiff already recognizes some (most?) of these scenarios, but more work is needed.

Some prior work was done in:

Use Case(s)

Better schema management; vitess to auto-resolve best approach to schema changes.

shlomi-noach commented 5 months ago

There is furthermore the fact that MySQL does not support mixing and matching partitioning and non-partitioning changes in a single ALTER TABLE statement.

This is actually solved implicitly by:

shlomi-noach commented 5 months ago

https://github.com/vitessio/vitess/pull/15698 fulfills all that we need right now on the vitess side, supporting RANGE partition rotation.