Skip to content

Avoid panic when deleting more files than adding in an overwrite#2

Open
timsaucer wants to merge 1 commit intoglitchy:feat/overwrite-actionfrom
timsaucer:bugfix/previous-snapshot-on-summary
Open

Avoid panic when deleting more files than adding in an overwrite#2
timsaucer wants to merge 1 commit intoglitchy:feat/overwrite-actionfrom
timsaucer:bugfix/previous-snapshot-on-summary

Conversation

@timsaucer
Copy link

This PR is targeting the branch for PR apache#2185

I was testing the PR above and found an issue when I was overwriting with fewer files than I was deleting. If you do that it causes a panic in update_snapshot_summaries because we end up subtracting an unsigned integer and going negative.

We could patch that to avoid the underflow, but the root cause is that in summary() we never get the previous snapshot - it's always None. This is because the snapshot producer hasn't run yet so the new snapshot ID can never be retrieved from the table metadata. Instead we can get the current snapshot of the table and use that directly.

I have updated the unit test to emphasize this by registering two files and then overwriting with deleting both and adding one. If you revert the change in summary() you'll see the test panic.

@timsaucer timsaucer changed the title Get the previous snapshot directly from the table_metadata and add up… Avoid panic when deleting more files than adding in an overwrite Mar 11, 2026
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.

1 participant