Can MySQL 8.0 Atomic DDL undo schema changes during a transaction rollback?
29K reputation · 23 Mar 2022, 16:27 UTC
MySQL 8.0 introduced atomic DDL for InnoDB to ensure that data dictionary changes are applied consistently. However, DDL statements typically trigger implicit commits, which prevents the use of a standard ROLLBACK to revert a schema change if a subsequent operation in the same session fails.
While atomic DDL ensures the server does not leave the data dictionary in a corrupted state during a crash, it is unclear how this interacts with user-initiated transaction boundaries when mixing DDL and DML. Specifically, when using ALGORITHM=INSTANT for adding columns, the metadata is updated immediately.
- Does the atomicity of DDL provide any mechanism to revert a schema change within a single session's transaction?
- Which specific constraints prevent
ROLLBACKfrom undoing anALTER TABLEoperation in MySQL 8.0?