315157973 edited a comment on pull request #10190: URL: https://github.com/apache/pulsar/pull/10190#issuecomment-823770109
Record the process: 1) I modified the proto so that the subscription supports the inclusive option. I found that `hasMessageAvailableAsync` and `messageProcessed` are not in the same thread, which has thread safety issues with seek. Time line: ``` messageProcessed 1131:0:0:4 topic 0 (lastDequeuedMessageId become 1131:0:0:4) Successfully getLastMessageId 1131:0 Seek subscription to the message 1131:0:0:4 (lastDequeuedMessageId become -1:-1:-1) connectionOpened 1131:0:0:4 topic 0 hasMoreMessages 1131:0:0:4 lastMessageIdInBroker 1131:0:0:4 lastDequeuedMessageId-1:-1:-1 topic 0 (return true) hasMoreMessages 1131:0:0:4 lastMessageIdInBroker 1131:0:0:4 lastDequeuedMessageId-1:-1:-1 topic 0 (return true) message received [1132:0:1:4, 1131:0:0:4, 1133:0:2:4, 1133:0:2:4] ``` 2) Then I implemented the first seek in ConnectionOpen, and found that when there is no subscription, the lastMessageIdInBroker cannot be obtained. Finally, I can only temporarily use seek to solve this problem. If anyone wants to use subscription to solve this problem, they can open another issue. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org