[fix] [tx] [branch-2.9] Transaction buffer recover blocked by readNext #18970
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.
Motivation
Since PR #18833 can not cherry-pick to
branch-2.9
, create a separate PR.Context for Transaction Buffer
transactionCoordinatorEnabled
, thenTransactionBuffer
will be initialized when a user topic create.TransactionBuffer
reads the aborted logs of transactions from topic__transaction_buffer_snapshot
-- this process is calledrecovery
.Reader
; the reader works like this:Context for Compaction
Issue
There is a race condition: after executing
reader.hasMessageAvailable
, the following messages have been deleted by compaction-task, so read next will be blocked because there have no messages to read.Modifications
Why not just let the client try to load the topic again to retry the recover?
If the topic load is failed, the client will receive an error response. This is a behavior that we can handle, so should not be perceived by the users.
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: