rdblue commented on code in PR #4071:
URL: https://github.com/apache/iceberg/pull/4071#discussion_r846825987
##########
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);
Review Comment:
This will discard existing ref settings, like `minSnapshotsToKeep`.
I think that carrying existing ref settings through should be thoroughly
tested.
--
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]