To prevent possible crashes or data corruptions when
InnoDB storage engine opens an ib-file set, it checks that it can
fully support the file formats in use within the ib-file set. If
the system is restarted following a crash, or a “fast
shutdown” (i.e., innodb_fast_shutdown
is greater than zero), there may be on-disk data structures
(such as redo or undo entries, or doublewrite pages) that are in
a “too-new” format for the current software. During
the recovery process, serious damage can be done to your data
files if these data structures are accessed. The startup check
of the file format occurs before any recovery process begins,
thereby preventing the problems described in
Section 11.4, “Possible Problems”.
Beginning with version 1.0.1 of the InnoDB storage engine, the system
tablespace records an identifier or tag for the
“highest” file format used by any table in any of
the tablespaces that is part of the ib-file set. Checks against
this file format tag are controlled by the new configuration
parameter innodb_file_format_check
, which is
ON
by default.
If the file format tag in the system tablespace is newer or
higher than the highest version supported by the particular
currently executing software and if innodb_file_format_check
is ON
, the following error is issued when the
server is started:
InnoDB: Error: the system tablespace is in a file format that this version doesn't support
You can also set innodb_file_format
to a file format name.
Doing so prevents the InnoDB storage engine from starting if the
current software does not support the file format specified. It
also sets the “high water mark” to the value you
specify. The ability to set innodb_file_format_check
will be
useful (with future releases of InnoDB) if you manually
“downgrade” all of the tables in an ib-file set (as
described in Chapter 11, Downgrading the InnoDB Storage Engine). You can then
rely on the file format check at startup if you subsequently use
an older version of InnoDB to access the ib-file set.
In some limited circumstances, you might want to start the
server and use an ib-file set that is in a “too
new” format (one that is not supported by the software
you are using). If you set the configuration parameter
innodb_file_format_check
to OFF
, the
InnoDB storage engine opens the database, but issues this warning
message in the error log:
InnoDB: Warning: the system tablespace is in a file format that this version doesn't support
This is a very dangerous setting, as it permits the recovery
process to run, possibly corrupting your database if the
previous shutdown was a crash or “fast shutdown”.
You should only set innodb_file_format_check
to
OFF
if you are sure that the previous
shutdown was done with
innodb_fast_shutdown=0
, so that essentially
no recovery process occurs. In a future release, this
parameter setting may be renamed from OFF
to UNSAFE
. (However, until there are newer
releases of InnoDB that support additional file formats,
even disabling the startup checking is in fact
“safe”.)
Note that the parameter innodb_file_format_check
affects only
what happens when a database is opened, not subsequently.
Conversely, the parameter innodb_file_format
(which enables a
specific format) only determines whether or not a new table can
be created in the enabled format and has no effect on whether or
not a database can be opened.
The file format tag is a “high water mark”, and as
such it is increased after the server is started, if a table in
a “higher” format is created or an existing table
is accessed for read or write (assuming its format is
supported). If you access an existing table in a format higher
than the format the running software supports, the system
tablespace tag is not updated, but table-level compatibility
checking applies (and an error is issued), as described in
Section 4.4.2, “Table-access File Format Compatibility Checking”.
Any time the high water mark is updated, the value of
innodb_file_format_check
is updated as well, so the command
SELECT @@innodb_file_format_check;
displays
the name of the newest file format known to be used by tables in
the currently open ib-file set and supported by the currently
executing software.
To best illustrate this behavior, consider the scenario described in Table 4.1, “InnoDB data file compatibility and related InnoDB parameters”. Imagine that some future version of InnoDB supports the “Cheetah” format and that an ib-file set has been used with that version.
Table 4.1. InnoDB data file compatibility and related InnoDB parameters
innodb file format check | innodb file format | Highest file format used in ib-file set | Highest file format supported by InnoDB | Result |
---|---|---|---|---|
OFF |
Antelope or Barracuda
|
Barracuda |
Barracuda |
Database can be opened; tables can be created which require “Antelope” or “Barracuda” file format |
OFF |
Antelope or Barracuda
|
Cheetah |
Barracuda |
Database can be opened with a warning, since the database contains files in a “too new” format; tables can be created in “Antelope” or “Barracuda” file format; tables in “Cheetah” format cannot be accessed |
OFF |
Cheetah |
Barracuda |
Barracuda |
Database cannot be opened; innodb_file_format cannot be set to
“Cheetah” |
ON |
Antelope or Barracuda
|
Barracuda |
Barracuda |
Database can be opened; tables can be created in “Antelope” or “Barracuda” file format |
ON |
Antelope or Barracuda
|
Cheetah |
Barracuda |
Database cannot be opened, since the database contains files in a “too new” format (“Cheetah”) |
ON |
Cheetah |
Barracuda |
Barracuda |
Database cannot be opened; innodb_file_format cannot be set to
“Cheetah” |
This is the User’s Guide for InnoDB storage engine 1.1 for MySQL 5.5, generated on 2010-04-13 (revision: 19994) .