Skip to content

Commit

Permalink
Fix seek-to-timestamp
Browse files Browse the repository at this point in the history
- if the specified timestamp exceeds that of any previously written message
then the consumer offset should be set to .endOffsets

- incrementing .endOffsets by one will cause a message to missed
  • Loading branch information
marcoccchan committed Aug 12, 2024
1 parent 3dc4b18 commit d261f21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/jackdaw/client.clj
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
{:keys [^OffsetAndTimestamp ts-offset end-offset]}] offsets]
(let [offset (or (when ts-offset
(.offset ts-offset))
(inc end-offset))]
end-offset)]
(log/infof "Setting starting offset (topic=%s, partition=%s): %s"
(.topic topic-partition)
(.partition topic-partition)
Expand Down
2 changes: 1 addition & 1 deletion test/jackdaw/client_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -361,5 +361,5 @@
(client/assign-all $ (map :topic-name [topic-config]))
(client/seek-to-timestamp $ ts-next [topic-config])
(client/position-all $)
(is (= [11]
(is (= [10]
(vals $))))))))))

0 comments on commit d261f21

Please sign in to comment.