-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker]Transactional messages can never be sent successfully if concurrently taking transaction buffer snapshot #24945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…currently executed transaction buffer snaoshot
Member
|
Checkstyle errors: Please run |
lhotari
reviewed
Nov 4, 2025
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
Member
|
test failures |
lhotari
reviewed
Nov 6, 2025
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Show resolved
Hide resolved
lhotari
reviewed
Nov 6, 2025
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
lhotari
reviewed
Nov 6, 2025
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
lhotari
reviewed
Nov 6, 2025
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
lhotari
reviewed
Nov 6, 2025
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
lhotari
reviewed
Nov 6, 2025
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #24945 +/- ##
=============================================
+ Coverage 38.56% 74.38% +35.82%
- Complexity 13262 33673 +20411
=============================================
Files 1856 1920 +64
Lines 145287 150138 +4851
Branches 16877 17414 +537
=============================================
+ Hits 56025 111687 +55662
+ Misses 81696 29570 -52126
- Partials 7566 8881 +1315
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
lhotari
reviewed
Nov 7, 2025
...ain/java/org/apache/pulsar/broker/transaction/buffer/impl/PendingAppendingTxnBufferTask.java
Outdated
Show resolved
Hide resolved
Technoboy-
reviewed
Nov 7, 2025
...c/test/java/org/apache/pulsar/broker/transaction/buffer/utils/TransactionBufferTestImpl.java
Outdated
Show resolved
Hide resolved
Technoboy-
reviewed
Nov 7, 2025
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Show resolved
Hide resolved
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Show resolved
Hide resolved
BewareMyPower
approved these changes
Nov 10, 2025
Contributor
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
Technoboy-
approved these changes
Nov 11, 2025
manas-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Nov 13, 2025
… concurrently taking transaction buffer snapshot (apache#24945) (cherry picked from commit f29ca21) (cherry picked from commit 85e8b5d)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Nov 14, 2025
… concurrently taking transaction buffer snapshot (apache#24945) (cherry picked from commit f29ca21) (cherry picked from commit 85e8b5d)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-4.0
cherry-picked/branch-4.1
doc-not-needed
Your PR changes do not impact docs
ready-to-test
release/4.0.8
release/4.1.2
type/bug
The PR fixed a bug or issue reported a bug
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
Issue 1: concurrently initialising transaction buffer snapshot
Before #21406, the snapshot would be taken when the persistent topic is initialising, so no concurrency. After #21406, the transaction buffer snapshot is triggered by publishing messages, so concurrency occurs. #21406 forgot to handle this case, which caused the following errors
Issue 2: publishing messages before the transaction buffer is recovered.
Before #21406: a wrong variable was used when reconstructing the class, the correct variable should be
snapshotAbortedTxnProcessor, but it usedpublishFuture. See follows:This issue makes transaction buffer recovery and taking a transaction snapshot execute concurrently.
performance issue 3: the second write request can only be executed after the first response client
There is a variable named
publishFuture, the following publishing can only be executed after the previous one is done.https://github.com/apache/pulsar/pull/21406/files#diff-ecd728301a585f256e8a649b5e65b28c166194477355b3a1eefc198d014c25d3R255-R288
Modifications
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: x