diff --git a/core/src/main/java/org/apache/iceberg/TableMetadata.java b/core/src/main/java/org/apache/iceberg/TableMetadata.java index 9f6ffbcc8714..0cea4946d58f 100644 --- a/core/src/main/java/org/apache/iceberg/TableMetadata.java +++ b/core/src/main/java/org/apache/iceberg/TableMetadata.java @@ -1299,11 +1299,8 @@ public Builder removeRef(String name) { private Builder resetMainBranch() { this.currentSnapshotId = -1; - SnapshotRef ref = refs.remove(SnapshotRef.MAIN_BRANCH); - if (ref != null) { - changes.add(new MetadataUpdate.RemoveSnapshotRef(SnapshotRef.MAIN_BRANCH)); - } - + refs.remove(SnapshotRef.MAIN_BRANCH); + setBranchSnapshot(-1, SnapshotRef.MAIN_BRANCH); return this; }