This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-07
Channels
- # announcements (20)
- # babashka (25)
- # beginners (48)
- # biff (26)
- # calva (5)
- # cider (3)
- # clara (7)
- # clerk (7)
- # clj-kondo (61)
- # cljdoc (3)
- # clojure (6)
- # clojure-austin (1)
- # clojure-conj (8)
- # clojure-europe (58)
- # clojure-nl (1)
- # clojure-norway (4)
- # clojure-poland (1)
- # clojure-uk (9)
- # cursive (2)
- # emacs (11)
- # fulcro (8)
- # graphql (14)
- # gratitude (6)
- # humbleui (10)
- # hyperfiddle (17)
- # integrant (15)
- # introduce-yourself (1)
- # leiningen (5)
- # malli (13)
- # meander (21)
- # nbb (11)
- # off-topic (15)
- # pedestal (15)
- # polylith (15)
- # quil (28)
- # rdf (2)
- # reitit (3)
- # releases (6)
- # sci (21)
- # shadow-cljs (38)
- # spacemacs (3)
- # xtdb (6)
The documentation on sync
has mentions a deprecated arity of db
(and by extension open-db
)
https://docs.xtdb.com/clients/clojure/#_sync
>
The
> returned date is the latest transaction time indexed by this node. This can be
> used as the second parameter in (db valid-time, transaction-time) for
> consistent reads.
> Hey @U01EFUL1A8M good spot - thanks for mentioning it. Now resolved by https://github.com/xtdb/xtdb/commit/e0ea5b31472ad709470cbfcc2814f9aeb0f41cca
if I can piggyback on this:
The reason I looked at sync was because I wondered about this: If I pass a node to multiple route handlers that may run concurrently, do they need to call sync
first before calling db
and using the return value as the basis? I assume yes. Or is this only necessary in specific contexts?
Calling sync
first will definitely help to reduce the window for inconsistent reads across concurrent readers, but if you have a sufficiently high throughput of writes then it still may not give the consistency properties you're after. Do the concurrent readers communicate out of band? Is your app processing transactions off the back of the reads?
In the extreme case you may want to use a transaction function to maximise consistency (such that everything happens serially)
Ah OK. No I'm only generally worried about getting an exception thrown in my face when I want to read from the db, while someone else writes. I don't mind waiting for indexing to finish. Plus the writes are always right in for the general case. Thank you for pointing out the right questions to ask though!