vitess
vitess copied to clipboard
Online DDL: switch unique key and column logic to declarative `schemadiff` analysis
vitess
migrations require some analysis on participating columns (type, nullability, etc.) and of the table's unique keys (fiding an appropriate iteration key for the migration).
That analysis takes place today via information_schema
:
https://github.com/vitessio/vitess/blob/1cc3e149508312a0ab01d95cbbe1cf996f0bbae6/go/vt/vttablet/onlineddl/schema.go#L456-L465
https://github.com/vitessio/vitess/blob/1cc3e149508312a0ab01d95cbbe1cf996f0bbae6/go/vt/vttablet/onlineddl/schema.go#L482-L545
https://github.com/vitessio/vitess/blob/1cc3e149508312a0ab01d95cbbe1cf996f0bbae6/go/vt/vttablet/onlineddl/schema.go#L550
https://github.com/vitessio/vitess/blob/1cc3e149508312a0ab01d95cbbe1cf996f0bbae6/go/vt/vttablet/onlineddl/schema.go#L558-L566
We want to move away from information_schema
based analysis and into programmatic and declarative schemadiff
analysis. We already ask schemadiff
for instant-ddl capabilities and we generally want it to own as much of schema analysis as possible.
At the resolution of this issue, schemadiff
should be able to tell, given two before and after tables, which unique keys ar ebest to use as iteration keys (if any) and what specific details we should know about the columns.