rdblue commented on a change in pull request #4082:
URL: https://github.com/apache/iceberg/pull/4082#discussion_r803831394
##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -725,6 +728,21 @@ private static SortOrder freshSortOrder(int orderId,
Schema schema, SortOrder so
return builder.build();
}
+ private Map<String, SnapshotRef> validateRefs(Map<String, SnapshotRef>
inputRefs) {
+ for (Map.Entry<String, SnapshotRef> refEntry : inputRefs.entrySet()) {
+ String refName = refEntry.getKey();
+ SnapshotRef ref = refEntry.getValue();
+ if (ref.snapshotId() == -1) {
+ Preconditions.checkArgument(refName.equals(SnapshotRef.MAIN_BRANCH),
+ "Snapshot ref %s refers to snapshot id -1. Only main can refer to
-1", refName);
Review comment:
I agree. We should not explicitly track -1, but when the current
snapshot is requested we can return null if there is no `main`. And we should
keep `current-snapshot-id` up to date for older readers.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]