]> git.decadent.org.uk Git - dak.git/commitdiff
Acquire a lock in the main process when writing Contents
authorAnsgar Burchardt <ansgar@debian.org>
Wed, 30 Mar 2016 21:36:23 +0000 (23:36 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Wed, 30 Mar 2016 21:36:23 +0000 (23:36 +0200)
This should prevent changes to the {src,bin}_contents tables and result
in all helper processes seeing the same data.

daklib/contents.py

index 08b09cb3aac0958209f54b66620c0f376799e71c..75fb5e59b96d7c06a54fcc2a0b2dc4c2b2103ae7 100644 (file)
@@ -299,6 +299,11 @@ class ContentsWriter(object):
         deb_id = get_override_type('deb', session).overridetype_id
         udeb_id = get_override_type('udeb', session).overridetype_id
         pool = Pool()
+
+        # Lock tables so that nobody can change things underneath us
+        session.execute("LOCK TABLE bin_contents IN SHARE MODE")
+        session.execute("LOCK TABLE src_contents IN SHARE MODE")
+
         for suite in suite_query:
             suite_id = suite.suite_id
             for component in component_query: