Skip to content

Fix Reader HasMessageAvailable behavior after seeking by timestamp#344

Merged
Lanayx merged 2 commits intofsprojects:developfrom
RobertIndie:iss-340
Jan 29, 2026
Merged

Fix Reader HasMessageAvailable behavior after seeking by timestamp#344
Lanayx merged 2 commits intofsprojects:developfrom
RobertIndie:iss-340

Conversation

@RobertIndie
Copy link
Contributor

@RobertIndie RobertIndie commented Jan 29, 2026

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.

@Lanayx Lanayx merged commit 170cb2f into fsprojects:develop Jan 29, 2026
2 checks passed
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected reading behaviour after seeking by time and using HasMessageAvailableAsync

2 participants