This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-29
Channels
- # announcements (4)
- # babashka (38)
- # beginners (66)
- # calva (35)
- # cider (3)
- # clj-on-windows (19)
- # cljs-dev (2)
- # clojure (29)
- # clojure-europe (15)
- # clojure-norway (2)
- # clojurescript (43)
- # clr (7)
- # community-development (6)
- # events (3)
- # hoplon (5)
- # lsp (23)
- # malli (7)
- # matrix (9)
- # nbb (53)
- # off-topic (5)
- # overtone (1)
- # practicalli (2)
- # re-frame (6)
- # reagent (17)
- # reitit (11)
- # specter (5)
- # tools-build (7)
- # xtdb (22)
Quick gut check: I'm migrating from one db to another. Both are jdbc-all-the-things: tx log, document store, etc.
Any reason why a pg_dump/pg_restore of the underlying Postgres db wouldn't do the trick? For one.
For two, separately: any reason I shouldn't do something like query the history of every entity/document in the first db, filtering out duplicates (by :xtdb.api/content-hash
), and transact those (with the original xtdb.api/tx-time
s) into the second db instead? I noticed I have a lot of duplicate documents in the first db is all, because I've been overzealously transacting thus far. But I reckon this migration is an opportunity to drop some dead weight.
That said, the db is still pretty small (`tx_events` has ~60k rows in Postgres) and this is very likely overkill. But fun overkill, so long as it's not really really silly. 😜
Thoughts?
I suppose that if I went with the first option, after the fact I could swing back and evict the duplicates anyhow... if I really wanted to. Hmm.
Does https://docs.xtdb.com/language-reference/datalog-transactions/#evict delete rows in the underlying stores?
I'm definitely bikeshedding or yak shaving or whatever the term is, here. But fun to think about.
> https://github.com/xtdb/xtdb/blob/8079bec1ae3e3d37e436b91e485205f2f2229132/modules/jdbc/src/xtdb/jdbc.clj#L112-L113
tombstones are likely much smaller than whatever maps you put
in originally, but yeah no rows get deleted https://github.com/xtdb/xtdb/blob/8079bec1ae3e3d37e436b91e485205f2f2229132/core/src/xtdb/kv/index_store.clj#L1113-L1114
Does https://docs.xtdb.com/language-reference/datalog-transactions/#evict delete rows in the underlying stores?
Hmm. For some reason I haven't been able to work out, I'm getting an IllegalArgumentExeption
when I try to provide an ::xt/tx-time
to submit-tx
(on a fresh node):
(xt/submit-tx node [[::xt/put doc]] {::xt/tx-time tx-time})
; => Syntax error (IllegalArgumentException) compiling xt/submit-tx at (carnun/com/db/db.clj:120:5).
; No single method: submit_tx of interface: xtdb.api.PXtdbSubmitClient found for function: submit-tx of protocol: PXtdbSubmitClient
; Clojure: class clojure.lang.Compiler$CompilerException
If I omit the map with ::xt/tx-time
, the transaction goes through just fine.
Any ideas?Quite sure I'm good re the second condition here: ⬇️ But maybe the first is violated when there haven't yet been any transactions? :thinking_face:
hey @U018D6NKRA4 was this with new-submit-client
or a regular start-node
node*?*
that's bizarre, I can't repro
(let [n (xt/start-node {})]
(xt/submit-tx n [[::xt/put {:xt/id :foo}]] {::xt/tx-time #inst "1979-01-01"}))
$ java --version
openjdk 17.0.6 2023-01-17
OpenJDK Runtime Environment (build 17.0.6+10)
OpenJDK 64-Bit Server VM (build 17.0.6+10, mixed mode)
{...
:deps
{org.clojure/clojure {:mvn/version "1.11.0-rc1"}
...
;; db
com.xtdb/xtdb-core {:mvn/version "1.20.0"}
com.xtdb/xtdb-jdbc {:mvn/version "1.20.0"}
com.github.seancorfield/next.jdbc {:mvn/version "1.2.772"}
org.postgresql/postgresql {:mvn/version "42.3.3"}
...
}}
as for the former, will have to swing back in a bit to answer! because https://clojurians.slack.com/archives/CG3AM2F7V/p1685394042458079 and I'm now chasing down a separate issue (a memory leak apparently in/involving XT — will post here if so & necessary 🙂 )
I can confirm @U899JBRPF that (xt/submit-tx n [[::xt/put {:xt/id :foo}]] {::xt/tx-time #inst "1979-01-01"})
produces the IllegalArgumentException
on 1.20.0
but not latest, 1.23.2
!
(just returning after a long vacation, apologies for the delay) ah, thanks for confirming that - I can confirm that tx-time import/override has only been available since https://github.com/xtdb/xtdb/releases/tag/1.21.0 😅