Skip to content

Conversation

@dhananjaykrutika
Copy link

After snapshot expiration, remaining snapshots may have parent-snapshot-id references pointing to snapshots that no longer exist. ExpireSnapshots was failing when walking the parent chain and encountering these dangling references.

Change the behavior to treat a missing parent snapshot as the end of the chain rather than returning an error. This is expected and valid behavior in Iceberg tables that have undergone previous snapshot expiration.

After snapshot expiration, remaining snapshots may have parent-snapshot-id
references pointing to snapshots that no longer exist. ExpireSnapshots was
failing when walking the parent chain and encountering these dangling
references.

Change the behavior to treat a missing parent snapshot as the end of the
chain rather than returning an error. This is expected and valid behavior
in Iceberg tables that have undergone previous snapshot expiration.
Comment on lines 243 to +246
if err != nil {
return err
// Parent snapshot may have been removed by a previous expiration.
// Treat missing parent as end of chain - this is expected behavior.
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we match on the specific error type?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twuebi not sure I understand. There's really only one reason SnapshotByID() fails -- when the given snapshot ID doesn't exist in snapshotList list.

Copy link
Contributor

@twuebi twuebi Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably goes beyond the scope of this PR, if the only reason for SnapshotByID to ever error is not found, then it should probably become a bool, ptr or simply just ptr interface.

Relying on the function to only return an err for not found means that we rely on something that's not statically checked, although unlikely, someone may change SnapshotByID to return err on other cases too, and we'd treat that as happy path here.

@zeroshade
Copy link
Member

Thanks @dhananjaykrutika can you add a test for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants