Fix hasMessageAvailable incorrectly returns true when read to latest after seeking by timestamp #498
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.
The computation for
compareMarkDeletePositionis wrong thathasSoughtByTimestamp_should only be checked whenlastDequedMessageId_isearliest, which means no messages have been received.Additionally, reset
startMessageId_when seeking by timestamp, otherwise, if the initialstartMessageIdof a reader is a valid message id, that message could be filtered inpulsar-client-cpp/lib/ConsumerImpl.cc
Lines 619 to 625 in 9b86f9e
pulsar-client-cpp/lib/ConsumerImpl.cc
Lines 774 to 780 in 9b86f9e
Improve
testHasMessageAvailableAfterSeekTimestampto cover the cases above.