amogh-jahagirdar commented on code in PR #4071:
URL: https://github.com/apache/iceberg/pull/4071#discussion_r846855506


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1019,6 +1019,48 @@ public Builder setBranchSnapshot(long snapshotId, String 
branch) {
       return this;
     }
 
+    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);
+
+      if (SnapshotRef.MAIN_BRANCH.equals(name)) {
+        this.currentSnapshotId = ref.snapshotId();
+        snapshotLog.add(new SnapshotLogEntry(lastUpdatedMillis, 
ref.snapshotId()));
+      }

Review Comment:
   @rdblue in SetRef we will update the snapshot log.



-- 
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]

Reply via email to