Fix idempotent writes for cases where events have not yet been replicated #1915
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.
The following scenario can occur in a cluster (let's assume a 3 node cluster in this example):
Proposed fix (in commit a0533bc)
CommitDecision.Idempotent
, verify if the event has been committed to the index (which is an indicator of whether the write has been replicated: as from v4.1.0 events are committed to the index on the master only when enough commit acks have been received to prevent dirty reads from the master)CommitDecision.IdempotentNotReady
CommitDecision.IdempotentNotReady
by just dropping the write and wait for the client to try again.Tests
Several tests have also been added around idempotency.