Patchwork [bitbake-devel] {PATCH] serv/db: Take an excluside lock on the database

login
register
mail settings
Submitter Richard Purdie
Date Aug. 31, 2013, 10:42 p.m.
Message ID <1377988977.1059.132.camel@ted>
Download mbox | patch
Permalink /patch/57167/
State New
Headers show

Comments

Richard Purdie - Aug. 31, 2013, 10:42 p.m.
We only support one server using the database at a time so take an exclusive
lock and avoid later lock overhead.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---

Patch

diff --git a/bitbake/lib/prserv/db.py b/bitbake/lib/prserv/db.py
index dad445b..5599355 100644
--- a/bitbake/lib/prserv/db.py
+++ b/bitbake/lib/prserv/db.py
@@ -214,7 +214,7 @@  class PRData(object):
         except OSError as e:
             if e.errno != errno.EEXIST:
                 raise e
-        self.connection=sqlite3.connect(self.filename, isolation_level="DEFERRED", check_same_thread = False)
+        self.connection=sqlite3.connect(self.filename, isolation_level="EXCLUSIVE", check_same_thread = False)
         self.connection.row_factory=sqlite3.Row
         self._tables={}