-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[fix][broker] Avoid consumers receiving acknowledged messages from compacted topic after reconnection #21187
Merged
+229
−15
Conversation
This file contains 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
coderzc
force-pushed
the
fix_compaction_ack
branch
from
September 15, 2023 03:09
965b4a7
to
31f3317
Compare
coderzc
changed the title
[fix][broker] Avoid consumers receiving acknowledged messages from a compacted topic upon reconnection
[fix][broker] Avoid consumers receiving acknowledged messages from compacted topic after reconnection
Sep 15, 2023
coderzc
force-pushed
the
fix_compaction_ack
branch
from
September 21, 2023 13:46
31f3317
to
9335ac7
Compare
codelipenghui
added
the
category/reliability
The function does not work properly in certain specific environments or failures. e.g. data lost
label
Sep 22, 2023
codelipenghui
requested review from
Technoboy-,
BewareMyPower and
poorbarcode
September 27, 2023 03:27
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. |
coderzc
force-pushed
the
fix_compaction_ack
branch
from
January 16, 2024 04:02
df1ed56
to
753722b
Compare
coderzc
force-pushed
the
fix_compaction_ack
branch
2 times, most recently
from
January 16, 2024 05:58
0624b09
to
a9dcdfc
Compare
coderzc
force-pushed
the
fix_compaction_ack
branch
2 times, most recently
from
January 16, 2024 06:17
f09bc9a
to
ee9dd6c
Compare
coderzc
force-pushed
the
fix_compaction_ack
branch
from
January 26, 2024 04:54
9f80e7c
to
bad719f
Compare
codelipenghui
approved these changes
Jan 26, 2024
codelipenghui
added
release/2.10.6
release/3.0.3
release/2.11.4
release/3.1.3
release/3.2.1
and removed
Stale
labels
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)
@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)
lhotari
added
release/2.10.7
release/2.11.5
and removed
release/2.10.6
release/2.11.4
labels
Mar 5, 2024
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/broker
area/compaction
category/reliability
The function does not work properly in certain specific environments or failures. e.g. data lost
cherry-picked/branch-3.0
cherry-picked/branch-3.1
doc-not-needed
Your PR changes do not impact docs
ready-to-test
release/2.10.7
release/2.11.5
release/3.0.3
release/3.1.3
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.
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
__compaction
cursor) 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=Latest
work 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
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: