P4DTI issue job000693

TitleChanging rid and running refresh script causes confusion
Statusclosed
Priorityessential
Assigned userNick Barnes
OrganizationRavenbrook
DescriptionIf the administrator changes the 'rid' configuration parameter after the P4DTI has been installed and run, the replicator will no longer replicate the jobs and issues which it was previously replicating. This is correct behaviour, because those jobs and issues 'belong' to a different replicator (one with the old 'rid'). If the 'refresh.py' script is then run, it attempts to replicate all currently-replicated issues (or new issues which pass the replicate_p test). This is wrong: it should only attempt to replicate issues with the correct rid or new issues which pass the replicate_p test. A deeply confusing error message is generated (a _mysql_exceptions.IntegrityError message, with a lengthy backtrace):

Traceback (most recent call last):
File "refresh.py", line 33, in ?
    r.refresh_perforce_jobs()
File "replicator.py", line 826, in refresh_perforce_jobs
    self.replicate_all_dt_to_p4()
File "replicator.py", line 1229, in replicate_all_dt_to_p4
    self.replicate(issue, { 'Job': jobname }, 'dt')
File "replicator.py", line 1414, in replicate
    issue.setup_for_replication(job['Job'])
File "dt_bugzilla.py", line 157, in setup_for_replication
    self.make_p4dti_bug(jobname, created=0)
File "dt_bugzilla.py", line 154, in make_p4dti_bug
self.dt.bugzilla.add_p4dti_bug(self.p4dti_bug, created)
File "bugzilla.py", line 1434, in add_p4dti_bug
    self.insert_row_rid_sid('p4dti_bugs', dict)
File "bugzilla.py", line 550, in insert_row_rid_sid
    self.insert_row(table, dict)
File "bugzilla.py", line 539, in insert_row
    rows = self.execute(command)
File "bugzilla.py", line 96, in execute
    self.cursor.execute(sql)
File "/usr/local/lib/python2.2/site-packages/MySQLdb/cursors.py", line 61, in execute
    r = self._query(query)
File "/usr/local/lib/python2.2/site-packages/MySQLdb/cursors.py", line 168, in _query
    rowcount = self._BaseCursor__do_query(q)
File "/usr/local/lib/python2.2/site-packages/MySQLdb/cursors.py", line 112, in __do_query
    db.query(q)
_mysql_exceptions.IntegrityError: (1062, "Duplicate entry '1' for key 1")
AnalysisIn replicate_all_dt_to_p4, test the rid value.
This is Perforce job 007871.
See also job000380.
How foundcustomer
Evidence[1] <http://info.ravenbrook.com/mail/2002/04/17/21-45-01/0.txt>
Observed in1.5.3
Introduced in0.5.0
Created byNick Barnes
Created on2003-05-16 15:38:15
Last modified byNick Barnes
Last modified on2003-05-30 16:32:06
History2003-05-16 NB Created.
2003-05-30 NB Updated after testing reveals that the breakage is only on refresh.

Fixes

Change Effect Date User Description
46718 closed 2003-05-30 16:31:46 Nick Barnes When replicating all issues to Perforce, take care not to replicate ones which are replicated by someone else.