Brian Murray has proposed merging autopkgtest-cloud:or-replace into 
autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~ubuntu-release/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/457095

publish-db had been failing for the past couple of days due to the following 
Traceback:

publish-db[2289488]: Traceback (most recent call last):
publish-db[2289488]:   File "/home/ubuntu/webcontrol/publish-db", line 197, in 
<module>
publish-db[2289488]:     db_con = init_db(target_new, target, 
config["web"]["database"])
publish-db[2289488]:   File "/home/ubuntu/webcontrol/publish-db", line 68, in 
init_db
publish-db[2289488]:     db.execute(
publish-db[2289488]: sqlite3.IntegrityError: UNIQUE constraint failed: 
current_version.release, current_version.package
systemd[1]: publish-db.service: Main process exited, code=exited, 
status=1/FAILURE
systemd[1]: publish-db.service: Failed with result 'exit-code'.

>From what I can tell the code copies package version information from the 
>path_current (~/public/autopkgtest.db) database into the current_version table 
>for the path (~/public/autopkgtest.db.new) database. For unknown reasons 
>(perhaps it failed earlier for different reasons?) the primary key (release, 
>version) already exist in the autopkgtest.db.new database. Regardless we can 
>work around this by either using 'INSERT OR REPLACE INTO' or 'INSERT OR IGNORE 
>INTO'. I chose the former as it seemed to be like we should be updating the 
>database with the most recent information e.g. if a package moved pockets or 
>components. 
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of 
autopkgtest-cloud:or-replace into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/publish-db b/charms/focal/autopkgtest-web/webcontrol/publish-db
index 76a2177..76883bd 100755
--- a/charms/focal/autopkgtest-web/webcontrol/publish-db
+++ b/charms/focal/autopkgtest-web/webcontrol/publish-db
@@ -66,7 +66,7 @@ def init_db(path, path_current, path_rw):
 
     try:
         db.execute(
-            "INSERT INTO current_version "
+            "INSERT OR REPLACE INTO current_version "
             "(release, pocket, component, package, version) "
             "SELECT release, pocket, component, package, version "
             "FROM current.current_version"
-- 
Mailing list: https://launchpad.net/~canonical-ubuntu-qa
Post to     : canonical-ubuntu-qa@lists.launchpad.net
Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa
More help   : https://help.launchpad.net/ListHelp

Reply via email to