rdblue commented on code in PR #4071:
URL: https://github.com/apache/iceberg/pull/4071#discussion_r846870978
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1300,20 +1346,13 @@ private void setBranchSnapshotInternal(Snapshot
snapshot, String branch) {
this.lastUpdatedMillis = isAddedSnapshot(snapshot.snapshotId()) ?
snapshot.timestampMillis() : System.currentTimeMillis();
- if (SnapshotRef.MAIN_BRANCH.equals(branch)) {
- this.currentSnapshotId = replacementSnapshotId;
- snapshotLog.add(new SnapshotLogEntry(lastUpdatedMillis,
replacementSnapshotId));
- }
-
- SnapshotRef newRef;
+ SnapshotRef.Builder newRefBuilder;
if (ref != null) {
- newRef = SnapshotRef.builderFrom(ref, replacementSnapshotId).build();
+ newRefBuilder = SnapshotRef.builderFrom(ref, replacementSnapshotId);
} else {
- newRef = SnapshotRef.branchBuilder(replacementSnapshotId).build();
+ newRefBuilder = SnapshotRef.branchBuilder(replacementSnapshotId);
}
-
- refs.put(branch, newRef);
- changes.add(new MetadataUpdate.SetSnapshotRef(branch,
replacementSnapshotId));
+ setRef(branch, newRefBuilder.build());
Review Comment:
You can revert the changes to keep the builder around.
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1300,20 +1346,13 @@ private void setBranchSnapshotInternal(Snapshot
snapshot, String branch) {
this.lastUpdatedMillis = isAddedSnapshot(snapshot.snapshotId()) ?
snapshot.timestampMillis() : System.currentTimeMillis();
- if (SnapshotRef.MAIN_BRANCH.equals(branch)) {
Review Comment:
The lines that set `lastUpdatedMillis` also need to move to ensure that
`lastUpdatedMillis` is set correctly.
--
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]