From: Ansgar Burchardt Date: Wed, 30 Mar 2016 21:36:23 +0000 (+0200) Subject: Acquire a lock in the main process when writing Contents X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=294ab6353d6dc713d106d599dc117dae98441504;p=dak.git Acquire a lock in the main process when writing Contents This should prevent changes to the {src,bin}_contents tables and result in all helper processes seeing the same data. --- diff --git a/daklib/contents.py b/daklib/contents.py index 08b09cb3..75fb5e59 100644 --- a/daklib/contents.py +++ b/daklib/contents.py @@ -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: