Fork me on GitHub
#xtdb
<
2021-05-25
>
nivekuil10:05:32

I'm kind of surprised that (crux/await-tx node "some garbage") doesn't throw and spits out what appears to be the latest indexed tx. Is this semantically the same as crux/last-submitted-tx? (crux/await-tx node nil) seems to run a lot faster, 4us vs 67us

👀 3
refset11:05:13

It seems to be due to a lack of validation for the type of that second parameter, where Crux is expecting a map. When you pass in a string it doesn't throw, because get seems to be happy accepting a string (get "asdf" :a) => nil and the nil is comparable See the definition of tx-v: https://github.com/juxt/crux/blob/6df9f72fcba23d2fa966d67a5105c63496c0d492/crux-core/src/crux/node.clj#L36-L40 I think this should be semantically the same as crux/latest-completed-tx though and I wouldn't expect there to be any performance difference there. By contrast crux/latest-submitted-tx calls through to the tx-log, which is typically a more expensive operation In any case, I've made a note on the project board that we could potentially benefit from the extra validation, thanks for reporting it 🙂

nivekuil11:05:37

ah yes, typed completed here and submitted into the repl.. tired brain. thanks for looking into it

🧠 3
refset12:05:26

np, tired brains need to support each other! 😄