This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-08
Channels
- # announcements (14)
- # babashka (12)
- # beginners (140)
- # calva (2)
- # cider (22)
- # clj-commons (14)
- # clj-kondo (49)
- # cljdoc (34)
- # clojure (92)
- # clojure-europe (41)
- # clojure-france (2)
- # clojure-new-zealand (2)
- # clojure-nl (2)
- # clojure-norway (60)
- # clojure-uk (17)
- # clojured (2)
- # clojurescript (7)
- # community-development (3)
- # conjure (2)
- # cryogen (13)
- # cursive (4)
- # data-oriented-programming (2)
- # datahike (5)
- # datomic (12)
- # defnpodcast (10)
- # events (2)
- # fulcro (20)
- # gratitude (3)
- # honeysql (4)
- # introduce-yourself (3)
- # jobs (10)
- # lsp (58)
- # malli (12)
- # missionary (19)
- # off-topic (8)
- # pathom (18)
- # podcasts-discuss (1)
- # polylith (41)
- # releases (1)
- # remote-jobs (3)
- # shadow-cljs (52)
- # spacemacs (1)
- # sql (37)
- # xtdb (19)
What if I want to read multiple entries from the single database snapshot? Can I reuse db
if I'd only be reading?
Even if I would have multiple threads reading from it?
Reuse of a db
snapshot isn't really applicable if you're writing as well - because it's a snapshot, it won't reflect later writes
Not from multiple threads at the same time, no - the queries on any one db
instance should be in serial
If you want to query from multiple threads, it's best to take a db
snapshot per thread
Somebody else may be writing but I want to make a decision as fast as I can. So I thought whether I could take a snapshot once and then parallelize the calculation.
i.e. the write won't come to the paralellized db
instance.
You can request that the snapshots from each thread be at the same 'basis', so that all the threads are seeing a consistent, immutable view of the database
Ah, that could work too.
I'd probably ask for xt/latest-completed-tx
on the node, and then pass that to each thread to use in its db
call
> the queries on any one `db` instance should be in serial
clarification: does that mean you shouldn't use the same db
to do other queries while iterating over the results of open-q
? I have code like that and it seems to work, is there some caveat
> I have code like that and it seems to work, is there some caveat the only caveat I can think of is that completely unrelated queries will be clobbering each others' hot cache entries
thanks, it seemed obvious to use the same db
handle that I opened using open-db
as that docstring states it reserves shared resources to make multiple requests faster... haven't measured if there's an impact wrt hot cache vs opening multiple dbs
@U11SJ6Q0K the db
instance (particularly ones from open-db
) does reuse some state/resources between queries, as you say - so, to be on the safe side, I've usually taken out separate db instances. That said, there's been a lot of refactoring in that area since the last time I seriously analysed the implications, it may well be sufficiently safe now
perhaps there should be scarier warnings in the docstrings, I've had some crashes as I didn't understand the threading implications simply from the fn docs
What happens when I have kafka configured both as transaction log and document store? We have this config from long time ago and I want to know if we need to change it. Is it in-memory or does it request the data from kafka every time? How does it add data to it? Does it submit when I write into the node? Or should we instead push data to kafka ourselves? The doc https://docs.xtdb.com/storage/1.20.0/kafka/ says that it could be due to historical reasons. But what happens if I use it this way?
Created this one instead: https://discuss.xtdb.com/t/old-kafka-config-and-should-i-change-it/74