zeroshade commented on code in PR #2302:
URL: https://github.com/apache/iceberg-go/pull/2302#discussion_r4405180160


##########
table/rewrite_data_files.go:
##########


Review Comment:
   Updated in 3491bfe: `FailedGroups` now covers batches that failed to commit 
or were rejected because a delete for one of their files was committed after 
planning.



##########
table/rewrite_data_files.go:
##########
@@ -625,6 +631,33 @@ func (t *Transaction) rewriteDataFilesPartial(ctx 
context.Context, groups []Comp
                if err != nil {
                        return result, fmt.Errorf("open table IO for partial 
rewrite batch: %w", err)
                }
+
+               // The groups were planned against the starting table, but an 
earlier
+               // batch's refresh-and-replay retry can commit on top of peer
+               // snapshots. Those snapshots then form this batch's base, so 
its
+               // commit-time validator never sees them, while its planned 
tasks lack
+               // any delete files they added. Rewriting anyway would write 
the deleted
+               // rows back and then drop those deletes as dead.
+               if err := validateNoNewDeletesSincePlanning(planned, 
current.Metadata(), t.branch, fs, batchGroups); err != nil {
+                       if !errors.Is(err, ErrConflictingDeleteFiles) {
+                               return result, fmt.Errorf("validate partial 
rewrite batch %d against its planning snapshot: %w", batchNum, err)
+                       }
+
+                       failedCommits++

Review Comment:
   Added 
`TestRewriteDataFiles_PartialProgressRejectedBatchesCountTowardMaxFailedCommits`
 in 3491bfe: three batches, peer deletes absorbed into batches 2 and 3, 
`MaxFailedCommits: 1`. It asserts the "maximum failed commits reached" error 
wrapping `ErrConflictingDeleteFiles`. Replacing the increment with `_ = 
failedCommits` makes it fail.



-- 
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]

Reply via email to