3

I was loading a mysql dump today when I ran into

ERROR 1118 (42000) at line 279: Row size too large (> 8126)

Which I thought was weird because I know I had turned on row compression and was using Barracuda on that server. I also knew I wasn't running into that problem on the production database.

I checked on the production database and sure enough

show variables like "%innodb_file%";
+--------------------------+-----------+
| Variable_name            | Value     |
+--------------------------+-----------+
| innodb_file_format       | Barracuda |
| innodb_file_format_check | ON        |
| innodb_file_format_max   | Barracuda |
| innodb_file_per_table    | ON        |
+--------------------------+-----------+

But on the server that loads the dump the file_format variable is set to:

mysql> show variables like "%innodb_file%";
+--------------------------+-----------+
| Variable_name            | Value     |
+--------------------------+-----------+
| innodb_file_format       | Antelope  |
| innodb_file_format_check | ON        |
| innodb_file_format_max   | Antelope  |
| innodb_file_per_table    | ON        |
+--------------------------+-----------+

Here's what my MySQL dump looks like

sudo mysqldump -u mysqlbackups --databases limbo | gzip > /local_backup_directory'+%m-%d-%Y'.sql.gz

Why wasn't the innodb_file_format and format_max variables dumped? How can I tell mysqldump to dump the file_format and format_max variables?

1
  • The server variables aren't associated with the data or the tables - they're associated with the server. Change the settings on your server.
    – Vérace
    Commented Jun 26, 2014 at 23:42

1 Answer 1

3

According to the MySQL Documentation on

innodb_file_format

The file format to use for new InnoDB tables. Currently, Antelope and Barracuda are supported. This applies only for tables that have their own tablespace, so for it to have an effect, innodb_file_per_table must be enabled. The Barracuda file format is required for certain InnoDB features such as table compression.

innodb_file_format_max

At server startup, InnoDB sets the value of this variable to the file format tag in the system tablespace (for example, Antelope or Barracuda). If the server creates or opens a table with a “higher” file format, it sets the value of innodb_file_format_max to that format.

Since each of these belong to my.cnf and not the data, the format of InnoDB is agnostic as far as the mysqldump goes. If you want to shift everything to Barracuda on the fly, there are two ways (TEST WHAT I AM ABOUT TO SUGGEST ON A DEV AND STAGING SERVER, PLEASE)

TECHNIQUE #1 : Prepend the Barracuda Option to the mysqldump

Suppose the mysqldump file is called mydump.sql. Do this:

echo "SET GLOBAL innodb_file_format = 'Barracuda';" > mynewdump.sql
cat mydump.sql >> mynewdump.sql

Now, just load the dump

mysql -uroot -p < mynewdump.sql

TECHNIQUE #2 : Set the Barracuda Option Before Loading the Dump

Login to mysql as root@localhost and run this from the mysql prompt

mysql> SET GLOBAL innodb_file_format = 'Barracuda';
mysql> source mynewdump.sql

WARNING

TEST THE SUGGESTIONS ON A DEV AND STAGING SERVER, PLEASE

Give it a Try !!!

3
  • 1
    Both of these worked, it's slightly annoying that I can't get a dump to automatically include this information. But working is working. Commented Jun 28, 2014 at 0:59
  • More than slightly annoying! We use Barracuda on only 3 of 10000 or so tables. It took me some time to first even find out why restoring from our dump wasn't working. Now, every time I want to restore from a dump (e.g. to initialize/refresh a slave), I have to find the right places to insert the SET GLOBAL innodb_file_format commands in our 19 GB dump file... :/
    – rinogo
    Commented Sep 10, 2015 at 16:08
  • Back at this question/answer again. Same problem, dump file is now 42G... @RolandoMySQLDBA, in the past, I've been using Barracuda for only these 3 tables (of the many thousands of tables we have). Is it safe (it would certainly make my dump/restore workflow easier) to just use Barracuda for all tables? I'm guessing there may be unintended consequences?
    – rinogo
    Commented Jun 15, 2017 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.