Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/291594

Change subject: InnoDB now supports fulltext which we need for searchindex so 
lets use it
......................................................................

InnoDB now supports fulltext which we need for searchindex so lets use it

fulltext is now supported in mysql 5.6
https://dev.mysql.com/doc/refman/5.6/en/innodb-fulltext-index.html

Lets use it if we use mysql 5.6

This patch will backup searchindex table and copy it to searchindex_old
then it will drop searchindex and recreate it with fulltext support for
innodb.

Change-Id: I351c8b49fb24d7584120df45da7537c94be777ee
---
M includes/installer/MysqlUpdater.php
A maintenance/archives/patch-mysql-5.6-copy-searchindex.sql
A maintenance/archives/patch-mysql-5.6-searchindex.sql
3 files changed, 38 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/94/291594/1

diff --git a/includes/installer/MysqlUpdater.php 
b/includes/installer/MysqlUpdater.php
index d414d907..509bd54 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -29,6 +29,18 @@
  */
 class MysqlUpdater extends DatabaseUpdater {
        protected function getCoreUpdateList() {
+               $dbType = $this->db->getType();
+
+               if ( $dbType === 'mysql' && $this->db->getServerVersion() >= 
5.6 ) {
+                       $SearchIndexAddTable1 = [ 'addTable', 
'searchindex_old', 'patch-mysql-5.6-copy-searchindex.sql' ];
+                       $SearchIndexDrop = [ 'dropTable', 'searchindex' ];
+                       $SearchIndexAddTable2 = [ 'addTable', 'searchindex', 
'patch-mysql-5.6-searchindex.sql' ];
+               } else {
+                       $SearchIndexAddTable1 = [ '' ];
+                       $SearchIndexDrop = [ '' ];
+                       $SearchIndexAddTable2 = [ '' ];
+               }
+
                return [
                        [ 'disableContentHandlerUseDB' ],
 
@@ -283,6 +295,9 @@
                        [ 'addIndex', 'categorylinks', 'cl_collation_ext',
                                'patch-add-cl_collation_ext_index.sql' ],
                        [ 'doCollationUpdate' ],
+                       $SearchIndexAddTable1,
+                       $SearchIndexDrop,
+                       $SearchIndexAddTable2,
                ];
        }
 
diff --git a/maintenance/archives/patch-mysql-5.6-copy-searchindex.sql 
b/maintenance/archives/patch-mysql-5.6-copy-searchindex.sql
new file mode 100644
index 0000000..acd7241
--- /dev/null
+++ b/maintenance/archives/patch-mysql-5.6-copy-searchindex.sql
@@ -0,0 +1,2 @@
+-- Backups table since we will be dopping and recreating it in MySQL 5.6
+CREATE TABLE searchindex_old SELECT * FROM searchindex
diff --git a/maintenance/archives/patch-mysql-5.6-searchindex.sql 
b/maintenance/archives/patch-mysql-5.6-searchindex.sql
new file mode 100644
index 0000000..30e7bca
--- /dev/null
+++ b/maintenance/archives/patch-mysql-5.6-searchindex.sql
@@ -0,0 +1,21 @@
+-- This only supports mysql 5.6+
+--
+-- When using the default MySQL search backend, page titles
+-- and text are munged to strip markup, do Unicode case folding,
+-- and prepare the result for MySQL's fulltext index.
+--
+-- This table must be InnoDB;
+--
+CREATE TABLE /*_*/searchindex (
+  -- Key to page_id
+  si_page int unsigned NOT NULL,
+
+  -- Munged version of title
+  si_title varchar(255) NOT NULL default '',
+
+  -- Munged version of body text
+  si_text mediumtext NOT NULL,
+  FULLTEXT KEY si_title (si_title, si_text)
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page);

-- 
To view, visit https://gerrit.wikimedia.org/r/291594
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I351c8b49fb24d7584120df45da7537c94be777ee
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox <thomasmulhall...@yahoo.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to