P4DTI issue job000406

TitleMySQL integrity error when you create a new bug in Bugzilla and update it quickly
Statusclosed
Prioritycritical
Assigned userNick Barnes
OrganizationRavenbrook
DescriptionIf you create a new bug in Bugzilla and update it quickly, then sometimes you get an integrity error from MySQL.
The error message is:
Traceback (innermost last):
  ...
  File "/usr/lib/python1.5/site-packages/MySQLdb.py", line 238, in __do_query
    db.query(q)
IntegrityError: (1062, "Duplicate entry '2' for key 1")
AnalysisThis is because changed_bugs_since is returning a list of bugs including the same bug twice. Because the bug is new, it will try to setup for replication twice, causing the above integrity error in MySQL. It's in the list twice because it matches two of the selects; this is because the delta_ts in the bugs table is later than the last bug_when in the bugs_activity table, so it matches both "new and touched" and "changed".
We could work around this by excluding from the "new and touched" bugs, all bugs which have a bugs_activity row whose bug_when is more recent than the since argument to changed_bugs_since.
Alternatively, we could filter the results for duplicates. This might make the selects easier to write and possibly make the function a bit more robust.
How foundmanual_test
EvidenceFound during testing of version 1.2 against Bugzilla 2.14.
Observed in1.1.6
Introduced in0.5.0
Created byNick Barnes
Created on2001-10-18 15:46:11
Last modified byGareth Rees
Last modified on2001-12-10 19:58:18
History2001-10-18 GDR Created.

Fixes

Change Effect Date User Description
23333 closed 2001-10-18 15:56:04 Nick Barnes Stop bugs appearing twice in the result of changed_entities in the Bugzilla integration.