-
Notifications
You must be signed in to change notification settings - Fork 3k
Add a tolerance check of 1 minute to prevent small clock skews to break commits #1110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ak commits Fixes 1109 squash! 1109 Add a tolerance check of 1 minute to prevent small clock skews to break commits
|
Looks good, but I think we also need to update handling for the snapshot history log. |
| } | ||
| last = logEntry; | ||
| } | ||
| if (last != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than wrapping a precondition in an if, it's shorter to add an or:
Preconditions.checkArgument(last == null || lastUpdatedMillis - last.timestampMillis() >= -ONE_MINUTE, ...);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that the argument - last.timestampMillis() will be evaluated eagerly and may result in NPE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be evaluated eagerly. Are you sure about that? We use this pattern in other classes without a problem.
|
@rdblue can you have another look please? |
| } | ||
| previous = metadataEntry; | ||
| } | ||
| // Make sure that this update's lastUpdatedMillis is > max(previousFile's timestamp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: indentation is off.
|
Overall it looks good. Thanks, @rdsr! |
Fixes #1109