akritishakya opened a new pull request, #2615: URL: https://github.com/apache/iceberg-go/pull/2615
Closes #2537 ## Problem 1. A second `Commit` on the same `RowDelta` builder processed every file it held again. Data files and non-DV delete files were staged twice with no error. For example, `AddRows(f1)`, `Commit`, `AddRows(f2)`, `Commit` left `f1` live twice. 2. If the builder also removed a deletion vector, the second `Commit` failed with `cannot remove delete files that do not belong to the table: <path>`, although the file belonged to the table; the first call had removed it. 3. Two separate builders in one transaction removing the same deletion vector got the same misleading error. `RewriteFiles.Commit` already rejects a second call. ## Changes - `RowDelta.Commit` is single-shot: a second call returns an error wrapping `ErrInvalidOperation` and stages nothing, even if the first call failed. - When a removed delete file has no live entry in the staged snapshot but has one on the snapshot the transaction started from, the error is `cannot remove delete file <path>: an operation staged earlier in this transaction already removed it`. The start snapshot is resolved with `planningSnapshot`, like the staged one, so a branch the transaction creates starts from main. If the start snapshot cannot be read, that error is returned; otherwise the original error is kept. This lookup runs only when a removal has already failed. - Added a compatibility note to `website/src/releases.md`. ## Tests - `TestRowDeltaCommitSingleShot`: a second `Commit` returns an error wrapping `ErrInvalidOperation` after a successful call with data files, after one that replaced a deletion vector, and after a failed call. No file is staged twice. - `TestRowDeltaRemoveDeletesMissingFromStagedSnapshot`: on `main` and on a branch the transaction creates, removing a deletion vector that an earlier row delta in the transaction removed reports `already removed it`; one never committed or removed before the transaction reports `do not belong to the table`. ```sh go test ./table/... -count=1 ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
