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

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:

table.svg.png (135×960 px, 22 KB)

(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.

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

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

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.

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.