GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [WIP][Client] Return the message ID of the first chunk when sending chunked messages by RobertIndie · Pull Request #12171 · apache/pulsar

Conversation

@RobertIndie

@RobertIndie RobertIndie commented Sep 24, 2021

Copy link
Copy Markdown
Member

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.

var msgId = producer.send(...); // eg. return 0:1:-1

var otherMsg = producer.send(...); // return 0:2:-1

consumer.seek(msgId); // inclusive seek

var receiveMsgId = consumer.receive().getMessageId(); // it may skip the
first message and return like 0:2:-1

Assert.assertEquals(msgId, receiveMsgId); // fail

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 yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (yes) It affects the behavior of sending chunked messages.
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

  • no-need-doc

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
RobertIndie and others added 2 commits September 22, 2021 16:44
@RobertIndie
Return the message-id of the last chunk when sending chunked messages.
b97a25b
@RobertIndie
Use ConcurrentOpenHashMap.
a87fb8f
Signed-off-by: Zike Yang <[email protected]>
@Anonymitaet Anonymitaet added the doc-not-needed Your PR changes do not impact docs label Sep 26, 2021
rdhabalia
rdhabalia reviewed Sep 28, 2021
View reviewed changes
Comment thread pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
} 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);

@rdhabalia rdhabalia Sep 28, 2021

Copy link
Copy Markdown
Contributor

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.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@RobertIndie RobertIndie Sep 28, 2021

Copy link
Copy Markdown
Member Author

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.

It is correct. But I think we don't need to reflect any change to the message on the server-side.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@RobertIndie RobertIndie mentioned this pull request Oct 18, 2021
PIP 107: Introduce the chunk message ID #12402
Closed
@sijie sijie mentioned this pull request Oct 18, 2021
ISSUE-12402: PIP 107: Introduce the chunk message ID streamnative/pulsar-archived#3161
Open
@RobertIndie

RobertIndie commented Dec 29, 2021

Copy link
Copy Markdown
Member Author

This has been fixed in #12403.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@RobertIndie RobertIndie closed this Dec 29, 2021
@A-Wanderer A-Wanderer mentioned this pull request Mar 9, 2022
[C++] add chunk message id #14604
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rdhabalia rdhabalia rdhabalia left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

doc-not-needed Your PR changes do not impact docs

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@RobertIndie @rdhabalia @Anonymitaet
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.