-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Produce records with consistent timestamps (#1455)
It is possible for the same record to have a different timestamp depending on where it appears in a produceSet, as the test case in this commit illustrates. The problem is that the produceSet's FirstTimestamp and the record's TimestampDelta are each calculated with nanosecond precision, and then truncated to millisecond precision during encoding. This leads to accumulated rounding error when the original timestamp is later reconstructed. Instead, truncate all timestamps to millisecond precision before calculating the FirstTimestamp and TimestampDelta, so that if the same record is produced multiple times, it will always have the same timestamp.
- Loading branch information
Showing
2 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters