This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-16
Channels
- # announcements (33)
- # atom-editor (1)
- # aws (21)
- # babashka (174)
- # babashka-sci-dev (2)
- # beginners (59)
- # calva (4)
- # chlorine-clover (9)
- # clj-kondo (51)
- # clojars (7)
- # clojure (86)
- # clojure-czech (4)
- # clojure-europe (21)
- # clojure-france (6)
- # clojure-nl (1)
- # clojure-uk (2)
- # conjure (7)
- # core-async (3)
- # core-logic (3)
- # cursive (10)
- # data-science (8)
- # datalevin (14)
- # datomic (12)
- # events (1)
- # fulcro (5)
- # graalvm (10)
- # gratitude (3)
- # honeysql (3)
- # hyperfiddle (3)
- # introduce-yourself (4)
- # joyride (3)
- # leiningen (3)
- # malli (13)
- # minecraft (15)
- # music (1)
- # off-topic (40)
- # pathom (16)
- # polylith (28)
- # portal (25)
- # rdf (15)
- # remote-jobs (3)
- # shadow-cljs (23)
- # specter (1)
- # sql (5)
- # tools-deps (25)
- # xtdb (31)
Any reason why my xt/await-tx
call would block indefinitely?
com.xtdb/xtdb-core {:mvn/version "1.20.0"}
com.xtdb/xtdb-jdbc {:mvn/version "1.20.0"}
Code:
(defn- user-record [email]
{:xt/id email
:last-signin (java.util.Date.)
:type :user})
,,,
(let [tx (xt/submit-tx node [[::xt/put (user-record email)]])]
(xt/await-tx node tx))
(I checked, and the tx shows up in postgres immediately)Hi, can you try upgrading to 1.21? There were a few jdbc fixes that might unblock this
The upgrade to 1.21
does not solve the problem. It works for a little while, but after a couple of minutes/hours it seems that new transactions aren’t being ingested by my node
(defstate node
:start (xtdb/start-node
{:xtdb.jdbc/connection-pool {:dialect {:xtdb/module 'xtdb.jdbc.psql/->dialect}
:db-spec (:db (config))}
:xtdb/tx-log {:xtdb/module 'xtdb.jdbc/->tx-log
:connection-pool :xtdb.jdbc/connection-pool}
:xtdb/document-store {:xtdb/module 'xtdb.jdbc/->document-store
:connection-pool :xtdb.jdbc/connection-pool}
; :xtdb.http-server/server {:port 5000}
;; :xtdb/index-store {:kv-store {:xtdb/module 'xtdb.rocksdb/->kv-store
;; :db-dir (io/file "/tmp/rocksdb/db")}}
})
:stop (.close @node))
Sorry for the delay - thanks for sharing the extra info, although it's not clear what might be happening still :thinking_face:
My next step would be to reach for a profiler to look for heap memory usage / GC pausing, using https://www.yourkit.com/java/profiler/features/ or similar
How much data are you loading in total? How many transactions? How many operations per transaction on average?
Do you know what is happening with the Postgres instance? Is it reporting that everything is healthy?
Here’s my slow query:
(defn active-deliverables [node]
(->> (xtdb/q
(xtdb/db node) '{:find [d cn (sum du) (pull d [*]) (distinct deps)]
:where [[d :type :deliverable]
[d :project p]
[p :code-name cn]
(not [d :date nil])
(not [d :status _])
(or-join [du d]
(and [tc :type :timecard]
[tc :duration du]
[tc :deliverable d])
(and [tc :type :timecard]
[tc :duration du]
[tc :deliverable d2]
[d2 :parent d])
(and [(identity 0) du]
[d :type :deliverable]))
(or-join [deps d]
(and
[deps :type :deliverable]
[deps :parent d])
(and [(identity nil) deps]
[d :type :deliverable]))]})
(map (fn [[_ code-name ssf attr deps]] (merge attr
{:code-name code-name
:spent-so-far ssf
:dependencies deps})))))
It pulls in the effort spent on a task (deliverable), which parent tasks it has and the project codename the task belongs to.
Example records from the schema are::
{:type :project :codename x :status "active"}
{:xt/id #uuid "..." :type :deliverable :project p :status "completed" :parent d2}
{:type :timecard :duration du :deliverable d}
There are Is this still up to date? https://clojurians-log.clojureverse.org/xtdb/2021-06-10
did you try (xtdb.query/query-plan-for db ...query...)
if it gives anything interesting
> Is there any documentation anywhere on how to improve the performance of queries?
There's no central resource, but there have been a lot of discussions and issues that might hold clues. Looking at query-plan-for
and the vars-in-join-order
in particular is the best first step
You could try instead:
;; (not [d :date nil])
[d :date date]
[(some? date)]
And for
(not [d :status _])
...you could store explicit nil
values also, if that is acceptable for your data model(?)Hello, does XTDB provide a mechanism to 'populate' a fresh new kafka topic (using kafka Document store) from a Checkpoint or local rockdb instance? Tx-log also managed by Kafka.
Hi @U026YA2AQSX we use the term 'migrating' to describe this. Given the large number of possible migration paths, we haven't yet built a generic tool for this, however you can attempt to use / draw inspiration from the last two commits here: https://github.com/xtdb/xtdb/tree/crux-migration-hack
If this is something urgent you need help with though, please feel free to DM me and I'm sure we can help
Thanks Jeremy! I'll take look and try to to make some POC with. For the moment it's not really critical, were are spending some times to have a strategy in case of kafka failure since database is constantly growing :thumbsup::skin-tone-3: