Loading...
 
Skip to main content

History: InnoDB

Source of version: 26

Copy to clipboard
            !About InnoDB
Support for InnoDB was introduced in Tiki 8. InnoDB is the default engine since Tiki 18.

InnoDB provides several benefits over the MyISAM engine. It is crash-proof (the database will automatically recover errors upon restart).

Additionally, InnoDB supports (multi-statement) transactions and row-level locking, i.e. updates, inserts and deletes will no longer lock the whole file/table. It also supports referential integrity by the use of foreign keys. But these features are currently not used by vanilla Tiki. Customized Tiki versions could take advantage of these features, e.g. if the tiki_pages table is linked from a custom table.

! Installing with InnoDB
When creating the Tiki database, the user can choose to use MyISAM or InnoDB. Once the choice is made, Tiki will remember the selection.

! Migrating existing MyISAM databases
Migration steps:
# Make sure InnoDB is integrated in the standard/SVN Tiki release. Otherwise you may be unable to do any upgrades later.
# Do a full backup of your current database/installation
# InnoDB does not support fulltext search in MySQL versions prior to 5.6 and in MariaDB 5. If you use one of these:
## Disable fulltext search in Tiki, since you won't be able to disable it from the GUI after the conversion.
## Drop all MyISAM fulltext indexes
# Alter the database engine for all tables to InnoDB

Steps 3.2 and 4 are defined in the file db/tiki_convert_myisam_to_innodb.sql. This script is fragile and may not treat all tables in step 4 (as of 2019-05-01). This conversion will require substantial time on a sizeable database. On a PC with an Intel Core i5 CPU using a hard drive and MariaDB 10.1, converting a 3 GB database required 164 minutes. The same database took 3 minutes to convert on a virtual machine with Oracle Linux and MariaDB 10.3. Performing the conversion with phpMyAdmin may cause a PHP timeout. Running the script with the mysql command avoids that:
{CODE(colors="shell" theme="default")}mysql -u userName -p databaseName < db\tiki_convert_myisam_to_innodb.sql{CODE}
Nevertheless, step 4 may fail converting the tiki_files table if innodb_log_file_size is not high enough. In one case, 25 MB was insufficient (80 MB sufficed).

~tc~ THE FOLLOWING SHOULD MOVE TO DEV.TIKI.ORG. Rename of https://dev.tiki.org/ExperimentalBranches+InnoDB to just "InnoDB" requested 2019-04-30. Chealer9 ~/tc~

! Supporting InnoDB
!! Installs
Rules
* No FKs are allowed in the tiki.sql script.
* Fulltext index definitions are placed in the tiki_myisam.sql file. InnoDB specific definitions are placed in the tiki_innodb.sql file.
* The word MyISAM must be used (only) in the engine specification, and it is not allowed in attribute names or other definitions.

The Tiki installer translates the engine type, based on the selected database in the installer GUI.

After the main install script (tiki.sql), the installer will run tiki_myisam.sql or tiki_innodb.sql for the respective installation. tiki_myisam.sql installs the fulltext indexes.

!! Upgrades
When adding an engine-dependent patch, the engine-independent SQL statements must be put in the YYYYMMDD_description_tiki.sql file. The engine-dependent parts must be put in an accompanying PHP file, defining a post_YYYYMMDD_description_tiki function.
Example: Add a table with a fulltext index
{CODE(caption="20110918_tiki_test_tiki.sql" wrap="0")}DROP TABLE IF EXISTS `tiki_test`;
CREATE TABLE `tiki_test` (
  `title` varchar(255) default NULL,
  KEY `title` (`title`)
) ENGINE=MyISAM;{CODE}
and a PHP file specifying the engine dependent part
{CODE(caption="20110918_tiki_test_tiki.php")}function post_20110918_tiki_test_tiki( $installer ) {
  if($installer->isMySQLFulltextSearchSupported()) {
    $installer->query( "CREATE FULLTEXT INDEX ft_test ON tiki_test(`title`);");
  }
}
{CODE}

!! Continuous Integration
The [https://gitlab.com/tikiwiki/tiki/-/blob/master/.gitlab-ci.yml|Tiki CI] has sql-engine-conversion section which leverages doc/devtools/check_sql_engine_conversion.php 

---
See also: [https://dev.tiki.org/ExperimentalBranches+InnoDB|ExperimentalBranches InnoDB]

        

History

Advanced
Information Version
Marc Laporte Moving to own page 39
Marc Laporte 38
Marc Laporte 37
Marc Laporte crash-proof is too strong a statement 36
Marc Laporte 35
Marc Laporte 34
Marc Laporte 33
Marc Laporte 32
Marc Laporte 31
Marc Laporte 30
Marc Laporte 29
Marc Laporte Modernizing (We need to get rid of tiki-searchresults.php) 28
Marc Laporte 27
Marc Laporte 26
Philippe Cloutier details on innodb_log_file_size 25
Philippe Cloutier Migrating existing MyISAM databases: more details on time taken 24
Philippe Cloutier Migrating existing MyISAM databases: details on requirements 23
Philippe Cloutier clarify and suggest method to execute script 22
Philippe Cloutier make step 4 conditional 21
Philippe Cloutier clarify, cover MariaDB and update step numbers (oops) 20
Philippe Cloutier Migrating existing MyISAM databases: remove "Upgrade to the latest Tiki version (8.0 SVN or later)." (releases prior to 9 are no longer supported) 19
Philippe Cloutier About InnoDB: clarify a bit more 18
Philippe Cloutier fix 17
Philippe Cloutier About InnoDB: fix misleading structure 16
Philippe Cloutier Installing InnoDB: remove "There is a migration procedure from MyISAM to InnoDB." (that procedure is just after) 15
Philippe Cloutier About InnoDB: MyISAM is no longer default 14
Philippe Cloutier move "Supporting InnoDB" section down as it is for developers and add comment 13
Philippe Cloutier rename migration section to "Migrating existing MyISAM databases" 12
Philippe Cloutier move upgrading section with install section, grouping in "Supporting InnoDB" 11
Philippe Cloutier tiki_innodb.sql is no longer empty. 10
Philippe Cloutier mention default in Tiki 18, small fixes 9
Philippe Cloutier note on MySQL 5.6 fulltext searches 8
Philippe Cloutier add warning about script 7
Arild Berg 6
Arild Berg 5
Arild Berg 4
Arild Berg 3
Arild Berg 2
Arild Berg 1