[WIP][Client] Return the message ID of the first chunk when sending chunked messages - #12171
Closed
RobertIndie wants to merge 2 commits into
Closed
[WIP][Client] Return the message ID of the first chunk when sending chunked messages#12171RobertIndie wants to merge 2 commits into
RobertIndie wants to merge 2 commits into
Conversation
Signed-off-by: Zike Yang <ar@armail.top>
rdhabalia
reviewed
Sep 28, 2021
| } else if (op.chunkId == op.totalChunks - 1) { | ||
| MessageIdImpl firstChunkMsgId = chunkMessageIds.get(op.msg.getMessageBuilder().getUuid()); | ||
| if (firstChunkMsgId != null) { | ||
| op.setMessageId(firstChunkMsgId.ledgerId, firstChunkMsgId.entryId, firstChunkMsgId.partitionIndex); |
Contributor
There was a problem hiding this comment.
this is the challenge here. last chunk is already published and persist at server side. this is at ackReceived method, means you have received the ack for already published message and updating messageId will not reflect any change to message which is already persist at server side.
Member
Author
There was a problem hiding this comment.
It is correct. But I think we don't need to reflect any change to the message on the server-side.
Member
Author
|
This has been fixed in #12403. |
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
Currently, when we send chunked messages, the producer returns the message-id of the last chunk. This can cause some problems. For example, when we use this message-id to seek, it will cause the consumer to consume from the position of the last chunk, and the consumer will mistakenly think that the previous chunks are lost and choose to skip the current message. If we use the inclusive seek, the consumer may skip the first message, which brings the wrong behavior.
Here is the simple code used to demonstrate the problem.
Modifications
When the producer sends a chunked message, the message-id of the first chunk is stored temporarily in the producer until all chunks have been sent, and then it is returned to the user after all chunks has been sent successfully.
Verifying this change
This PR is still working in progress, still need to add some tests.
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation