Page MenuHomePhabricator

Comment schema migration and foreign db repos not working well
Closed, ResolvedPublic

Description

MediaWiki 1.31 has some new tables around the comments (and in the future around authors). With $wgCommentTableSchemaMigrationStage the state of the upcoming migration is handled. Stages are MIGRATION_OLD - MIGRATION_WRITE_BOTH - MIGRATION_WRITE_NEW - MIGRATION_NEW

Using a $wgForeignFileRepos with ForeignDBRepo or ForeignDBViaLBRepo connect to an older mediawiki version or connect to a same versioned but with a different migration stage will fail horribly.

Set $wgCommentTableSchemaMigrationStage = MIGRATION_NEW; in your main wiki, but leave the config as is for your db repo. The created sqls will fail, because there are using the new tables which may not exists or are empty on the foreign db repo.

The migration guide should have some hints for this case. This also affected wmf, because commons is a db repo (and testwiki for test2wiki).
The foreign repo must stay on MIGRATION_WRITE_BOTH as long as an older mediawiki is connect to it.
No other mediawiki can reach MIGRATION_NEW in this situation, when the migration script was not running on the foreign repo.

See T166732 for the code changes of comments and T167246 for the authors changes

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 3 2017, 12:33 PM
Anomie added a comment.EditedDec 4 2017, 9:20 PM

I'm not seeing any actionable change for this task.

Using a $wgForeignFileRepos with ForeignDBRepo or ForeignDBViaLBRepo connect to an older mediawiki version or connect to a same versioned but with a different migration stage will fail horribly.

Connecting to a much older MediaWiki version (more than WMF's deployment branches) seems unlikely to be supported.

Different migration stages are usable with care:

(F11181055 is an SVG version)

Migration is safe as long as all wikis in the cluster are on adjacent states, and you wait to run the migration maintenance script until all wikis are at WRITE_NEW and don't move any client wiki to NEW before the maintenance script has been run on the foreign repo wiki.

Legoktm added a subscriber: Legoktm.Dec 5 2017, 2:02 AM

Does this also affect foreign repos over the API aka $wgUseInstantCommons?

Anomie added a comment.Dec 5 2017, 2:05 AM

It wouldn't, because the API handles the DB access in that case.

Umherirrender triaged this task as Lowest priority.Dec 6 2017, 5:52 PM
Umherirrender added a project: Documentation.

I'm not seeing any actionable change for this task.

Yes, this task does not need any code changes.
The table shown could be added to a wiki page for documentation.

Anomie added a comment.Dec 6 2017, 9:57 PM

The table shown could be added to a wiki page for documentation.

Feel free. License it as CC0 if Commons thinks it's not too simple for copyright.