mehbey opened a new pull request, #13709: URL: https://github.com/apache/kafka/pull/13709
### What changed Added a validation to check if the record timestamp is in the future compared to the broker's timestamp and throw an exception to reject the record. The current validation for checking the record's timestamp based on the configuered ```timestampDiffMaxMs``` remain unchanged. This new validation will take care of scenarios where producers are sending future timestamp for a record. Specific changes are: - Updated validation logic in LogValidator - Added Unit test coverage for the change - Update Unit tests that failed because of the new validation logic ### Why? https://issues.apache.org/jira/browse/KAFKA-14991 Improves the accuracy of the log validation logic and avoids unexpected gotchas for customers ### Testing - Added relevant unit tests - Reproduced the issue by setting nonseconds instead of miliseconds in the producer logic and verified that validation is working as expected. Example API response ``` "responses":[{"name":"myTopic1","partitionResponses":[{"index":0,"errorCode":32,"baseOffset":-1,"logAppendTimeMs":-1,"logStartOffset":0,"recordErrors":[ {"batchIndex":0,"batchIndexErrorMessage":"Timestamp 1755933141855875 of message with offset 0 is ahead of the server's time. 1683838582815"}, {"batchIndex":1,"batchIndexErrorMessage":"Timestamp 1755933754530625 of message with offset 1 is ahead of the server's time. 1683838582815"}, .... ],"errorMessage":"One or more records have been rejected due to invalid timestamp"}]}] ``` ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org