Page MenuHomePhabricator

1.33.X update to shared ipblocks table fails after first run
Closed, ResolvedPublic

Description

Similar to T257407

I'm upgrading a wiki farm from 1.30.X to 1.34.X, and finding that a database patch introduced in the 1.33.X releases appears to break the update.

This occurs both when upgrading iteratively through the 1.31 and 1.33 releases, and when skipping the intermediate releases and updating from 1.30.X to 1.33.4 or 1.34.2

I've narrowed it down to lines 10-12 in maintenance/archives/patch-drop-comment-fields.sql added in T233135

ALTER TABLE /*_*/ipblocks
  DROP COLUMN ipb_reason,
  ALTER COLUMN ipb_reason_id DROP DEFAULT;

This doesn't appear to be performing a check to see if the table is shared, and is performed even when --doshared is not specified. It will run successfully for the first wiki to be upgraded, but all subsequent runs on wikis which share that table will fail with the MySQL error that column ipb_reason does not exist.

Checking the (unused) ipblocks table local to the wiki reveals the ipb_reason column is present, so perhaps this operation is supposed to run against the local table and is being inadvertantly run against the shared table.

It occurs whether the --doshared flag is specified or not.

I can resolve the error by running the update script once to perform the ALTER operation to the shared table, then commenting out the lines specified above for subsequent runs.

Event Timeline

Andru updated the task description. (Show Details)
Reedy triaged this task as Medium priority.

Noting this won't be fixed in 1.33, as that is now EOL. But will be backported to 1.34 and will be in 1.35

Change 610318 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@master] Split patch-drop-comment-fields.sql

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

Change 610099 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@REL1_34] Split patch-drop-comment-fields.sql

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

Change 610099 merged by jenkins-bot:
[mediawiki/core@REL1_34] Split patch-drop-comment-fields.sql

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

Change 610318 merged by jenkins-bot:
[mediawiki/core@master] Split patch-drop-comment-fields.sql

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