forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the problem that batchMessageId is converted to messageIdImpl (ap…
…ache#8779) Fixes apache#8712 ### Motivation TopicReaderTest.testHasMessageAvailable is flaky Cause Analysis: When there is only one message in the batch, calling Broker's `GetLastMessageId` will determine that this is not a batch message, and then return a `MessageIdImpl`. (See ServerCnx line 1553) In the same scenario, the client will return a `BatchMessageId` after sending a message. (See ProducerImpl line 1151) This will happen: MessageIdImpl: `3:31:-1` BatchMessageId: `3:31:-1:0` When calling `reader.hasMessageAvailable()`, the two ids will be compared, like this: `lastMessageIdInBroker.compareTo(messageId)` Although it is the same messageId, the results will not be equal. ### Modifications When we call `admin.topics().getLastMessageId`, even if there is only one message in the batch, it is considered to be BatchMessageId. Client also acts like this. Therefore, we keep consistent everywhere. Even if there is only one message in the batch, we think it is `BatchMessageId`
- Loading branch information
Showing
2 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
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
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