rdblue commented on code in PR #4071:
URL: https://github.com/apache/iceberg/pull/4071#discussion_r846826070
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1019,16 +1019,31 @@ public Builder setBranchSnapshot(long snapshotId,
String branch) {
return this;
}
- public Builder removeBranch(String branch) {
- if (SnapshotRef.MAIN_BRANCH.equals(branch)) {
+ public Builder setRef(String name, SnapshotRef ref) {
+ SnapshotRef existingRef = refs.get(name);
+ if (existingRef != null && existingRef.equals(ref)) {
+ return this;
+ }
+
+ long snapshotId = ref.snapshotId();
+ Snapshot snapshot = snapshotsById.get(snapshotId);
+ ValidationException.check(snapshot != null, "Cannot set %s to unknown
snapshot: %s", name, snapshotId);
+ refs.put(name, ref);
+ MetadataUpdate.SetSnapshotRef refUpdate = new
MetadataUpdate.SetSnapshotRef(name, ref.snapshotId(), ref.type(),
+ ref.minSnapshotsToKeep(), ref.maxSnapshotAgeMs(), ref.maxRefAgeMs());
Review Comment:
Style: For long arg lists, it's better to start on a newline from the first
arg.
--
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]