KAFKA-17686: AsyncKafkaConsumer.offsetsForTimes() fails with NullPointerException
The code to convert the Map was initially expressed using the Streams API with collect(Collectors.toMap()). Unfortunately, the implementation of Collector returned by Collectors.toMap() does not support null entries. The KafkaConsumer.offsetsForTimes() API explicitly states that nulls can be present in the returned Map, hence this change.
Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
KAFKA-14560 will remove the old client protocol API, so do kafka-client 4.0 need to handle null timestamp?
KAFKA-14560 will remove the old client protocol API, so do kafka-client 4.0 need to handle
nulltimestamp?
I want to make very sure I understand the KIP:
- Support for
ListOffsetsv0 is being removed in 4.0 -
Timestamp(andOffset) are both required in v1 and later - The 4.0.0 client should never get to the point where it receives a value of
-1for either the timestamp or offset
Is the above correct?
Separate from this PR, it sounds like the client should remove code that supports those outdated RPC versions.
For example, OffsetAndTimestampInternal appears to exist simply “to allow negative timestamps and offset” values. ListOffsetData is another internal class that is used to compensate for missing values in v0 ListOffset RPC responses. Those classes (and surrounding code) should be removed within the AK 4.0.0 timeframe, right?
Is the above correct?
Great! Glad we're on the same page. :smile:
Those classes (and surrounding code) should be removed within the AK 4.0.0 timeframe, right?
yes, consumer should throw unsupported version if the target broker supports only 0
@chia7712 / @lianetm—tests are passing and comments have been addressed. Can you provide another pass of reviews? Thanks!