Jump to content

Topic on Extension talk:RottenLinks

"multiple primary key defined ..." error when running update.php in MW1.35 with existing Rottenlinks setup

18
Summary last edited by Tosfos 19:54, 15 June 2021 3 years ago

Fixed with version 1.0.16

Tenbergen (talkcontribs)

Just updated 2 wikis from MW1.34 to 1.35, same problem on both. When I run update.php at the end, I get the following error. If I disable rottenlinks update.php finishes and the wiki seems to work normally. If I then re-enable RottenLinks, wiki continues to work and RottenLinks "Status of external links" page seems to work as well. However, update.php now fails again if I run it.

Here is the error:

...rottenlinks table already exists.
...rl_externallink in table rottenlinks already modified by patch /home/xxx/xxx.xxx..ca/extensions/RottenLinks/includes/../sql/patches/patch-primary-key.sql.
Adding rl_id field to table rottenlinks ...Wikimedia\Rdbms\DBQueryError from line 1699 of /home/xxx/xxx.xxx..ca/includes/libs/rdbms/database/Database.php: Error 1068: Multiple primary key defined (ccmdbpriv-db.ccmdb.kuality.ca)
Function: Wikimedia\Rdbms\Database::sourceFile( /home/xxx/xxx.xxx..ca/extensions/RottenLinks/includes/../sql/patches/patch-add-rl_id.sql )
Query: ALTER TABLE `mw_rottenlinks`
 ADD COLUMN rl_id INT AUTO_INCREMENT PRIMARY KEY


#0 /home/xxx/xxx.xxx..ca/includes/libs/rdbms/database/Database.php(1683): Wikimedia\Rdbms\Database->getQueryException('Multiple primar...', 1068, 'ALTER TABLE `mw...', 'Wikimedia\\Rdbms...')
#1 /home/xxx/xxx.xxx..ca/includes/libs/rdbms/database/Database.php(1658): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Multiple primar...', 1068, 'ALTER TABLE `mw...', 'Wikimedia\\Rdbms...')
#2 /home/xxx/xxx.xxx..ca/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError('Multiple primar...', 1068, 'ALTER TABLE `mw...', 'Wikimedia\\Rdbms...', false)
#3 /home/xxx/xxx.xxx..ca/includes/libs/rdbms/database/Database.php(5075): Wikimedia\Rdbms\Database->query('ALTER TABLE `mw...', 'Wikimedia\\Rdbms...')
#4 /home/xxx/xxx.xxx..ca/includes/libs/rdbms/database/Database.php(5010): Wikimedia\Rdbms\Database->sourceStream(Resource id #956, NULL, NULL, 'Wikimedia\\Rdbms...', NULL)
#5 /home/xxx/xxx.xxx..ca/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->sourceFile('/home/ccmdb/ccm...')
#6 /home/xxx/xxx.xxx..ca/includes/libs/rdbms/database/MaintainableDBConnRef.php(35): Wikimedia\Rdbms\DBConnRef->__call('sourceFile', Array)
#7 /home/xxx/xxx.xxx..ca/includes/installer/DatabaseUpdater.php(727): Wikimedia\Rdbms\MaintainableDBConnRef->sourceFile('/home/ccmdb/ccm...')
#8 /home/xxx/xxx.xxx..ca/includes/installer/DatabaseUpdater.php(801): DatabaseUpdater->applyPatch('/home/ccmdb/ccm...', true, 'Adding rl_id fi...')
#9 /home/xxx/xxx.xxx..ca/includes/installer/DatabaseUpdater.php(512): DatabaseUpdater->addField('rottenlinks', 'rl_id', '/home/ccmdb/ccm...', true)
#10 /home/xxx/xxx.xxx..ca/includes/installer/DatabaseUpdater.php(480): DatabaseUpdater->runUpdates(Array, true)
#11 /home/xxx/xxx.xxx..ca/maintenance/update.php(181): DatabaseUpdater->doUpdates(Array)
#12 /home/xxx/xxx.xxx..ca/maintenance/doMaintenance.php(107): UpdateMediaWiki->execute()
#13 /home/xxx/xxx.xxx..ca/maintenance/update.php(253): require_once('/home/ccmdb/ccm...')
#14 {main}
Tenbergen (talkcontribs)

Still getting this error in the newest version I just downloaded

Oetterer (talkcontribs)

can confirm, MW REL1_35, php 7.3 and 7.4.3, mariadb 10.3.25

Tosfos (talkcontribs)

WikiTeq is working on a fix for this issue. It should be ready within a week.

Pastakhov (talkcontribs)
Oetterer (talkcontribs)

tried with version 1.0.11 (#4e7e675) and 1.0.12 (#1f4b396) but still getting this when trying to run update.php:

Adding rl_id field to table rottenlinks ...Wikimedia\Rdbms\DBQueryError from line 1699 of /path/to/wiki/includes/libs/rdbms/database/Database.php: Error 1068: Multiple primary key defined (localhost)
Function: Wikimedia\Rdbms\Database::sourceFile( /path/to/wiki/extensions/RottenLinks/includes/../sql/patches/patch-add-rl_id.sql )
Query: ALTER TABLE `mw_rottenlinks`
 ADD COLUMN `rl_id` INT UNSIGNED AUTO_INCREMENT PRIMARY KEY FIRST


#0 /path/to/wiki/includes/libs/rdbms/database/Database.php(1683): Wikimedia\Rdbms\Database->getQueryException()
#1 /path/to/wiki/includes/libs/rdbms/database/Database.php(1658): Wikimedia\Rdbms\Database->getQueryExceptionAndLog()
#2 /path/to/wiki/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError()
#3 /path/to/wiki/includes/libs/rdbms/database/Database.php(5073): Wikimedia\Rdbms\Database->query()
#4 /path/to/wiki/includes/libs/rdbms/database/Database.php(5008): Wikimedia\Rdbms\Database->sourceStream()
#5 /path/to/wiki/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->sourceFile()
#6 /path/to/wiki/includes/libs/rdbms/database/MaintainableDBConnRef.php(35): Wikimedia\Rdbms\DBConnRef->__call()
#7 /path/to/wiki/includes/installer/DatabaseUpdater.php(769): Wikimedia\Rdbms\MaintainableDBConnRef->sourceFile()
#8 /path/to/wiki/includes/installer/DatabaseUpdater.php(843): DatabaseUpdater->applyPatch()
#9 /path/to/wiki/includes/installer/DatabaseUpdater.php(554): DatabaseUpdater->addField()
#10 /path/to/wiki/includes/installer/DatabaseUpdater.php(522): DatabaseUpdater->runUpdates()
#11 /path/to/wiki/maintenance/update.php(181): DatabaseUpdater->doUpdates()
#12 /path/to/wiki/maintenance/doMaintenance.php(107): UpdateMediaWiki->execute()
#13 /path/to/wiki/maintenance/update.php(253): require_once('/var/www/html/w...')
#14 {main}

installation is still on MW REL1_35, php 7.4, SMW 3.2.2, and mariadb 10.3.25

Tenbergen (talkcontribs)

Still a problem in 1.0.12 (7ce92c7) 2021-01-12T15:37:52 as cloned 2021-03-10.

Tosfos (talkcontribs)

Was a previous version once installed? Or is it a new installation of the extension?

Oetterer (talkcontribs)

Indeed, the system was upgraded from 1.31 to 1.35. Rottenlinks was working as expected in the previous system. After upgrading Mediawiki and updating Rottenlinks, the reportet error occurred.

Tenbergen (talkcontribs)

Same as Oetterer, I have been running the extension for a long time and it's only acting up during the update.php since the time I raised this issue. I was just upgrading from the most recent version at the time, though, not a large step upgrade. I don't know what version of Rottenlinks I had before this started acting up, it's been a while. If I comment out the extension while running update.php, and then enable it again, it seems to be working fine. I haven't tried to force it to run an update of the list to see if that gives errors.

Tosfos (talkcontribs)

Got it. My guess is that after our patch the extension will do fine in a new installation, but won't work with an existing installation. Let me see if we can fix it. We're a bit overloaded right now, but please feel free to ping me again.

Tenbergen (talkcontribs)

Is there a specific table/file/other content that stores this that I could just blow away so the install is "as new"? Then I would just need to run the update to re-populate it. Mind you, if it was that easy you could probably put it into the update itself. Just hoping I guess :-)

Tosfos (talkcontribs)

You can try dropping the rottenlinks table.

Tosfos (talkcontribs)

Please let me know if this works.

Tenbergen (talkcontribs)

Thanks Tosfos, I tried that. I ran drop table mw_rottenlinks at the SQL console and deleted the table. Update.php finishes without error after that. Was able to manually run updateExternalLinks.php after and this re-created the content. That allows me to fix the problem so it doesn't show up at every update.php, but it would be even better if RottenLinks just caused that to happen automagically when update.php runs.

Tosfos (talkcontribs)

Got it. Just making sure this fix worked. We'll incorporate this functionality into the extension update itself. We'll submit a patch soon.

Tosfos (talkcontribs)

Just noting that our patch was submitted and is awaiting merge. It is here.

Tosfos (talkcontribs)

Merged! If you're experiencing these issue, update your extension to version 1.0.16.