laskoviymishka commented on code in PR #2615:
URL: https://github.com/apache/iceberg-go/pull/2615#discussion_r4583163294
##########
table/row_delta.go:
##########
@@ -525,7 +536,9 @@ func (rd *RowDelta) findReplacedLiveDVs(ctx
context.Context, fs iceio.IO, meta *
//
// A removed file that does not resolve to a live delete entry is an
// error: the producer would otherwise silently skip the removal and
-// the commit would strand two live DVs on one data file. Two removals
+// the commit would strand two live DVs on one data file. When the file
+// is live on the snapshot the transaction started from, the error
+// says an operation staged earlier in the transaction removed it. Two removals
Review Comment:
small thing: this line runs about 8 characters wider than the rest of the
paragraph, since it wasn't rewrapped after the insert. Could we rewrap lines
539–541 to match?
##########
table/row_delta.go:
##########
@@ -565,6 +578,15 @@ func (rd *RowDelta) resolveRemovedDeletes(ctx
context.Context, fs iceio.IO, meta
var live iceberg.DataFile
switch {
case len(candidates) == 0:
+ removed, err := rd.removedEarlierInTransaction(ctx, fs,
snap, f.FilePath())
+ if err != nil {
+ return nil, err
+ }
+ if removed {
+ return nil, fmt.Errorf("cannot remove delete
file %s: an operation staged earlier in this transaction already removed it",
Review Comment:
Should this wrap `ErrInvalidOperation` like the new `Commit` guard does?
Right now callers can only match it by its text, and the tests check it with
`assert.Contains`. The neighbouring "do not belong to the table" error is bare
on `main` too, so staying with the file's style is also fine. It just felt odd
next to a guard in the same PR that wraps.
##########
table/row_delta.go:
##########
@@ -619,6 +641,36 @@ func (rd *RowDelta) resolveRemovedDeletes(ctx
context.Context, fs iceio.IO, meta
return resolved, nil
}
+// removedEarlierInTransaction reports whether path is a live delete entry
Review Comment:
Could the doc say this only catches DVs that were live when the transaction
started? As I read it, the loop only walks the start snapshot's live delete
entries
([L652-L672](https://github.com/apache/iceberg-go/blob/aa7995271d6f23e5f0b983a9ac17a84c1738cca8/table/row_delta.go#L652-L672)).
So a DV that was added and then removed earlier in the same transaction still
gets "do not belong to the table". That only affects the message, but the doc
reads as if it covers that case.
--
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]