From ac60c11d2cd206e40dfb4ac412cbc8e87e96bd73 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 24 Oct 2013 14:11:59 -0400 Subject: [PATCH] [SIGNED OFF] Bug 11136 - action_logs should be a MyISAM table, not InnoDB The table action_logs is written too at a higher rate than practically any other table. Additionally, action_logs has no foreign key constraints. It seems that this would be a somewhat unique situation where using MyISAM would provide quite a performance boost for large sites with many transactions that use the Action Logs. TEST PLAN --------- NOTE: These instructions toast the database, so backup as needed! 1) open mysql client 2) use the koha database 3) show create table action_logs; -- This should currently be InnoDB listed as the engine. 4) close mysql client 5) apply patch 6) ./installer/data/mysql/updatedatabase.pl -- This should apply the update. 7) open mysql client 8) use the koha database 9) show create table action_logs; -- The engine should now be MyISAM. 10) drop the koha database 11) create the koha database 12) close mysql client 13) go to the staff client and do the web installation 14) open mysql client 15) use the koha database 16) show create table action_logs; -- The engine should now be MyISAM. Also, the AUTO_INCREMENT won't be shown, since the log file is currently empty. Signed-off-by: Mark Tompsett --- installer/data/mysql/kohastructure.sql | 2 +- installer/data/mysql/updatedatabase.pl | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 136104f..a809158 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2742,7 +2742,7 @@ CREATE TABLE `action_logs` ( -- logs of actions taken in Koha (requires that the `info` text, -- information about the action (usually includes SQL statement) PRIMARY KEY (`action_id`), KEY (`timestamp`,`user`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Table structure for table `alert` diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 80ab210..70836e9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7912,6 +7912,13 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("ALTER TABLE action_logs ENGINE = MYISAM"); + print "Upgrade to $DBversion done (Bug 11136 - action_logs should be a MyISAM table, not InnoDB)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 1.7.9.5