If the table definition version identifier is longer than 8 bytes, then repurposing some bytes in the clustered index root page could be a too tight fit.
For tables that are located in the system tablespace (which would be phased out in MDEV-11633), we can store the data definition version number in SYS_TABLES.CLUSTER_NAME inside the InnoDB data dictionary, which also resides in the system tablespace. This is possible, because SYS_TABLES.CLUSTER_NAME was always initialized as NULL, starting from the very first public InnoDB revision.
.ibd files and the innodb_file_per_table parameter were introduced in MySQL 4.1.12. Back then, InnoDB left some unused bytes uninitialized. Therefore, we must be careful when repurposing previously unused data bytes.
Unfortunately, in the change buffer bitmap page, the unused page payload was left uninitialized. We cannot repurpose any of the remaining bytes on the page, unless we can somehow determine that the file was created with a newer version of InnoDB that zero-initializes the unused bytes.
Similarly, in the inode page (page number 2), most of the page contents was left uninitialized, even within the payload area.
Similarly, in the file system header page (page number 0), all unused fields except the one that was later repurposed as FSP_SPACE_FLAGS were left uninitialized.
The page initialization was finally added in MySQL 5.1.48 for all data files. The original author of InnoDB opposed the initialization for many years, because he feared that it might cost some performance.
Pages in ROW_FORMAT=COMPRESSED were always zero-initialized. Otherwise, only if flags for features that were introduced after MySQL 5.1.48 are present, there is a guarantee that previously unused bytes are zero-initialized. Such features would include non-default innodb_page_size, and the page_compressed format.
Because we cannot identify the version that created the the most commonly used data files (innodb_page_size=16k, uncompressed), we must choose a different mechanism for safely repurposing previously unused bytes in .ibd files.
Unfortunately, before MariaDB 10.4, nothing can be inferred from the innodb_checksum_algorithm of a page, because pages containing uninitialized garbage are being modified, and when those modifications are written, any currently available checksum algorithm can be used. With MDEV-12026 in MariaDB 10.4, data files created with innodb_checksum_algorithm=full_crc32 are guaranteed to zero-initialize any unused bytes.
In page 1 (the change buffer bitmap page), the size of the unused area is 466 to 32722 bytes, depending on the physical page size. Let us add an additional page trailer as follows:
(padding with zeroes)
4 bytes: server ID
16 bytes: table dictionary version
32 bytes: the file creator, NUL-padded, for example "MariaDB 10.4.0"
4 bytes: CRC-32C checksum of the entire page payload area, excluding the page trailer
This would introduce an additional checksum within the page, hoping that the uninitialized garbage in old .ibd files would fail to satisfy that checksum.
In the same mini-transaction that adds trailer on page 1, we would also fully zero-initialize page 2, so that the presence of this trailer on page 1 can be used for determining whether previously unused bytes on page 2 are not garbage.
The additional checksum is not necessary for files that use innodb_checksum_algorithm=full_crc32 (MDEV-12026).
The following link shows which databases supports transactional DDL:s and how:
https://wiki.postgresql.org/wiki/Transactional_DDL_in_PostgreSQL:_A_Competitive_Analysis
Ideally we would like to have transactional DDL for
CREATE TABLE:
ALTER TABLE
DROP TABLE
We may be want to leave DROP TABLE as the last step.
That said, I think that we should initially do transactional DDL:s only for transactional engines (XtraDB, InnoDB and TokuDB)
Internal change:
(This can be very tricky if you do several ALTER TABLE:s on the same table that is use by another transaction; We could consider changing the original table to read only while the transaction is running to simplify this case)
Example of things that one should be able to do:
BEGIN
This should roll back all changes and the creation of table t1;