RobertIndie opened a new pull request, #1364: URL: https://github.com/apache/pulsar-client-go/pull/1364
### Motivation The Go client version 0.15.0 introduced a regression bug. If the reader's `startMessageId` is set to the latest, it will hang while reading. This issue can be reproduced using the new test case: `TestReaderReadFromLatest`. ### Modifications The root cause is a change in behavior from before version 0.15.0. Previously, the consumer would avoid discarding messages if `startMessageId` was set to Latest. This logic was altered in this pull request: https://github.com/apache/pulsar-client-go/pull/1340/files#diff-782cf41d23c24657ede53da5d028f05819b302305ed676c61322b4cfba4265e9L1454-L1457 The following logic was removed: ```go // if we start at latest message, we should never discard if pc.options.startMessageID != nil && pc.options.startMessageID.equal(latestMessageID) { return false } ``` In version 0.15.0, if `startMessageId` is Latest, the reader won't receive any messages because all message IDs are before the latest and will be discarded. We need to reinstate this check. For the seek operation, the correct approach is: - When handling a seek request, the consumer should set the `seekMessageId` before reconnecting. - After reconnecting, the consumer should check if `seekMessageId` exists. If it does, it indicates the consumer is seeking, and `seekMessageId` should be set as `startMessageId`. This ensures that even if the reader's `startMessageId` is Latest, it won't receive messages before the specified seek message ID, maintaining the correct behavior as intended in this [PR](https://github.com/apache/pulsar-client-go/pull/1340). ### 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): (yes / no) - The public API: (yes / no) - The schema: (yes / no / don't know) - The default values of configurations: (yes / no) - The wire protocol: (yes / no) ### Documentation - Does this pull request introduce a new feature? (yes / no) - If yes, how is the feature documented? (not applicable / docs / GoDocs / not documented) - If a feature is not applicable for documentation, explain why? - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
