Merge "Remove redundant UNIQUE from rev_page_id"

This commit is contained in:
jenkins-bot 2016-08-25 07:23:34 +00:00 committed by Gerrit Code Review
commit 9c2bd36d87
3 changed files with 27 additions and 1 deletions

View file

@ -287,6 +287,7 @@ class MysqlUpdater extends DatabaseUpdater {
// 1.28
[ 'addIndex', 'recentchanges', 'rc_name_type_patrolled_timestamp',
'patch-add-rc_name_type_patrolled_timestamp_index.sql' ],
[ 'doRevisionPageRevIndexNonUnique' ]
];
}
@ -1101,4 +1102,24 @@ class MysqlUpdater extends DatabaseUpdater {
'Making user_id unsigned int'
);
}
protected function doRevisionPageRevIndexNonUnique() {
if ( !$this->doTable( 'revision' ) ) {
return true;
} elseif ( !$this->db->indexExists( 'revision', 'rev_page_id' ) ) {
$this->output( "...rev_page_id index not found on revision.\n" );
return true;
}
if ( !$this->db->indexUnique( 'revision', 'rev_page_id' ) ) {
$this->output( "...rev_page_id index already non-unique.\n" );
return true;
}
return $this->applyPatch(
'patch-revision-page-rev-index-nonunique.sql',
false,
'Making rev_page_id index non-unique'
);
}
}

View file

@ -0,0 +1,5 @@
-- Makes rev_page_id index non-unique
ALTER TABLE /*_*/revision
DROP INDEX /*i*/rev_page_id;
CREATE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id);

View file

@ -369,7 +369,7 @@ CREATE TABLE /*_*/revision (
) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024;
-- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 4GB limit
CREATE UNIQUE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id);
CREATE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id);
CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp);
CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp);
CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp);