Fork me on GitHub

the docs on S3 checkpointer ( seem out of date, can't find modules with those names


Interesting, this looks a mistake in the docs (s/checkpoint/cp), and instead you want :xtdb/module 'xtdb.s3.checkpoint-store/->cp-store , see


Thanks for mentioning it!

Thomas Moerman09:11:47

Hi, I encountered a problem while running with-tx within a transaction function: No implementation of method: :latest-completed-tx of protocol: #'crux.db/IndexStore found for class: crux.kv.index_store.KvIndexStoreTx I'm guessing I hit this known issue: Some context: I'm implementing a tx-fn that "moves forward" the state of a workflow and its related tasks (reified as an aggregate of crux documents) in response to an event. My idea was to write the tx-fn body as a recursive loop, because some events can "spawn" other consecutive events (e.g. auto-completion of Tasks), all of which should be handled atomically. During the recursion, state changes are accumulated in a vector of transactions, which I intended to use as input for computing speculative db instances at certain points in the recursion, and launch datalog queries on these to inspect for certain conditions (e.g. to check whether the recursion is done). Of course a workaround with more "manual" inspections is possible, the speculative db inspections seemed a very elegant approach though. Perhaps I am stretching the intended purpose of transaction functions here? What do you guys think? Any other approach worth considering? Thanks

Thomas Moerman10:11:59

I'm attempting to work around this by not using a transaction function and accumulating the update transactions including tx/match entries to ensure the rug wasn't pulled underneath us while computing the changes. Caveat: thinking aloud here, cfr rubber duckie ;-)


> During the recursion, state changes are accumulated in a vector of transactions I can't quite visualise how the recursion might work...but is there no obvious way to chain the accumulation of the ops but only do the with-tx once (repeatedly)? Can you post an example?

Thomas Moerman17:11:44

The problem I encountered was that computing a speculative db within a transaction function fails, even when with-tx is called only once:

(def workflow-driver
  {:crux.db/id  WORKFLOW-DRIVER-ID
   :crux.db/fn  '(fn [ctx params]
                   (let [db  (crux.api/db ctx)
                         ;; CAUSES EXCEPTION
                         db* (crux.api/with-tx db [[:crux.tx/put {:crux.db/id "123"
                                                                  :bla/msg    "Hello, world"}]])]
                     [[:crux.tx/put {:crux.db/id "456"
                                     :msg        "Hello again"}]]))})
Only tested on this version:
{:mvn/version "21.02-1.15.0-beta"}

Thomas Moerman17:11:10

I worked around the issue by: 1. not using a tx-fn (as it is quite a complicated computation, probably a bit heavy for a tx-fn) 2. doing what you suggest: accumulating the transactions in a collection and computing speculative-db on the "base" db using these. 3. using some match transactions here and there for sanity checks So far it's looking good :thumbsup:

🙂 1

Ah, I see now...yes this is definitely the same fundamental issue as you linked initially. I'm glad you figured out an acceptable workaround(!)


is there something special needed for checkpointing lucene, I got the regular LMDB index checpoints to work with S3, but the lucene doesn't seem to do anything


I configured separate checkpointers for indexes and lucene


never mind, it seems the random time was just different, eventually the lucene checkpoint was uploaded as well


but should you share the same checkpointer for both?


> should you share the same checkpointer for both? we did discuss this internally at the time of adding checkpointing to Lucene, but we decided to keep the modules isolated and didn't want to create a "centralised" checkpoint system


glad you figured it out okay 🙂