-
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][client] Fix reader message filtering issue during blue-green cluster switch #23693
Conversation
...nt/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java
Outdated
Show resolved
Hide resolved
I am curious about how pulsar ensure the two message ids from two clusters corresponding to the same message are equal, or they are just not equal? Not equal may introduce lots of problem. |
@thetumbled Good question. In the blue-green case the message id comparison most likely doesn't apply. The Shadow Topic feature added a field to CommandSend to send the source cluster message id. It would be useful for translations, pulsar/pulsar-common/src/main/proto/PulsarApi.proto Lines 532 to 533 in 9a97c84
|
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #23693 +/- ##
============================================
+ Coverage 73.57% 74.30% +0.73%
+ Complexity 32624 32126 -498
============================================
Files 1877 1838 -39
Lines 139502 143056 +3554
Branches 15299 16232 +933
============================================
+ Hits 102638 106303 +3665
+ Misses 28908 28379 -529
- Partials 7956 8374 +418
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…uster switch (#23693) Co-authored-by: ruihongzhou <[email protected]> (cherry picked from commit 34c2f30)
…uster switch (#23693) Co-authored-by: ruihongzhou <[email protected]> (cherry picked from commit 34c2f30)
Motivation
When the delayed acknowledgment feature is enabled, the method
org.apache.pulsar.client.impl.PersistentAcknowledgmentsGroupingTracker#isDuplicate
filters out messages that have already been acknowledged on the client side.When using the blue-green cluster feature, after switching from the blue cluster to the green cluster, the message IDs generated by the green cluster may be smaller than those from the blue cluster. In this case, if a reader is used for consumption, the method
org.apache.pulsar.client.impl.PersistentAcknowledgmentsGroupingTracker#isDuplicate
will filter out all messages with IDs less than or equal tolastCumulativeAck
, which can result in the loss of messages with IDs less than or equal tolastCumulativeAck
after switching to the green cluster.Modifications
Before switching from the blue cluster to the green cluster, first clear the contents of
org.apache.pulsar.client.impl.AcknowledgmentsGroupingTracker
Verifying this change
Added test in:
org.apache.pulsar.broker.service.ClusterMigrationTest#testMigrationWithReader
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: hrzzzz#11