This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git


The following commit(s) were added to refs/heads/main by this push:
     new 31ca72f5 fix: preserve snapshot log history (#638)
31ca72f5 is described below

commit 31ca72f5cd5b287df18a31b874aa9f119419b573
Author: Shubhendu <[email protected]>
AuthorDate: Thu Dec 4 23:00:25 2025 +0530

    fix: preserve snapshot log history (#638)
    
    Fixed RemoveSnapshotRef() to preserve snapshot log when removing
    MainBranch reference during CREATE OR REPLACE TABLE operations.
    Previously cleared entire snapshot history, causing
    testReplaceTableKeepsSnapshotLog RCK test to fail. Now only resets
    current snapshot pointer while maintaining historical log entries,
    matching Apache Iceberg Java spec behavior.
    
    Below RCK test fails
    ```
    RESTCompatibilityKitCatalogTests > testReplaceTableKeepsSnapshotLog() FAILED
        java.lang.IndexOutOfBoundsException: index (1) must be less than size 
(1)
            at 
org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1369)
            at 
org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1351)
            at 
org.apache.iceberg.relocated.com.google.common.collect.SingletonImmutableList.get(SingletonImmutableList.java:46)
            at 
org.apache.iceberg.catalog.CatalogTests.testReplaceTableKeepsSnapshotLog(CatalogTests.java:2611)
            at java.base/java.lang.reflect.Method.invoke(Method.java:569)
            at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
            at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    ```
    
    Signed-off-by: Shubhendu Ram Tripathi <[email protected]>
---
 table/metadata.go | 1 -
 1 file changed, 1 deletion(-)

diff --git a/table/metadata.go b/table/metadata.go
index 88e6607f..7e6fb1ad 100644
--- a/table/metadata.go
+++ b/table/metadata.go
@@ -754,7 +754,6 @@ func (b *MetadataBuilder) RemoveSnapshotRef(name string) 
error {
 
        if name == MainBranch {
                b.currentSnapshotID = nil
-               b.snapshotLog = b.snapshotLog[:0]
        }
 
        delete(b.refs, name)

Reply via email to