2013-04-04

The MySQL 5.5 (and 5.6) documentation says, in Identifying the File Format in Use:

“… Otherwise, the least significant bit should be set in the tablespace flags, and the file format identifier is written in the bits 5 through 11. …”

This is incorrect for any version due to a bug in how the tablespace flags were stored (which caused only 1 bit to be reserved, rather than 6). This was all re-worked in MySQL 5.6, so someone obviously noticed it, but the documentation has been left incorrect for all versions, and the incorrect and misleading code has been left in MySQL 5.5. I filed MySQL Bug #68868 about the documentation.
File formats and names
There are file format names in the documentation and code for values 0 through 25 (letters “A” through “Z”), although only 0 (“Antelope”) and 1 (“Barracuda”) are currently used. They are all defined in storage/innobase/trx/trx0sys.c:

97 /** List of animal names representing file format. */
98 static const char* file_format_name_map[] = {
99 "Antelope",
100 "Barracuda",
101 "Cheetah",
102 "Dragon",
103 "Elk",
104 "Fox",
105 "Gazelle",
106 "Hornet",
107 "Impala",
108 "Jaguar",
109 "Kangaroo",
110 "Leopard",
111 "Moose",
112 "Nautilus",
113 "Ocelot",
114 "Porpoise",
115 "Quail",
116 "Rabbit",
117 "Shark",
118 "Tiger",
119 "Urchin",
120 "Viper",
121 "Whale",
122 "Xenops",
123 "Yak",
124 "Zebra"
125 };

How only one bit was reserved
The code to store the file format identifier into an InnoDB tablespace file’s tablespace flags is in storage/innobase/include/dict0mem.h and follows, with my commentary.
The first bit is reserved for 1 = compact, 0 = redundant format:

70 /** Table flags. All unused bits must be 0. */
71 /* @{ */
72 #define DICT_TF_COMPACT 1 /* Compact page format.
73 This must be set for
74 new file formats
75 (later than
76 DICT_TF_FORMAT_51). */

The next 4 bits are reserved for the compressed page size:

78 /** Compressed page size (0=uncompressed, up to 15 compressed sizes) */
79 /* @{ */
80 #define DICT_TF_ZSSIZE_SHIFT 1
81 #define DICT_TF_ZSSIZE_MASK (15

Show more