Page MenuHomePhabricator

"Duplicate entry '0-XXX' for key 'itr_itemid_id_revision_id'" in "INSERT INTO `discussiontools_item_revisions`"
Closed, ResolvedPublic

Description

(The latest deployment of DiscussionTools permalinks backend to group1 wikis T315353#8392662 has resulted in some new errors, although a lot less numerous this time. It really is a gift that keeps on giving.)

There are a few occurrences of "Duplicate entry '0-XXX' for key 'itr_itemid_id_revision_id'" (where "0" is in fact always 0, and "XXX" is different revision IDs).

https://logstash.wikimedia.org/goto/acc9b5e141d0d86a3ca1e940c4178c5c

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

This looks like a bug in our code – that value should not be zero.

(This is distinct from T323080: "Duplicate entry 'XXX-YYY' for key 'itr_itemid_id_revision_id'" in "INSERT INTO `discussiontools_item_revisions`")

Related Objects

Event Timeline

This seems to be caused by the fix for T322701 (rEDTO08e1073f58b6: ThreadItemStore: Handle race conditions when finding/inserting outside of…).

The only way for the code to try inserting 0 into itr_itemid_id is if the insertId() call after the upsert() returns 0. I thought that it would return the ID of the inserted/updated row. Is that not the case?

ppelberg added a project: Editing-team.
ppelberg moved this task from Untriaged to Upcoming on the Editing-team board.