← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/bug-1334937 into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/bug-1334937 into lp:launchpad.

Commit message:
Ensure that the publisher has no transaction open when it invokes apt-ftparchive, as that can anger pgkillactive.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1334937 in Launchpad itself: "publish-distro keeps a transaction open during apt-ftparchive"
  https://bugs.launchpad.net/launchpad/+bug/1334937

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-1334937/+merge/224747

Ensure that the publisher has no transaction open when it invokes apt-ftparchive, as that can anger pgkillactive. We normally run into this when we've wiped a-f's caches, as it can take several hours to rebuild them, and publish-ftpmaster.py crashes afterwards when it sees that its DB connection has been reaped.
-- 
https://code.launchpad.net/~wgrant/launchpad/bug-1334937/+merge/224747
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-1334937 into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/model/ftparchive.py'
--- lib/lp/archivepublisher/model/ftparchive.py	2014-06-11 08:23:35 +0000
+++ lib/lp/archivepublisher/model/ftparchive.py	2014-06-27 05:25:41 +0000
@@ -11,9 +11,11 @@
     Join,
     )
 from storm.store import EmptyResultSet
+import transaction
 
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.model.sourcepackagename import SourcePackageName
+from lp.scripts.helpers import TransactionFreeOperation
 from lp.services.command_spawner import (
     CommandSpawner,
     OutputLineHandler,
@@ -141,7 +143,9 @@
         self.generateFileLists(is_careful)
         self.log.debug("Doing apt-ftparchive work.")
         apt_config_filename = self.generateConfig(is_careful)
-        self.runApt(apt_config_filename)
+        transaction.commit()
+        with TransactionFreeOperation():
+            self.runApt(apt_config_filename)
         self.cleanCaches()
 
     def runAptWithArgs(self, apt_config_filename, *args):
@@ -829,4 +833,6 @@
         with open(apt_config_filename, "w") as fp:
             fp.write(apt_config.getvalue())
         apt_config.close()
-        self.runAptWithArgs(apt_config_filename, "clean")
+        transaction.commit()
+        with TransactionFreeOperation():
+            self.runAptWithArgs(apt_config_filename, "clean")


Follow ups