Returning mutation tokens from query update

I have an update that is performed within a transaction.
Some kv mutations are performed first and then a query to update a potentially large number of documents (90% of the time it will be less than 70, and up to ~1000 at a lesser frequency).

I have some business logic executed immediately after, that requires the indexes to be up to date. So I could use RequestPlus, and it’s probably a good idea if more then a few dozen of documents have been mutated because passing hundreds of tokens comes at a cost, I assume, but when only a handful of documents have been mutated, I would like to pass those tokens instead of waiting for the index to have processed all mutations at the time of the query.

Is it possible to do that ?

The consistentWith() option takes a MutationState which is the list of tokens.

But it sounds like you are already aware of that?

passing hundreds of tokens comes at a cost

So maybe I don’t understand the question.

How do I get those mutation tokens from the UPDATE query ?

It sounds like the are only available from the kv api. Which is a bummer.

“You can also use consistent_with=MutationState for a more narrowed-down scan consistency. Construct the MutationState from individual MutationTokens that are returned from KV MutationResults to make sure at least those mutations are visible. Depending on the index update rate this might provide a speedier response.”

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.