It would be nice if we could limit use of `UNDEFINED_EPOCH` to the serde logic. 
I think passing around integer sentinels is unsafe because the type checker 
can't help us ensure that we have proper checking in place. A couple options 
come to mind:

1. We can let `endOffsetFor` accept `Option[Int]` as the epoch to query. The 
epoch if defined must be non-negative.
2. Keep the current `endOffsetFor` API, but require the epoch to be 
non-negative. We can match on the epoch here and only invoke `endOffsetFor` if 
we have an epoch. Otherwise we can return `(UNDEFINED_EPOCH, 
UNDEFINED_EPOCH_OFFSET` directly.


[ Full content available at: https://github.com/apache/kafka/pull/5320 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to