Force row_format on mysqldump
-
07-03-2021 - |
Question
I am converting a whole server to use Barracuda file format and dynamic row format. Here's what I did:
- full mysqldump
- configured *innodb_file_per_table = 1* and *innodb_file_format=barracuda*
- resetted all mysql data.
- imported all dumped databases.
Since I was creating all databases again e recreating the tables, I was expecting them all to be barracuda but instead most of them are Antelope.
Is there a way to specify the row_format on mysqldump or when importing it?
Note: before someone asks why, I experiment different file formats to test which performs best with our server that has currently 680 databases with a total of 326k tables and 40Gb. Main problem now is that mysql enterprise backup takes too long to backup it all.
Solution
Here's how I end up doing it:
after the full dump, I converted the final files using sed:
cat full.sql | sed -e 's/ROW_FORMAT=COMPACT/ROW_FORMAT=DYNAMIC/' | sed -e '/ROW_FORMAT/!s/^) ENGINE=InnoDB/) ENGINE=InnoDB ROW_FORMAT=DYNAMIC/' > full.mod.sql
This line changes ROW_FORMAT from COMPACT to DYNAMIC and adds ROW_FORMAT=DYNAMIC when no format is specified.