[fix] [broker] Fix reader stuck when read from compacted topic with read compact mode disable#21969
Merged
Technoboy- merged 3 commits intoapache:masterfrom Jan 30, 2024
Merged
Conversation
coderzc
approved these changes
Jan 26, 2024
poorbarcode
approved these changes
Jan 29, 2024
Member
Author
|
/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.
|
Technoboy-
approved these changes
Jan 30, 2024
Technoboy-
pushed a commit
that referenced
this pull request
Jan 31, 2024
…ead compact mode disable (#21969)
15 tasks
Technoboy-
pushed a commit
that referenced
this pull request
Feb 20, 2024
…ead compact mode disable (#21969)
Contributor
|
@thetumbled can you help to cherry-pick this PR to branch-3.0? I see conflicts. |
Member
Author
We have better wait #22130 to be merged, or two pr will conflict. I will help to cherry pick this pr. |
mukesh-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Mar 1, 2024
…ead compact mode disable (apache#21969) (cherry picked from commit 313eae5)
Member
Author
cherry pick in this pr: #22199 |
mukesh-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Mar 6, 2024
…ead compact mode disable (apache#21969) (cherry picked from commit 313eae5)
nodece
pushed a commit
to nodece/pulsar
that referenced
this pull request
Dec 27, 2024
…ead compact mode disable (apache#21969) (cherry picked from commit 09559c5) Signed-off-by: Zixuan Liu <nodeces@gmail.com>
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.
Motivation
reader.hasMessageAvailable()rely ongetLastMessageIdto determine whether there are any messages available to read.org.apache.pulsar.broker.service.ServerCnx#handleGetLastMessageIdwill 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
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: thetumbled#38