Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion table/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ func (t *Transaction) ExpireSnapshots(opts ...ExpireSnapshotsOpt) error {
for {
snap, err := t.meta.SnapshotByID(snapId)
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
Comment on lines 250 to +253
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
Contributor 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.

}

snapAge := time.Now().UnixMilli() - snap.TimestampMs
Expand Down
Loading