Fix Reader HasMessageAvailable behavior after seeking by timestamp#344
Merged
Lanayx merged 2 commits intofsprojects:developfrom Jan 29, 2026
Merged
Fix Reader HasMessageAvailable behavior after seeking by timestamp#344Lanayx merged 2 commits intofsprojects:developfrom
Lanayx merged 2 commits intofsprojects:developfrom
Conversation
This was referenced Jan 29, 2026
Lanayx
approved these changes
Jan 29, 2026
RobertIndie
added a commit
to RobertIndie/pulsar-client-dotnet
that referenced
this pull request
Jan 30, 2026
…sprojects#344) * Fix Reader HasMessageAvailable behavior after seeking by timestamp * Improve logic (cherry picked from commit 170cb2f)
Lanayx
pushed a commit
that referenced
this pull request
Jan 30, 2026
…stamp (#342) * Fix wrong results of hasMessageAvailable after seeking by timestamp (#333) * Fix wrong results of hasMessageAvailable and readNext after seeking by timestamp * Remove HasSoughtByTimestamp and improve test (cherry picked from commit e894e66) * Fix Reader HasMessageAvailable behavior after seeking by timestamp (#344) * Fix Reader HasMessageAvailable behavior after seeking by timestamp * Improve logic (cherry picked from commit 170cb2f)
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
Fixes: #340
The root cause is that after seeking by timestamp, the reader may incorrectly reset its cursor to the end of the topic inside HasMessageAvailable.
This PR also fixes an issue where hasSoughtByTimestamp is not reset to false when seeking by message ID.
Another issue is that this PR https://github.com/fsprojects/pulsar-client-dotnet/pull/192/changes#diff-d77a9b953c0d4a90fce3f3a201f6aa014df28eac2e9015b7e483184a4befd01eL1105 appears to have incorrectly removed the consumerConfig.ResetIncludeHead check in HasMessageAvailable. As a result, the reader may seek to the last message ID even when it is configured with exclusive reading to the latest ID, where this behavior is unnecessary. This PR restores the missing check to prevent that incorrect seek behavior.