Page MenuHomePhabricator

When inserting new WikiGrok claims, it throws an error if the same claim already exists
Closed, ResolvedPublic


Just got the following error from the WikiGrok API on my local instance:
Function: WikiGrok\\ResponseStoreDB::insertClaims
Error: 1062 Duplicate entry '9-author-add-0hjwrvbwcbk5n7yr4311xc15z1uf9m1b' for key 'wgc_unique' ()

Event Timeline

kaldari raised the priority of this task from to Needs Triage.
kaldari updated the task description. (Show Details)
kaldari added a project: WikiGrok.
kaldari added a subscriber: kaldari.

Currently, ResponseStoreDB#store is treating claims as equal even if their actions differ. However, Claim#equals doesn't do this.

You should be able to reproduce this by submitting a "None of these" answer to WikiGrok – all claims have the "ignore" action – and then submitting a WikiGrok answer with one of the tags selected – the claim will have the "add" action.

Change 203989 had a related patch set uploaded (by Kaldari):
Prevent database error resulting from duplicate unique key

Actually it looks like it was handling different action types fine (the claim key included the action). The problem was that it wasn't looking at database claim entries for statuses other than "new", so as soon as a claim reached the aggregation threshold and was applied or ignored it would then be subject to key duplication.

Change 203989 merged by jenkins-bot:
Prevent database error resulting from duplicate unique key