[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/02: Use advisory locks to avoid deadlocks during data deletion
From: |
Christopher Baines |
Subject: |
01/02: Use advisory locks to avoid deadlocks during data deletion |
Date: |
Mon, 28 Nov 2022 08:10:06 -0500 (EST) |
cbaines pushed a commit to branch master
in repository data-service.
commit 38b36570132f8463cc763256aeab7613656278e6
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Mon Nov 28 10:26:46 2022 +0000
Use advisory locks to avoid deadlocks during data deletion
In the case where multiple data deleting processes end up running at the
same
time.
---
guix-data-service/data-deletion.scm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/guix-data-service/data-deletion.scm
b/guix-data-service/data-deletion.scm
index e4762c9..6794bea 100644
--- a/guix-data-service/data-deletion.scm
+++ b/guix-data-service/data-deletion.scm
@@ -206,6 +206,10 @@ WHERE id IN (
(with-postgresql-transaction
conn
(lambda (conn)
+ (obtain-advisory-transaction-lock
+ conn
+ 'delete-revisions-from-branch)
+
(delete-from-git-commits conn)
(delete-jobs conn)
@@ -538,6 +542,10 @@ WHERE NOT EXISTS (
(with-postgresql-transaction
conn
(lambda (conn)
+ (obtain-advisory-transaction-lock
+ conn
+ 'delete-unreferenced-derivations)
+
(exec-query
conn
"