aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/datastore/sqlite.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-04-23 20:52:39 +0100
committerChristopher Baines <mail@cbaines.net>2023-04-23 21:23:21 +0100
commit28d0ca2690bfb01f6dea0e79cc4d28fdfa23b4b0 (patch)
tree1966ec09cd6d252b2ff669cd7213a38bef59d0e7 /guix-build-coordinator/datastore/sqlite.scm
parentcf1900eb26700e36a0a78e0b8b4415d58519df15 (diff)
downloadbuild-coordinator-28d0ca2690bfb01f6dea0e79cc4d28fdfa23b4b0.tar
build-coordinator-28d0ca2690bfb01f6dea0e79cc4d28fdfa23b4b0.tar.gz
Use an in memory table for the build_allocation_plan
Since this doesn't need to be persisted and changes often.
Diffstat (limited to 'guix-build-coordinator/datastore/sqlite.scm')
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index 3221f9c..5772402 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -144,6 +144,19 @@
(sqlite-exec db "PRAGMA synchronous = NORMAL;")
(sqlite-exec db "PRAGMA temp_store = MEMORY;")
(sqlite-exec db "PRAGMA foreign_keys = ON;")
+
+ (sqlite-exec db "ATTACH DATABASE 'file:/mem?vfs=memdb' AS mem;")
+
+ (sqlite-exec
+ db
+ "
+CREATE TABLE IF NOT EXISTS mem.build_allocation_plan (
+ build_id INTEGER NOT NULL,
+ agent_id TEXT NOT NULL,
+ ordering INTEGER NOT NULL,
+ PRIMARY KEY (agent_id, build_id)
+);")
+
(list db)))
#:destructor
(let ((writer-thread-destructor-counter
@@ -189,6 +202,9 @@
(sqlite-exec db "PRAGMA temp_store = MEMORY;")
(sqlite-exec db "PRAGMA busy_timeout = 4000;")
(sqlite-exec db "PRAGMA cache_size = -16000;")
+
+ (sqlite-exec db "ATTACH DATABASE 'file:/mem?vfs=memdb' AS mem;")
+
(list db)))
#:destructor
(let ((reader-thread-destructor-counter