hudeqi commented on PR #14587: URL: https://github.com/apache/kafka/pull/14587#issuecomment-1771985878
> Thanks @hudeqi, I think this is reasonable. Do you know why Sarama sets offsets to -1? If it's for normal operations and not indicative of something wrong, we may not even need to log a warning message in that case and could change the check [here](https://github.com/apache/kafka/blob/af747fbfed7e81617c3b3ad0e4dc8c857aa9502b/connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorCheckpointTask.java#L325) from `!targetConsumerOffset.containsKey(topicPartition)` to `targetConsumerOffset.get(topicPartition) == null`. Thanks your review. @C0urante . In fact, directly resetting to -1 is an abnormal operation, whether for Sarama or other clients. This problem was discovered in this way: when using the Sarama client, we wanted to reset the group's offset to the latest, so we passed in the `OffsetNewest` in Sarama as a parameter to call the reset offset method. Finally, it was discovered that the offset was reset to -1. The reason is that the value of `OffsetNewest` is -1. For Sarama, resetting to the latest should be another operation process, but this kind of misoperation is not intercepted like the java client, which can be deal friendly. So this issue occurred when encountering scenarios like MM2. So I think it is better to add a warn log here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
