Page MenuHomePhabricator

Update.php script fails to report database read-only error
Open, Needs TriagePublic

Description

When updating from 1.27.4 to 1.31.0 , I had my database locked ($wgReadOnly set) when I ran /maintenance php update.php.

The error message was not displayed. This is misleading, as I did not understand why my update failed with [W48fI-QM63YPxj1AGEiUeQAAAA8] 2018-09-05 00:11:15: Fatal exception of type "Wikimedia\Rdbms\DBQueryError".

I ran the update as:

$ php update.php

MediaWiki 1.31.0 Updater
Your composer.lock file is up to date with current dependencies!
Going to run database updates for wiki
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds (skip this countdown with --quick) ... 0
Turning off Content Handler DB fields for this part of upgrade.
...have ipb_id field in ipblocks table.
...have ipb_expiry field in ipblocks table.
...already have interwiki table
...indexes seem up to 20031107 standards.

...

...wl_notificationtimestamp is already nullable.
...index times already set on logging table.
...have ipb_range_start field in ipblocks table.
Set $wgShowExceptionDetails = true; and $wgShowDBErrorBacktrace = true; at the bottom of LocalSettings.php to show detailed debugging information.

An error message, such as Database is read-only, is missing.

When I set $wgShowExceptionDetails = true; and $wgShowDBErrorBacktrace = true;, the error message was displayed. I was able to see what I did wrong.

...wl_notificationtimestamp is already nullable.
...index times already set on logging table.
...have ipb_range_start field in ipblocks table.
[75cb065940c7af8c0bae4737] [no req]   Wikimedia\Rdbms\DBReadOnlyError from line 1121 of /var/www/html/w/includes/libs/rdbms/database/Database.php: Database is read-only: Software upgrade
Backtrace:

#0 /var/www/html/w/includes/installer/MysqlUpdater.php(878): Wikimedia\Rdbms\Database->query(string, string)
#1 /var/www/html/w/includes/installer/DatabaseUpdater.php(482): MysqlUpdater->doPageRandomUpdate()
#2 /var/www/html/w/includes/installer/DatabaseUpdater.php(446): DatabaseUpdater->runUpdates(array, boolean)
#3 /var/www/html/w/maintenance/update.php(200): DatabaseUpdater->doUpdates(array)
#4 /var/www/html/w/maintenance/doMaintenance.php(94): UpdateMediaWiki->execute()
#5 /var/www/html/w/maintenance/update.php(245): require_once(string)
#6 {main}

Please correct the update script to report the error.

Complete details are in Updating to 1.29 can only be done in non-readonly mode (revised for 1.31.0).

This is similar to T151833, but I think failing to report the error is a new bug.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 9 2018, 4:42 PM
Reedy updated the task description. (Show Details)Sep 9 2018, 5:26 PM