Skip to content

Conversation

@rdsr
Copy link
Contributor

@rdsr rdsr commented Jun 12, 2020

Fixes #1109

…ak commits

Fixes 1109

squash! 1109 Add a tolerance check of 1 minute to prevent small clock skews to break commits
@rdblue
Copy link
Contributor

rdblue commented Jun 12, 2020

Looks good, but I think we also need to update handling for the snapshot history log.

}
last = logEntry;
}
if (last != null) {
Copy link
Contributor

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, ...);

Copy link
Contributor Author

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

Copy link
Contributor

@rdblue rdblue Jun 15, 2020

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.

@rdsr
Copy link
Contributor Author

rdsr commented Jun 15, 2020

@rdblue can you have another look please?

}
previous = metadataEntry;
}
// Make sure that this update's lastUpdatedMillis is > max(previousFile's timestamp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indentation is off.

@rdblue rdblue merged commit 90d0a0e into apache:master Jun 15, 2020
@rdblue
Copy link
Contributor

rdblue commented Jun 15, 2020

Overall it looks good. Thanks, @rdsr!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TableMetadata#lastUpdatedMillis can end up with lower timestamp value compared to the existing previous metadata-log entries

2 participants