akritishakya commented on code in PR #2615:
URL: https://github.com/apache/iceberg-go/pull/2615#discussion_r4583575563
##########
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:
Updated the doc: it now says the check covers only DVs live on the start
snapshot, and that a DV added and removed earlier in the same transaction keeps
the "do not belong to the table" error.
##########
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:
Wrapped it with ErrInvalidOperation, matching the Commit guard, and the test
now checks it with errors.Is. I left "do not belong to the table" as it is,
since that error predates this PR.
##########
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:
Rewrapped the paragraph to match the rest of the comment.
--
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]