Wait for bookmark when starting a transaction #303
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is possible to specify bookmark when starting a transaction. First
BEGIN
statement would then contain the given bookmark in params. Database will wait when processing suchBEGIN
for the state described by the bookmark to appear.Sending
BEGIN
and bookmark was previously lazy. So it was possible to start a transaction with an invalid/unreachable bookmark. Error would in such case pop up only after the next sync (commit or consume) which is too late and can be quite confusing.This PR makes transaction eagerly send
BEGIN
andPULL_ALL
messages when non-null bookmark is given. It makessession#beginTransaction("bookmark")
call blocking but the API less surprising.