[fix][broker] Avoid consumers receiving acknowledged messages from compacted topic after reconnection#21187
Merged
codelipenghui merged 15 commits intoapache:masterfrom Jan 26, 2024
Merged
Conversation
965b4a7 to
31f3317
Compare
31f3317 to
9335ac7
Compare
pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java
Show resolved
Hide resolved
...va/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java
Outdated
Show resolved
Hide resolved
poorbarcode
reviewed
Sep 27, 2023
...va/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java
Outdated
Show resolved
Hide resolved
poorbarcode
previously approved these changes
Sep 27, 2023
|
The pr had no activity for 30 days, mark with Stale label. |
df1ed56 to
753722b
Compare
0624b09 to
a9dcdfc
Compare
f09bc9a to
ee9dd6c
Compare
9f80e7c to
bad719f
Compare
codelipenghui
approved these changes
Jan 26, 2024
Technoboy-
pushed a commit
that referenced
this pull request
Jan 27, 2024
…mpacted topic after reconnection (#21187)
Technoboy-
pushed a commit
that referenced
this pull request
Jan 31, 2024
…mpacted topic after reconnection (#21187)
Contributor
|
@coderzc could you help to cherry-pick this to branch-3.0? I see conflict. |
coderzc
added a commit
to coderzc/pulsar
that referenced
this pull request
Feb 28, 2024
…ages from compacted topic after reconnection (apache#21187)
4 tasks
mukesh-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Mar 1, 2024
…mpacted topic after reconnection (apache#21187) (cherry picked from commit 24d8d9a)
mukesh-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Mar 6, 2024
…mpacted topic after reconnection (apache#21187) (cherry picked from commit 24d8d9a)
4 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #21074
Motivation
In #11287, we use MessageId.earliest instead of the earliest available message to read on the topic when we first read after reconnection, this will lead to consumers receiving acknowledged messages from the compacted topic after reconnection, so I think for a durable cursor (exclude __compaction cursor), we should read messages from the mark-delete position.
Modifications
__compactioncursor) has the mark-delete position, don't read messages from the earliest.rewind(boolean readCompacted)method in ManagedCursor and just rewind to the next message of the mark delete position instead of resetting the read position to the next valid position of the original topic.subscriptionInitialPosition=Latestwork normally since the mark-delete doesn't is invalid position (entryID==-1L).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:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: