aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/bb/persist_data.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py
index de8f87a8b..7357ab2d4 100644
--- a/lib/bb/persist_data.py
+++ b/lib/bb/persist_data.py
@@ -179,6 +179,9 @@ class SQLTable(collections.MutableMapping):
elif not isinstance(value, str):
raise TypeError('Only string values are supported')
+ # Ensure the entire transaction (including SELECT) executes under write lock
+ cursor.execute("BEGIN EXCLUSIVE")
+
cursor.execute("SELECT * from %s where key=?;" % self.table, [key])
row = cursor.fetchone()
if row is not None: