diff options
author | Caleb Ristvedt <caleb.ristvedt@cune.org> | 2020-06-01 21:43:14 -0500 |
---|---|---|
committer | Caleb Ristvedt <caleb.ristvedt@cune.org> | 2020-06-10 21:54:35 -0500 |
commit | 37545de4a3bf59611c184b31506fe9a16abe4c8b (patch) | |
tree | 2f2e008a7634262c59ac4be3ee59731fa0c6a754 /.dir-locals.el | |
parent | 5d6e2255286e591def122ec2f4a3cbda497fea21 (diff) | |
download | guix-37545de4a3bf59611c184b31506fe9a16abe4c8b.tar.gz |
database: ensure update-or-insert is run within a transaction
update-or-insert can break if an insert occurs between when it decides whether to update or insert and when it actually performs that operation. Putting the check and the update/insert operation in the same transaction ensures that the update/insert will only succeed if no other write has occurred in the middle. * guix/store/database.scm (call-with-savepoint): new procedure. (update-or-insert): use call-with-savepoint to ensure the read and the insert/update occur within the same transaction.
Diffstat (limited to '.dir-locals.el')
-rw-r--r-- | .dir-locals.el | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/.dir-locals.el b/.dir-locals.el index 77c12f9411..d9c81b2a48 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -90,6 +90,7 @@ (eval . (put 'with-database 'scheme-indent-function 2)) (eval . (put 'call-with-transaction 'scheme-indent-function 2)) (eval . (put 'with-statement 'scheme-indent-function 3)) + (eval . (put 'call-with-savepoint 'scheme-indent-function 1)) (eval . (put 'call-with-container 'scheme-indent-function 1)) (eval . (put 'container-excursion 'scheme-indent-function 1)) |