-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[fix][broker] Fix issue with consumer read uncommitted messages from compacted topic #21465
[fix][broker] Fix issue with consumer read uncommitted messages from compacted topic #21465
Conversation
Transaction txn = pulsarClient.newTransaction() | ||
.withTransactionTimeout(1, TimeUnit.MINUTES).build().get(); | ||
producer.newMessage(txn).key("K2").value("V2").send(); | ||
producer.newMessage(txn).key("K3").value("V3").send(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we send some messages with the same key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be necessary, we just need to enable readCompacted
for consumers then consumers will read messages from the compacted topic although the compaction task may not have run yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
@coderzc I think this PR should not be cherry-picked to release branches because the API of |
Oh, we can cherry-pick it to release branches through add new asyncReadCompactedEntries. |
…compacted topic (apache#21465) (cherry picked from commit b5925ed)
…compacted topic (apache#21465) (cherry picked from commit b5925ed)
…compacted topic (apache#21465) (cherry picked from commit b5925ed)
Cherry-picked by #21570 |
…es from compacted topic (apache#21465)" This reverts commit 80f921a.
…ssages from compacted topic (apache#21465) (apache#21571)
…es from compacted topic (apache#21465)" This reverts commit 80f921a.
…ssages from compacted topic (apache#21465) (apache#21571)
…es from compacted topic (apache#21465)" This reverts commit 80f921a. (cherry picked from commit c616deb)
…ssages from compacted topic (apache#21465) (apache#21571) (cherry picked from commit a303bd1)
…es from compacted topic (apache#21465)" This reverts commit 80f921a. (cherry picked from commit c616deb)
…ssages from compacted topic (apache#21465) (apache#21571) (cherry picked from commit a303bd1)
Fixes #21464
Motivation
The consumer shouldn't read ongoing messages from compacted topic.
Modifications
Pass
topic.getMaxReadPosition()
to cursor when reading messages from the compacted topic.Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: