Page MenuHomePhabricator

MediaWiki 1.28.0 Updater failed to detect shared DB tables
Closed, ResolvedPublic

Description

There are interwiki & ipblocks with many other tables in both the current database and shared database. I am very sure that the account used for updater have full rights for both database.
However, the updater were failed to detect tables in shared database, and resulting create table already exits, which lead to error.

$wgSharedDB		= 'wikidata';
$wgSharedTables[] = 'user';
$wgSharedTables[] = 'user_properties';
$wgSharedTables[] = 'user_groups';
$wgSharedTables[] = 'spoofuser'; 
$wgSharedTables[] = 'interwiki'; 
$wgEnableScaryTranscluding = true; 
$wgSharedTables[] = 'ipblocks';
$wgSharedTables[] = 'abuse_filter';
$wgSharedTables[] = 'abuse_filter_action';
$wgSharedTables[] = 'abuse_filter_history';
php /wiki/maintenance/update.php --dbuser root --dbpass ******** --conf /wiki/LocalSettings.php --doshared --wiki moegirl --server https://zh.moegirl.org --nopurge

MediaWiki 1.28.0 Updater

Your composer.lock file is up to date with current dependencies!
Going to run database updates for moegirl
Depending on the size of your database this may take a while!
...echo_subscription doesn't exist.
Turning off Content Handler DB fields for this part of upgrade.
...ipblocks table does not exist, skipping new field patch.
...ipblocks table does not exist, skipping new field patch.
Creating interwiki table ...[0cd9644b7f61e6993060d51a] [no req]   DBQueryError from line 1054 of /wiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: CREATE TABLE `wikidata`.`interwiki` (
 iw_prefix varchar(32) NOT NULL,
 iw_url blob NOT NULL,
 iw_local BOOL NOT NULL,
 UNIQUE KEY iw_prefix (iw_prefix)
 ) ENGINE=InnoDB

Function: Database::sourceFile( /wiki/maintenance/archives/patch-interwiki.sql )
Error: 1050 Table 'interwiki' already exists (10.0.0.***:3306)

Backtrace:
#0 /wiki/includes/libs/rdbms/database/Database.php(912): Database->reportQueryError(string, integer, string, string, boolean)
#1 /wiki/includes/libs/rdbms/database/Database.php(3136): Database->query(string, string)
#2 /wiki/includes/libs/rdbms/database/Database.php(3084): Database->sourceStream(unknown type, NULL, NULL, string, NULL)
#3 /wiki/includes/installer/DatabaseUpdater.php(690): Database->sourceFile(string)
#4 /wiki/includes/installer/MysqlUpdater.php(364): DatabaseUpdater->applyPatch(string, boolean, string)
#5 /wiki/includes/installer/DatabaseUpdater.php(472): MysqlUpdater->doInterwikiUpdate()
#6 /wiki/includes/installer/DatabaseUpdater.php(433): DatabaseUpdater->runUpdates(array, boolean)
#7 /wiki/maintenance/update.php(172): DatabaseUpdater->doUpdates(array)
#8 /wiki/maintenance/doMaintenance.php(111): UpdateMediaWiki->execute()
#9 /wiki/maintenance/update.php(217): require_once(string)
#10 {main}

Event Timeline

Reedy subscribed.

Did you have this problem before 1.28?

The logic looks superficially correct; doInterwikiUpdate calls doTable( 'interwiki' ) which if interwiki is in $wgSharedTables should not run the updates...

I don't have such problem before MW1.28...

freephile subscribed.

I'm seeing this exact behavior trying to run update.php on a 1.28.2 installation. Without the --doshared option, it completes without complaint. When I add in the --doshared, it collides with the existing interwiki table.

Same issue reported at T156875

Same error happened again during MW 1.28 to 1.29 upgrade.

Creating interwiki table ...[a76b9edabc99b273f5dff5eb] [no req] Wikimedia\Rdbms\DBQueryError from line 1075 of /mediawiki-1.29.1/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: CREATE TABLE wikidata.interwiki (
iw_prefix varchar(32) NOT NULL,
iw_url blob NOT NULL,
iw_local BOOL NOT NULL,
UNIQUE KEY iw_prefix (iw_prefix)
) ENGINE=InnoDB, DEFAULT CHARSET=binary

Function: Wikimedia\Rdbms\Database::sourceFile( /mediawiki-1.29.1/maintenance/archives/patch-interwiki.sql )
Error: 1050 Table 'interwiki' already exists (192.168.196.17:3306)

Backtrace:
#0 /mediawiki-1.29.1/includes/libs/rdbms/database/Database.php(933): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#1 /mediawiki-1.29.1/includes/libs/rdbms/database/Database.php(3146): Wikimedia\Rdbms\Database->query(string, string)
#2 /mediawiki-1.29.1/includes/libs/rdbms/database/Database.php(3095): Wikimedia\Rdbms\Database->sourceStream(unknown type, NULL, NULL, string, NULL)
#3 /mediawiki-1.29.1/includes/installer/DatabaseUpdater.php(673): Wikimedia\Rdbms\Database->sourceFile(string)
#4 /mediawiki-1.29.1/includes/installer/MysqlUpdater.php(374): DatabaseUpdater->applyPatch(string, boolean, string)
#5 /mediawiki-1.29.1/includes/installer/DatabaseUpdater.php(472): MysqlUpdater->doInterwikiUpdate()
#6 /mediawiki-1.29.1/includes/installer/DatabaseUpdater.php(436): DatabaseUpdater->runUpdates(array, boolean)
#7 /mediawiki-1.29.1/maintenance/update.php(174): DatabaseUpdater->doUpdates(array)
#8 /mediawiki-1.29.1/maintenance/doMaintenance.php(111): UpdateMediaWiki->execute()
#9 /mediawiki-1.29.1/maintenance/update.php(219): require_once(string)
#10 {main}

Reedy changed the task status from Open to Stalled.Jun 18 2019, 8:24 PM

Is this still a problem on 1.31?

1.28-1.30 are End of Life now...

Zoglun claimed this task.

Hi @Reedy,

It does not seems to repeat in MW 1.31. I have changed this task to resolved status.