This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-22
Channels
- # announcements (2)
- # asami (123)
- # aws (17)
- # babashka (77)
- # babashka-sci-dev (23)
- # beginners (48)
- # biff (6)
- # calva (35)
- # cider (16)
- # clj-on-windows (1)
- # clj-yaml (19)
- # clojure (36)
- # clojure-europe (78)
- # clojure-nl (5)
- # clojure-norway (8)
- # clojure-poland (3)
- # clojure-uk (16)
- # clojurescript (17)
- # cursive (6)
- # datahike (3)
- # datalevin (26)
- # duct (7)
- # emacs (41)
- # events (2)
- # fulcro (7)
- # graphql (5)
- # honeysql (13)
- # juxt (3)
- # kaocha (7)
- # lsp (5)
- # malli (12)
- # off-topic (14)
- # pathom (3)
- # portal (1)
- # rdf (9)
- # reitit (3)
- # remote-jobs (2)
- # shadow-cljs (37)
- # spacemacs (5)
- # tools-build (1)
- # tools-deps (20)
- # xtdb (2)
If I want to transact an entity but only if it doesn’t exist yet, how do I manage that?
Doesn’t that have an obvious race condition?
Two parties check for presence simultaneously. Both see that it’s not there’ both transact
Or imagine a counter. Two theads try to increment. Both read value 1. Both will transact to value 2
We do miss a function that does both read and write atomically. So you are right. I wonder why datomic doesn’t have these?
or more generally, maybe expose the transaction explicitly, e.g. introduce something like (start-transaction), (end-transaction), so whatever you do inside, will be part of the transaction
Datomic has transaction functions for this I think
at the KV db level, we need to expose transaction start and end, so as to ensure the correctness.
Some of these work is being done in the query branch, but maybe I should move them to the main branch.
this work does introduce a lot of changes, it would be messy to merge. I would wait for the finish of the rewrite.
On a second thought, the rewrite still has a lot more work remaining, I should move this part to the main branch first, since it is about correctness in multiple threads situation.
We will not change existing API, instead, we will introduce (start-tx …)
and (end-tx …)
for both KV and Datalog DB.
So people can do whatever they want in between and be considered as part of the same transaction, ensuring correctness.
That’s great