Page MenuHomePhabricator

Add a check to populateContentTables.php to ensure that populateRevisionSha1.php is run first
Closed, ResolvedPublic1 Estimate Story Points

Description

As identified in T200653, the revision.rev_sha1 field must be populated before the populateContentTables.php script can successfully run.

For MediaWiki 1.19 and later, revision.rev_sha1 should already exist and have data. For earlier versions of MediaWiki, or for wikis that somehow have data issues, the populateRevisionSha1.php script must run to populate revision.rev_sha1, with the $wgMultiContentRevisionSchemaMigrationStage global variable having the SCHEMA_COMPAT_READ_OLD bit set. Having this bit set ensures that the code can find the content to calculate the sha1.

The populateContentTables.php script, on encountering a revision.rev_sha1 with value of empty string, should die and instruct the user to:

  1. ensure $wgMultiContentRevisionSchemaMigrationStage is set appropriately
  2. run populateRevisionSha1.php
  3. restore $wgMultiContentRevisionSchemaMigrationStage (if necessary)
  4. run populateContentTables.php again

Event Timeline

WDoranWMF set the point value for this task to 1.Apr 15 2019, 3:17 PM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

This missed the boat for the MW 1.33 release. Provisionally re-tagging to 1.34's release instead.

BPirkle updated the task description. (Show Details)Jul 3 2019, 10:17 PM

Change 520735 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] PopulateContentTables: compute sha1 and length if needed.

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

Change 520779 had a related patch set uploaded (by BPirkle; owner: BPirkle):
[mediawiki/core@master] Display helpful message when populating content if revision sh1 is unpopulated

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

Change 520779 abandoned by BPirkle:
Display helpful message when populating content if revision sh1 is unpopulated

Reason:
I did not see that Daniel had already uploaded change for this ticket before posting mine.

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

daniel closed this task as Resolved.Jul 5 2019, 1:29 PM
daniel claimed this task.
daniel added a subscriber: daniel.

This task is invalid as described, because the updater has always been running PopulateRevisionSha1 after PopulateContentTables. I changed PopulateContentTables to calculate the SHA1 (and the size) on the fly if needed and write it to the content table
(https://gerrit.wikimedia.org/r/520735), and Bill updated PopulateRevisionSha1 to make use of that information to populate rev_sha1 and ar_sha1 at the end of the update process (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/516730/).

NOTE: The confusion stems from the existence of DatabaseUpdater::$postDatabaseUpdateMaintenance. This feature seems ill conceived, and bound to cause more trouble in the future. We should probably get rid of it.

Change 520735 merged by jenkins-bot:
[mediawiki/core@master] PopulateContentTables: compute sha1 and length if needed.

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

Change 542232 had a related patch set uploaded (by Reedy; owner: Daniel Kinzler):
[mediawiki/core@REL1_33] PopulateContentTables: compute sha1 and length if needed.

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

Change 542237 had a related patch set uploaded (by Reedy; owner: Daniel Kinzler):
[mediawiki/core@REL1_32] PopulateContentTables: compute sha1 and length if needed.

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

Change 542237 merged by jenkins-bot:
[mediawiki/core@REL1_32] PopulateContentTables: compute sha1 and length if needed.

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

Change 542232 merged by jenkins-bot:
[mediawiki/core@REL1_33] PopulateContentTables: compute sha1 and length if needed.

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