Upgrade Moddle Database From 2.5 to Innodb and convert to innodb Baracuda
you can try this on a test environment first.
mysql> select version();
+------------+
| version() |
+------------+
| 5.5.24-cll |
+------------+
1 row in set (0.00 sec)
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 |
+--------------------------+----------+
4 rows in set (0.00 sec)
mysql> SET GLOBAL innodb_file_format = barracuda;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like "%innodb_file%";
+--------------------------+-----------+
| Variable_name | Value |
+--------------------------+-----------+
| innodb_file_format | Barracuda |
| innodb_file_format_check | ON |
| innodb_file_format_max | Antelope |
| innodb_file_per_table | ON |
+--------------------------+-----------+
4 rows in set (0.00 sec)
mysql> SET GLOBAL innodb_file_format_max = barracuda;
Query OK, 0 rows affected (0.00 sec)
mysql> 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 |
+--------------------------+-----------+
4 rows in set (0.00 sec)
Database is as well accessible after this, but again, recommended to test on a test environment first.
MySQL storage engine conversion
If you run your Moodle site with MySQL database backend and use the default MyISAM as the storage engine for your tables, you may want to convert them to use some more reliable engine like InnoDB (actually, you should want to switch to PostgreSQL ;-) anyway).
First step
First step
$ sudo -u mysql /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB
Converting InnoDB tables to Barracuda
Sites using MySQL with database tables using Antelope as the file format are recommended to convert the tables to the Barracuda file format.
This is because tables using Antelope as the file format cannot handle more than 10 text columns. This file formats only supports compact and redundant row formats for backward compatibility reasons. This may cause a problem on larger sites when restoring a course, in which case the following error will be displayed:
Row size too large (>8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.
Barracuda is the newest innoDB file format. In addition to supporting compact and redundant row formats, Barracuda also supports compressed and dynamic row formats.
However, converting tables to Barracuda is only recommended, and not required, since not all MySQL users are affected. (It may only be a problem for larger sites.)
Tool for converting tables
A command line tool is included in Moodle for converting tables to Barracuda.
To view tables requiring conversion, use the list option:(second step)
$ sudo -u root /usr/bin/php admin/cli/mysql_compressed_rows.php --list
Here is an example output:
mdl_data Compact (needs fixing) mdl_data_fields Compact (needs fixing) mdl_enrol_paypal Compact (needs fixing)
To proceed with the conversion, run the command using the fix option: (Third step)
$ sudo -u root /usr/bin/php admin/cli/mysql_compressed_rows.php --fix
Successful table conversion will be reported in the output, for example:
mdl_data ... Compressed mdl_data_fields ... Compressed mdl_enrol_paypal ... Compressed
Note: When upgrade 2 file are missing, mdl_context.myd and mdl_forum_discussions.myi. Upload that file to folder database. Make sure you backup database the old one.
Comments