Topic on Talk:MediaWiki 1.39

בקש (talkcontribs)

I updated from 1.38.4 to 1.39.4 and raned the update script, the script exits withe the following error:

Modifying tl_namespace field of table templatelinks...Wikimedia\Rdbms\DBQueryError from line 1618 of /var/www/html/w/includes/libs/rdbms/database/Database.php: Error 1091: Can't DROP INDEX `PRIMARY`; check that it exists
Function: Wikimedia\Rdbms\Database::sourceFile( /var/www/html/w/maintenance/archives/patch-templatelinks-tl_title-nullable.sql )
Query: ALTER TABLE  `mw_templatelinks`
DROP  PRIMARY KEY


# 0 /var/www/html/w/includes/libs/rdbms/database/Database.php(1602): Wikimedia\Rdbms\Database->getQueryException('Can't DROP INDE...', 1091, 'ALTER TABLE  `m...', 'Wikimedia\\Rdbms...')
# 1 /var/www/html/w/includes/libs/rdbms/database/Database.php(1576): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Can't DROP INDE...', 1091, 'ALTER TABLE  `m...', 'Wikimedia\\Rdbms...')
# 2 /var/www/html/w/includes/libs/rdbms/database/Database.php(952): Wikimedia\Rdbms\Database->reportQueryError('Can't DROP INDE...', 1091, 'ALTER TABLE  `m...', 'Wikimedia\\Rdbms...', false)
# 3 /var/www/html/w/includes/libs/rdbms/database/Database.php(3302): Wikimedia\Rdbms\Database->query('ALTER TABLE  `m...', 'Wikimedia\\Rdbms...')
# 4 /var/www/html/w/includes/libs/rdbms/database/Database.php(3241): Wikimedia\Rdbms\Database->sourceStream(Resource id #1341, NULL, NULL, 'Wikimedia\\Rdbms...', NULL)
# 5 /var/www/html/w/includes/libs/rdbms/database/DBConnRef.php(103): Wikimedia\Rdbms\Database->sourceFile('/var/www/html/w...')
# 6 /var/www/html/w/includes/libs/rdbms/database/DBConnRef.php(807): Wikimedia\Rdbms\DBConnRef->__call('sourceFile', Array)
# 7 /var/www/html/w/includes/installer/DatabaseUpdater.php(718): Wikimedia\Rdbms\DBConnRef->sourceFile('/var/www/html/w...')
# 8 /var/www/html/w/includes/installer/DatabaseUpdater.php(1000): DatabaseUpdater->applyPatch('/var/www/html/w...', false, 'Modifying tl_na...')
# 9 /var/www/html/w/includes/installer/DatabaseUpdater.php(547): DatabaseUpdater->modifyField('templatelinks', 'tl_namespace', 'patch-templatel...')
# 10 /var/www/html/w/includes/installer/DatabaseUpdater.php(511): DatabaseUpdater->runUpdates(Array, false)
# 11 /var/www/html/w/maintenance/update.php(202): DatabaseUpdater->doUpdates(Array)
# 12 /var/www/html/w/maintenance/includes/MaintenanceRunner.php(309): UpdateMediaWiki->execute()
# 13 /var/www/html/w/maintenance/doMaintenance.php(85): MediaWiki\Maintenance\MaintenanceRunner->run()
# 14 /var/www/html/w/maintenance/update.php(312): require_once('/var/www/html/w...')
# 15 {main}

what can i do to fix it?

Prod (talkcontribs)

Did you run the updater twice? I think I had a similar problem. The first time I ran it, it errored half way through the script, and then the second time it couldn't drop the index.

You might be able to get past this by recreating the index.

Pipsteer (talkcontribs)

We're running into the same issue on our wiki, updating to 1.39.3. Oddly enough most of the wiki funcionality is still without problems. I'll let you know what happens after recreating the index

Pipsteer (talkcontribs)

I found the relevant SQL commands in

~/public_html/maintenance/archives/patch-templatelinks-tl_title-nullable.sql


I tried to recreate the primary key like they did there, but got the following response:

Duplicate entry '568-1' for key 'PRIMARY'

Pipsteer (talkcontribs)

update: I found a similar problem described in https://phabricator.wikimedia.org/T332333 . After following the steps of this user to resolve the issue, update.php worked for me as well. It seems that some old templatelink entries were created with empty title fields, which make the primary key assignment impossible due to duplicates.

After clearing the duplicate entries with empty titles in the database, my issue was resolved.

בקש (talkcontribs)

On the mean time i downgraded back to 1.38.4 because my whole website crashed (the db refused the server connection) and lost 1500 edits of my users. I gonna try what you did here hope this helps me. Thanks

Reply to "update.php fails"