summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/hashserv
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2023-12-04 09:03:43 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-04 22:36:09 +0000
commit70ad9b9b309575134834757468cb32c9e3b87448 (patch)
treefb35ea1f2db0bdbcf097ee1b611fb5aeaf46b5ae /bitbake/lib/hashserv
parentf89d9240b1208e9df28afed840376ca91842e5dd (diff)
downloadpoky-70ad9b9b309575134834757468cb32c9e3b87448.tar.gz
bitbake: hashserv: sqlite: Ensure sync propagates to database connections
When the sqlite database backend was restructured, the code to make the databases run in WAL mode and to control if sync() is called was accidentally dropped. This caused terrible database performance to the point that server timeouts were occurring causing really slow builds. Fix this by properly enabling WAL mode and setting the synchronous flag as requested (Bitbake rev: c5b8c91d325ed1ca8abe5fe28d989693555c0622) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/hashserv')
-rw-r--r--bitbake/lib/hashserv/sqlite.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/bitbake/lib/hashserv/sqlite.py b/bitbake/lib/hashserv/sqlite.py
index f65036be93..f93cb2c1dd 100644
--- a/bitbake/lib/hashserv/sqlite.py
+++ b/bitbake/lib/hashserv/sqlite.py
@@ -109,11 +109,11 @@ class DatabaseEngine(object):
109 ) 109 )
110 110
111 def connect(self, logger): 111 def connect(self, logger):
112 return Database(logger, self.dbname) 112 return Database(logger, self.dbname, self.sync)
113 113
114 114
115class Database(object): 115class Database(object):
116 def __init__(self, logger, dbname, sync=True): 116 def __init__(self, logger, dbname, sync):
117 self.dbname = dbname 117 self.dbname = dbname
118 self.logger = logger 118 self.logger = logger
119 119
@@ -121,6 +121,11 @@ class Database(object):
121 self.db.row_factory = sqlite3.Row 121 self.db.row_factory = sqlite3.Row
122 122
123 with closing(self.db.cursor()) as cursor: 123 with closing(self.db.cursor()) as cursor:
124 cursor.execute("PRAGMA journal_mode = WAL")
125 cursor.execute(
126 "PRAGMA synchronous = %s" % ("NORMAL" if sync else "OFF")
127 )
128
124 cursor.execute("SELECT sqlite_version()") 129 cursor.execute("SELECT sqlite_version()")
125 130
126 version = [] 131 version = []