Page MenuHomePhabricator

DBQueryError: "Duplicate entry … for key 'itp_items_id_page_id'" in "INSERT INTO `discussiontools_item_pages`"
Closed, ResolvedPublicPRODUCTION ERROR

Description

https://logstash.wikimedia.org/goto/0f4ac68ada7dbdf16b00251e620ff8c2

image.png (529×2 px, 93 KB)

Error
labels.normalized_message
[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1062: Duplicate entry '1-12356970' for key 'itp_items_id_page_id'
Function: MediaWiki\Extension\DiscussionTools\ThreadItemStore::insertThreadItems
Query: INSERT INTO `discussiontools_item_pag
error.stack_trace
from /srv/mediawiki/php-1.41.0-wmf.17/includes/libs/rdbms/database/Database.php(1300)
#0 /srv/mediawiki/php-1.41.0-wmf.17/includes/libs/rdbms/database/Database.php(1284): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /srv/mediawiki/php-1.41.0-wmf.17/includes/libs/rdbms/database/Database.php(1258): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /srv/mediawiki/php-1.41.0-wmf.17/includes/libs/rdbms/database/Database.php(743): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /srv/mediawiki/php-1.41.0-wmf.17/includes/libs/rdbms/database/Database.php(1564): Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#4 /srv/mediawiki/php-1.41.0-wmf.17/extensions/DiscussionTools/includes/ThreadItemStore.php(469): Wikimedia\Rdbms\Database->insert(string, array, string)
#5 /srv/mediawiki/php-1.41.0-wmf.17/includes/libs/rdbms/database/Database.php(2444): MediaWiki\Extension\DiscussionTools\ThreadItemStore->MediaWiki\Extension\DiscussionTools\{closure}(Wikimedia\Rdbms\DatabaseMysqli, string)
#6 /srv/mediawiki/php-1.41.0-wmf.17/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->doAtomicSection(string, Closure, string)
#7 /srv/mediawiki/php-1.41.0-wmf.17/includes/libs/rdbms/database/DBConnRef.php(658): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#8 /srv/mediawiki/php-1.41.0-wmf.17/extensions/DiscussionTools/includes/ThreadItemStore.php(581): Wikimedia\Rdbms\DBConnRef->doAtomicSection(string, Closure, string)
#9 /srv/mediawiki/php-1.41.0-wmf.17/extensions/DiscussionTools/includes/Hooks/DataUpdatesHooks.php(49): MediaWiki\Extension\DiscussionTools\ThreadItemStore->insertThreadItems(MediaWiki\Revision\MutableRevisionRecord, MediaWiki\Extension\DiscussionTools\ContentThreadItemSet)
#10 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/MWCallableUpdate.php(38): MediaWiki\Extension\DiscussionTools\Hooks\DataUpdatesHooks->MediaWiki\Extension\DiscussionTools\Hooks\{closure}()
#11 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesManager.php(506): MWCallableUpdate->doUpdate()
#12 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdates.php(277): MediaWiki\Deferred\DeferredUpdatesManager->attemptUpdate(MWCallableUpdate, Wikimedia\Rdbms\LBFactoryMulti)
#13 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/RefreshSecondaryDataUpdate.php(103): DeferredUpdates::attemptUpdate(MWCallableUpdate, Wikimedia\Rdbms\LBFactoryMulti)
#14 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesManager.php(506): RefreshSecondaryDataUpdate->doUpdate()
#15 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesManager.php(432): MediaWiki\Deferred\DeferredUpdatesManager->attemptUpdate(RefreshSecondaryDataUpdate, Wikimedia\Rdbms\LBFactoryMulti)
#16 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesManager.php(270): MediaWiki\Deferred\DeferredUpdatesManager->run(RefreshSecondaryDataUpdate, string)
#17 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesScope.php(264): MediaWiki\Deferred\DeferredUpdatesManager->MediaWiki\Deferred\{closure}(RefreshSecondaryDataUpdate, integer)
#18 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesScope.php(196): DeferredUpdatesScope->processStageQueue(integer, integer, Closure)
#19 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesManager.php(273): DeferredUpdatesScope->processUpdates(integer, Closure)
#20 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesScope.php(267): MediaWiki\Deferred\DeferredUpdatesManager->MediaWiki\Deferred\{closure}(AtomicSectionUpdate, integer)
#21 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesScope.php(196): DeferredUpdatesScope->processStageQueue(integer, integer, Closure)
#22 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdatesManager.php(278): DeferredUpdatesScope->processUpdates(integer, Closure)
#23 /srv/mediawiki/php-1.41.0-wmf.17/includes/deferred/DeferredUpdates.php(159): MediaWiki\Deferred\DeferredUpdatesManager->doUpdates(integer)
#24 /srv/mediawiki/php-1.41.0-wmf.17/extensions/EventBus/includes/JobExecutor.php(104): DeferredUpdates::doUpdates()
#25 /srv/mediawiki/rpc/RunSingleJob.php(77): MediaWiki\Extension\EventBus\JobExecutor->execute(array)
#26 {main}
Impact
Notes

This is on the discussiontools_item_pages table, hence a new task in addition to:

Related Objects

Event Timeline

matmarex renamed this task from DBQueryError: Duplicate entry '1-XXX' … INSERT INTO discussiontools_item_pages to DBQueryError: "Duplicate entry … for key 'itp_items_id_page_id'" in "INSERT INTO `discussiontools_item_pages`".Jul 31 2023, 12:13 PM
matmarex updated the task description. (Show Details)

This looks like the same kind of problem as T323080. For some unknown reason our updates are being processed more than once at the same time.

Change 944892 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] ThreadItemStore: Ignore duplicates caused by duplicate executions

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

Change 944892 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] ThreadItemStore: Ignore duplicates caused by duplicate executions

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

Change 945803 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@wmf/1.41.0-wmf.20] ThreadItemStore: Ignore duplicates caused by duplicate executions

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

Change 945803 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@wmf/1.41.0-wmf.20] ThreadItemStore: Ignore duplicates caused by duplicate executions

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

Mentioned in SAL (#wikimedia-operations) [2023-08-07T20:14:21Z] <urbanecm@deploy1002> Started scap: Backport for [[gerrit:945803|ThreadItemStore: Ignore duplicates caused by duplicate executions (T323080 T341811)]], [[gerrit:946616|Update wikisource wordmarks and taglines (T341255)]], [[gerrit:946555|update idwiktionary legacy vector logo (T341175)]]

Mentioned in SAL (#wikimedia-operations) [2023-08-07T20:15:45Z] <urbanecm@deploy1002> urbanecm and jdlrobson and anzx and matmarex: Backport for [[gerrit:945803|ThreadItemStore: Ignore duplicates caused by duplicate executions (T323080 T341811)]], [[gerrit:946616|Update wikisource wordmarks and taglines (T341255)]], [[gerrit:946555|update idwiktionary legacy vector logo (T341175)]] synced to the testservers mwdebug2002.codfw.wmnet, mwdebug1002.eqiad.wmnet, mwdebug1001.eqiad.wmnet,

Mentioned in SAL (#wikimedia-operations) [2023-08-07T20:24:43Z] <urbanecm@deploy1002> Finished scap: Backport for [[gerrit:945803|ThreadItemStore: Ignore duplicates caused by duplicate executions (T323080 T341811)]], [[gerrit:946616|Update wikisource wordmarks and taglines (T341255)]], [[gerrit:946555|update idwiktionary legacy vector logo (T341175)]] (duration: 10m 22s)

matmarex claimed this task.

No more errors since the change was deployed, and everything else seems to be working normally:

image.png (523×2 px, 152 KB)