Clarification about ::xt/match

Hello!

In the transaction documentation:

If the transaction contains pre-conditions, all pre-conditions must pass.
This processing happens at each node during indexing.

Does ::xt/match is a pre-condition ?

Also I’m not sure what a “committed transaction” means. Is it synonym of the transaction have been indexed ? If the ::xt/match is ok, some nodes may return true, other false to the (tx-committed?) (depending on how they managed to sync with transaction log ?).

Also, when submitting a transaction which contains ::xt/match and a ::xt/put, there will always be a pending entry submitted to the document log, even if the ::xt/match fails ?

Hey @jprudent - welcome!

Does ::xt/match is a pre-condition ?

Yep that’s right. The other kind of pre-condition is a transaction function that (ultimately) returns anything other than a vector of primitive put/delete/evict operations.

Also I’m not sure what a “committed transaction” means. Is it synonym of the transaction have been indexed ?

Yep, that’s right also :slight_smile:

If the ::xt/match is ok, some nodes may return true, other false

That would most definitely be a bug, so should never happen. XTDB is based on deterministic processing and having all nodes arriving at the same state.

Also, when submitting a transaction which contains ::xt/match and a ::xt/put , there will always be a pending entry submitted to the document log, even if the ::xt/match fails ?

Correct again! The tx-log only contains hashes though, and space usage shouldn’t be problematic. Any unused documents (from failed transactions) in the document store (/‘document log’ …in the case of Kafka) can still be evicted using additional transactions though, which means the entries in the document store (/log) will get replaced with tombstones. To be clear: this replacing of unused documents (from failed transactions) with tombstones does not happen by default, and therefore depending on your requirements for handling regulated data you may need to think more carefully about how and when to initiate such background processing to clear up after failed transactions.

1 Like

Hello @refset

Thanks for your warm welcoming and for your answers, everything is clear now :blush:

1 Like