Fork me on GitHub
#xtdb
<
2023-01-25
>
jussi11:01:22

Hey, run into funny sync related issue. Local indices rocksdb, db is a remote PostgreSQL. My xt node

{:xtdb.version/version "1.20.0",
 :xtdb.version/revision "421db6dfe3bbcc57dac2db8eeafb9ece2a4703d5",
 :xtdb.index/index-version 18,
 :xtdb.tx-log/consumer-state nil,
 :xtdb.kv/kv-store "xtdb.rocksdb.RocksKv",
 :xtdb.kv/estimate-num-keys 4598991,
 :xtdb.kv/size 168408771}
Where as the remote db is already been used with 1.23.0 version. So, I tried to sync my local indices and got the following error after a minute or two (our db is large)
Execution error (IllegalArgumentException) at xtdb.tx.conform/conformed-tx-events->doc-hashes (conform.clj:216).
No method in multimethod '<-tx-event' for dispatch value: :xtdb.tx.event/tx-events
Any ideas what could be the reason? Colleague with a newer xt node version (1.23.0) also has much larger estimate with the same remote db instance. I'm going to update my node version soonish and expect this to disappear, but this raises some concerns for future version bumps/migrations.

jussi14:01:42

After updating xtdb version, I got a more meaningful error message with the old index.

; Execution error (IndexVersionOutOfSyncException) at xtdb.kv.index-store/check-and-store-index-version (index_store.clj:357).
; Index version on disk: 18 does not match index version of code: 22

jussi14:01:06

Thinking now that if we are updating multiple nodes with old indices and we upgrade xtdb version, we might run into a situation where different versions try to access db with different index versions.

jarohen17:01:57

hey @U0267SNCPEY πŸ‘‹ nodes < 1.21.0 https://github.com/xtdb/xtdb/issues/1888 to read transaction logs with transactions submitted after 1.21.0 due to the new ability for the user to explicitly specify the tx-time of a transaction (for bulk import purposes) - we're investigating what's involved in a fix, but in the meantime I'd recommend upgrading the nodes (as you have)

jussi17:01:34

Ah, ok! Thx!

jussi17:01:09

So I could assume that after this update we shouldn't run into similar incompatibilities or they would labeled as breaking changes?

jarohen17:01:03

> After updating xtdb version, I got a more meaningful error message with the old index This is an 'index version bump' - we put these through every now and again when we want to upgrade the index structure - most recently a handful of indexing performance improvements. In this case, you'll want to let a new version of XT re-index from the tx-log in the background, and create a checkpoint that other nodes can then use

blob_thumbs_up 2
jarohen17:01:04

> Thinking now that if we are updating multiple nodes with old indices and we upgrade xtdb version, we might run into a situation where different versions try to access db with different index versions. each node has its own index, so you shouldn't ever get a case where a node reads an incompatible index version - that's what the 'index version' check prevents

βœ… 2
jarohen17:01:32

> So I could assume that after this update we shouldn't run into similar incompatibilities or they would labeled as breaking changes? yep, absolutely. tbh this is the only tx-log format change we've put in in my ~3 years in XTDB - it's not something we do on a regular basis, for this very reason πŸ™‚

jussi17:01:07

> each node has its own index, so you shouldn't ever get a case where a node reads an incompatible index version - that's what the 'index version' check prevents So, it seems that my case simply reduces to a case where I couldn't sync my local indices as my local index had too old version and the remote db had been updated with newer XTDB version πŸ™‚

πŸ‘ 2
jarohen17:01:40

fwiw we're looking into the possibility of a non-breaking patch release in the 1.20.x line that users could upgrade to that then would be able to handle >=1.21.0 transactions if that would be useful

blob_thumbs_up 2
Hukka07:01:31

It would allow first upgrading all nodes to 1.20.X to be able to read the logs, and then to 1.21.0 so that at no point there would be nodes writing transactions while nodes that cannot read them are still online

Hukka07:01:10

But in our case, that's no longer… needed

Hukka07:01:08

More the reason to have a staging environment that's identical to the real one, including having multiple nodes

Hukka07:01:02

Though I suppose it's a bit tricky to catch even then. You'd need the new nodes to insert new transactions in the middle of the upgrade. Or even exactly the right kind of transactions?

Thomas Moerman13:01:41

Is it possible to both update an entity and delete an entity in the same transaction? so that the updated entity is available in the entity-history?

Thomas Moerman13:01:06

First attempt suggests no

jarohen16:01:56

you can if they have different valid time ranges - but if they have both the same valid-time range and tx-time they'll cancel each other out

jarohen16:01:54

but yeah, more generally you can't have a zero-width valid-time range in XTDB - it's inclusive-start exclusive-end

Thomas Moerman16:01:53

ah thanks for the insight

πŸ™ 2
βž• 2
Thomas Moerman18:01:07

made it work! partyparrot

πŸ‘ 2
Thomas Moerman18:01:39

[#:xtdb.api{:content-hash #xtdb/id "0000000000000000000000000000000000000000"
            :doc          nil
            :tx-id        2
            :tx-time      #inst "2023-01-25T18:06:23.447-00:00"
            :valid-time   #inst "2023-01-25T18:06:23.448-00:00"}
 #:xtdb.api{:content-hash #xtdb/id "c628864629963b3311fadad544d1d1071a5edc05"
            :doc          {:widget/created-at #inst "2023-01-25T18:06:23.418-00:00"
                           :widget/created-by #:nexus.user{:id #uuid "00000000-0000-0000-0000-000000000001"}
                           :widget/deleted-at #inst "2023-01-25T18:06:23.447-00:00"
                           :widget/deleted-by #:nexus.user{:id #uuid "00000000-0000-0000-0000-000000000001"}
                           :widget/id         #uuid "0185ea1c-06ba-bd41-af80-b84d143e1257"
                           :widget/label      "Label 3"
                           :xt/id                   #:widget{:id #uuid "0185ea1c-06ba-bd41-af80-b84d143e1257"}}
            :tx-id        2
            :tx-time      #inst "2023-01-25T18:06:23.447-00:00"
            :valid-time   #inst "2023-01-25T18:06:23.447-00:00"}
 #:xtdb.api{:content-hash #xtdb/id "a25ca7c8f2a07af6aaf18019d7312833f9feb453"
            :doc          {:widget/created-at #inst "2023-01-25T18:06:23.418-00:00"
                           :widget/created-by #:nexus.user{:id #uuid "00000000-0000-0000-0000-000000000001"}
                           :widget/id         #uuid "0185ea1c-06ba-bd41-af80-b84d143e1257"
                           :widget/label      "Label 3"
                           :xt/id                   #:widget{:id #uuid "0185ea1c-06ba-bd41-af80-b84d143e1257"}}
            :tx-id        1
            :tx-time      #inst "2023-01-25T18:06:23.418-00:00"
            :valid-time   #inst "2023-01-25T18:06:23.418-00:00"}]

prasad sanampudi16:01:26

sorry if this question is naive, but, does xtdb fit the definition of 'time series graph database' ? My understanding of 'TS Graph D' is one where I can do typical graph analysis and typical timeseries functions [aggregations, data summarisations over time] out of one engine/schema. I just wanted to get the terminology right. thank you

jarohen17:01:52

hey @U04HFRYJTNW πŸ‘‹ we don't tend to describe ourselves as a time-series database - this tends to bring a few expectations that we don't aim to cover, e.g. windowing, retention etc. graph: more so - we're a document database which you can query using a graph-like query language, interpreting the values in the documents as potential edges.

jarohen17:01:54

it's not a true 'property graph' model - i.e. modelled as distinct vertices and edges - if, for example, you want to add properties to your edges, we recommend that you make another document for the edge with additional attributes, referencing the vertex documents - but we think it covers enough of the benefits with a simpler model πŸ™‚

prasad sanampudi17:01:32

thank you @U050V1N74

πŸ™ 2
βž• 2
refset20:01:10

I saw this comparison a few months back that might add some clarity on the 'time series' aspect https://www.pgcon.org/2019/schedule/track/Applications/1336.en.html

Hukka08:01:07

Though my experience is pretty limited, I'd say that time-series is more about stocks, or even only about HFT than finance, while temporal is applicable more generally in finance, exactly due to audits and historic views. But I digress.

βœ”οΈ 2