I submitted a PR to demonstrate the solution:https://github.com/apache/pulsar/pull/12171 <https://github.com/apache/pulsar/pull/12171>. If you have any suggestions, please feel free to comment on it.
Thanks, Zike Yang On 2021/09/22 03:55:44 Zike Yang wrote: > Hi Pulsar Community, > > > 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 > > ``` > > > To fix this, I think we could return the message ID of the first chunk when > sending chunked messages. I would like to know if this solution will bring > other problems. Any ideas on this? > > > Thanks > -- > Zike Yang >