From f45441aaa7dd98b6106a36882d165a12ac9d682e Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 18 Sep 2019 11:32:13 -0400 Subject: [PATCH] Clean up ar_usertext_timestamp index mess See T233221 for the sordid history. The short version is that it might exist as `ar_usertext_timestamp`, `usertext_timestamp`, or both on MySQL, so dropping it for the actor migration needs to drop both names if they exist. We can also remove the now-obsolete aliasing from MWLBFactory. Bug: T233221 Bug: T104756 Bug: T229712 Change-Id: I429e7ade2c86a2514aafe947012f096b03aa67ce --- includes/db/MWLBFactory.php | 1 - includes/installer/MysqlUpdater.php | 3 +++ .../archives/patch-drop-archive-ar_usertext_timestamp.sql | 7 +++++++ .../archives/patch-drop-archive-usertext_timestamp.sql | 7 +++++++ maintenance/archives/patch-drop-user-fields.sql | 1 - 5 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 maintenance/archives/patch-drop-archive-ar_usertext_timestamp.sql create mode 100644 maintenance/archives/patch-drop-archive-usertext_timestamp.sql diff --git a/includes/db/MWLBFactory.php b/includes/db/MWLBFactory.php index 18030090df..ad5708a2f2 100644 --- a/includes/db/MWLBFactory.php +++ b/includes/db/MWLBFactory.php @@ -381,7 +381,6 @@ abstract class MWLBFactory { * T154872). */ $lbFactory->setIndexAliases( [ - 'ar_usertext_timestamp' => 'usertext_timestamp', 'un_user_id' => 'user_id', 'un_user_ip' => 'user_ip', ] ); diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index ea88411ec6..7d41d04616 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -386,6 +386,9 @@ class MysqlUpdater extends DatabaseUpdater { [ 'modifyTable', 'job', 'patch-job-params-mediumblob.sql' ], // 1.34 + [ 'dropIndex', 'archive', 'ar_usertext_timestamp', + 'patch-drop-archive-ar_usertext_timestamp.sql' ], + [ 'dropIndex', 'archive', 'usertext_timestamp', 'patch-drop-archive-usertext_timestamp.sql' ], [ 'dropField', 'logging', 'log_user', 'patch-drop-user-fields.sql' ], ]; } diff --git a/maintenance/archives/patch-drop-archive-ar_usertext_timestamp.sql b/maintenance/archives/patch-drop-archive-ar_usertext_timestamp.sql new file mode 100644 index 0000000000..158d9ae4ac --- /dev/null +++ b/maintenance/archives/patch-drop-archive-ar_usertext_timestamp.sql @@ -0,0 +1,7 @@ +-- T233221: The index on `archive` variously known as `ar_usertext_timestamp` +-- and `usertext_timestamp` has a long and sordid history. We're dropping the +-- `ar_user_text` column entirely now (see patch-drop-user-fields.sql), but +-- this index needs special care thanks to said history. + +-- Do not use the /*i*/ thing here! +DROP INDEX ar_usertext_timestamp ON /*_*/archive; diff --git a/maintenance/archives/patch-drop-archive-usertext_timestamp.sql b/maintenance/archives/patch-drop-archive-usertext_timestamp.sql new file mode 100644 index 0000000000..f409e970c5 --- /dev/null +++ b/maintenance/archives/patch-drop-archive-usertext_timestamp.sql @@ -0,0 +1,7 @@ +-- T233221: The index on `archive` variously known as `ar_usertext_timestamp` +-- and `usertext_timestamp` has a long and sordid history. We're dropping the +-- `ar_user_text` column entirely now (see patch-drop-user-fields.sql), but +-- this index needs special care thanks to said history. + +-- Do not use the /*i*/ thing here! +DROP INDEX usertext_timestamp ON /*_*/archive; diff --git a/maintenance/archives/patch-drop-user-fields.sql b/maintenance/archives/patch-drop-user-fields.sql index 7faa593733..1d0b057eed 100644 --- a/maintenance/archives/patch-drop-user-fields.sql +++ b/maintenance/archives/patch-drop-user-fields.sql @@ -4,7 +4,6 @@ -- T188327. Drop old xx_user and xx_user_text fields, and defaults from xx_actor fields. ALTER TABLE /*_*/archive - DROP INDEX /*i*/ar_usertext_timestamp, DROP COLUMN ar_user, DROP COLUMN ar_user_text, ALTER COLUMN ar_actor DROP DEFAULT; -- 2.20.1