mirror of
https://git.yoctoproject.org/poky
synced 2026-03-17 04:39:40 +01:00
bitbake: persist_data.py: Immediately get exclusive lock in __setitem__
To avoid races, SQLTable::__setitem__ needs an exclusive lock for the entire transaction, not just the INSERT/UPDATE part. (Bitbake rev: feb43e7c30f5bfab75d718896c45df621810d06f) Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
96adf215cc
commit
1b1a533133
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user