You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "zeroshade (via GitHub)" <gi...@apache.org> on 2026/08/06 22:02:49 UTC

Re: [PR] fix(table): reject refreshes with changed table UUID [iceberg-go]

zeroshade commented on code in PR #1659:
URL: https://github.com/apache/iceberg-go/pull/1659#discussion_r3732114363


##########
table/table.go:
##########
@@ -202,6 +202,12 @@ func (t *Table) Refresh(ctx context.Context) error {
 	if err != nil {
 		return err
 	}
+	if t.metadata != nil && fresh.metadata != nil {
+		if expected, actual := t.metadata.TableUUID(), fresh.metadata.TableUUID(); expected != actual {

Review Comment:
   An absent v1 `table-uuid` decodes as `uuid.Nil`, but this comparison treats that sentinel as a real identity. Valid transitions between UUID-less v1 metadata and metadata with a UUID are therefore rejected. The repository's valid UUID-less fixture begins at `table/metadata_internal_test.go:864`, and the value field that produces `uuid.Nil` is `table/metadata.go:1634`.
   
   Suggested fix: compare only when both UUIDs are known: `expected != uuid.Nil && actual != uuid.Nil && expected != actual`, and test absent→present, present→absent, and both-absent refreshes.



##########
table/table.go:
##########
@@ -202,6 +202,12 @@ func (t *Table) Refresh(ctx context.Context) error {
 	if err != nil {
 		return err
 	}
+	if t.metadata != nil && fresh.metadata != nil {
+		if expected, actual := t.metadata.TableUUID(), fresh.metadata.TableUUID(); expected != actual {
+			return fmt.Errorf("%w: table UUID changed during refresh: expected %s, got %s",

Review Comment:
   This error includes both UUIDs and wraps `ErrInvalidMetadata`, but it does not tell the caller how to recover.
   
   Suggested fix: say that the table was likely replaced and instruct the caller to load a new table handle; including the table identifier would make the diagnosis more actionable.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org