-
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] Fix reader stuck when read from compacted topic with read compact mode disable #21969
[fix] [broker] Fix reader stuck when read from compacted topic with read compact mode disable #21969
Conversation
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.
Nice catch!
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Show resolved
Hide resolved
/pulsarbot rerun-failure-checks |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #21969 +/- ##
============================================
- Coverage 73.61% 73.58% -0.03%
- Complexity 32424 32453 +29
============================================
Files 1861 1863 +2
Lines 138678 138780 +102
Branches 15184 15207 +23
============================================
+ Hits 102089 102123 +34
- Misses 28690 28756 +66
- Partials 7899 7901 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…ead compact mode disable (#21969)
…ead compact mode disable (#21969)
@thetumbled can you help to cherry-pick this PR to branch-3.0? I see conflicts. |
We have better wait #22130 to be merged, or two pr will conflict. I will help to cherry pick this pr. |
…ead compact mode disable (apache#21969) (cherry picked from commit 313eae5)
cherry pick in this pr: #22199 |
…ead compact mode disable (apache#21969) (cherry picked from commit 313eae5)
…ead compact mode disable (apache#21969) (cherry picked from commit 09559c5) Signed-off-by: Zixuan Liu <nodeces@gmail.com>
Motivation
reader.hasMessageAvailable()
rely ongetLastMessageId
to determine whether there are any messages available to read.org.apache.pulsar.broker.service.ServerCnx#handleGetLastMessageId
will read the last message from compacted topic in some cases without check if the consumer is in read compact mode.If the consumer/reader disable the read compact mode, and the cluster enable the compaction feature, messages will be compacted into the compacted topic, but the dispactcher will not dispatch messages from compacted topic to consumer. If the messages in the original topic is expired and the consumer has nothing to be read, while the messages in the compacted topic retain alive.
reader.hasMessageAvailable()
will return true as there are messages in the compacted topic, but consumer/reader will not get any messages because there are nothing in the original topic.Modifications
reader.hasMessageAvailable()
should check if the consumer is in read compact mode to determine whether get the last message id 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.
This change added tests and can be verified as follows:
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: thetumbled#38