Page MenuHomePhabricator

Migrating from 1.31.12 to 1.35.1 : error on populateContentTables.php
Open, Needs TriagePublicBUG REPORT

Description

I am trying to update an old database from 1.27 to 1.35. I have updated successfully from 1.27 to 1.31.12, but I now get an error when trying to run the update.php script of 1.35.1. Using 1.35.1, the script crashes with the following error :

Populating archive...
Failed to populate content table archive row batch starting at 6289 due to exception: MediaWiki\Storage\BlobAccessException: Unable to fetch blob at tt:6604 in /var/www/html/includes/Storage/SqlBlobStore.php:295

Trying to find an explanation to this, I found the T267468 issue for which @Ammarpad proposed a fix (that's why I assigned the issue to you, hope it's fine, otherwise feel free to redirect). I have downloaded the latest version of populateContentTables.php from gerrit including this fix, and now when running the script I get :

Populating archive...
Unable to fetch blob at tt:6604
Failed to populate content table archive row batch starting at 6289 due to exception: RuntimeException: Content row for 6758 not found after content insert in /var/www/html/maintenance/populateContentTables.php:273

If I replace the throw Exception at line 273 with a print, then populate the $slotRows array only if there is not this error, so that I get:

				if ( $contentId === false ) {
					print ( "Content row for $revisionId not found after content insert" );
				} else {
					$slotRows[] = [
						'slot_revision_id' => $revisionId,
						'slot_role_id' => $this->mainRoleId,
						'slot_content_id' => $contentId,
						// There's no way to really know the previous revision, so assume no inheriting.
						// rev_parent_id can get changed on undeletions, and deletions can screw up
						// rev_timestamp ordering.
						'slot_origin' => $revisionId,
					];
				}
			}

The only error I seem to get is for this entry in the database, but otherwise at first sight, the wiki seems to be fine, but I'd like to report it, as I might not be the only one to have the issue and it might be nice to have some advice on how to fix it when the issue arises.

Event Timeline

The exception is intentionally thrown because of encountering missing content row just after its (supposed) insertion. I think we need to account for content rows that we are now skipping because of the BlobAccessException.

Change 671687 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Skip bad blobs when inserting slot record.

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

Thanks @Ammarpad, I have applied the proposed fix, rerun the update.php script and it seems to work fine.

Change 671687 abandoned by Ammarpad:

[mediawiki/core@master] Skip bad blobs when inserting slot record.

Reason:

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

Ammarpad unsubscribed.