This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-09
Channels
- # announcements (9)
- # beginners (69)
- # cider (4)
- # clj-kondo (8)
- # cljdoc (1)
- # clojure (52)
- # clojure-austin (4)
- # clojure-europe (22)
- # clojure-nl (2)
- # clojure-norway (14)
- # clojure-uk (3)
- # clojurescript (9)
- # conjure (4)
- # cursive (3)
- # datalevin (13)
- # datomic (4)
- # events (2)
- # fulcro (59)
- # graalvm (17)
- # helix (25)
- # inf-clojure (4)
- # integrant (4)
- # introduce-yourself (2)
- # java (5)
- # kaocha (1)
- # leiningen (3)
- # meander (7)
- # nbb (4)
- # off-topic (30)
- # portal (4)
- # rdf (1)
- # reagent (5)
- # sci (1)
- # shadow-cljs (57)
- # sql (8)
- # tools-deps (39)
- # uncomplicate (3)
- # vim (3)
- # xtdb (8)
Hi, is it safe to use datalevin in a multithreaded environment naively (sharing the same connection between threads, calling dc/transact! and dc/query directly) or do we have to take any extra steps to make it safe (with explicit mutexes, etc)?
With the latest version 0.7.10, yes. dc/transact!
now is wrapped in a with-transaction
macro, so it is ensured that all reads/writes inside are using the same single read/write transaction, which is guarded by a lock.
thanks for the quick reply. I have just started playing with with-transaction but I ran into some concurrency problems (one of them broke the db file too). Am I missing anything obvious? Details: https://stackoverflow.com/questions/75062000/datalevin-concurrency-transactions
last version was still 0.7.8 about half an hour ago when I wrote the question on stackoverflow ๐
the latest is 0.7.10 (which is in the process of releasing), but the code is the same with 0.7.9, so you can try 0.7.9
Interestingly, using a single thread writes faster too, as we are not dealing with thread contention.