[fix] [broker] When sending a message, broker don't verifies the logic of recordSequenceId > highestSequenceId.#21887
Closed
luky116 wants to merge 1 commit intoapache:masterfrom
Closed
[fix] [broker] When sending a message, broker don't verifies the logic of recordSequenceId > highestSequenceId.#21887luky116 wants to merge 1 commit intoapache:masterfrom
luky116 wants to merge 1 commit intoapache:masterfrom
Conversation
… > highestSequenceId.
|
@luky116 Please add the following content to your PR description and select a checkbox: |
BewareMyPower
requested changes
Jan 17, 2024
|
|
||
| // Persist the message | ||
| if (send.hasHighestSequenceId() && send.getSequenceId() <= send.getHighestSequenceId()) { | ||
| if (send.hasHighestSequenceId()) { |
Contributor
There was a problem hiding this comment.
It does not make sense without adding a test to show which issue it fixes.
IMO, the original code is just defensive programming that handles the exceptional case that sequence_id > highest_sequence_id when the client constructs the CommandSend request. Though with the correct implementation, the client should not set a sequence id that is greater than the highest sequence id.
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 #21886
Main Issue: #21886
PIP:
Motivation
This is a question I had after reading the pulsar source code. I’m not sure if it’s a real problem.
In function org.apache.pulsar.broker.service.ServerCnx#handleSend#line 1838,There is a logic to verify sequenceId, the code is as follows:
Modifications
I find
org.apache.pulsar.broker.service.Producer#publishMessagefunction makes a judgment oflowestSequenceId > highestSequenceId:so
org.apache.pulsar.broker.service.ServerCnx#handleSendfunction can be changed to: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: