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


##########
table/transaction.go:
##########
@@ -1621,6 +1624,7 @@ type dataFileCfg struct {
        rewriteSemantics             bool
        equalityDeleteToDVConversion bool
        dataSequenceNumber           *int64
+       replacementPathValidator     *conflictValidatorFunc

Review Comment:
   nit: a func value can already be nil, so the pointer isn't needed. This 
option also only exists to turn off replacement-path tracking and to move where 
the existing rewrite-by-path check is registered. A 
`skipReplacementPathTracking bool` option, with `StageRewrittenDataFilesByPath` 
still calling `t.addValidator(...)` after `rewrite.Commit` as it does on main, 
would be smaller and would leave that flow unchanged.



##########
table/snapshot_producers.go:
##########
@@ -1507,6 +1507,23 @@ func manifestPaths(ctx context.Context, fio iceio.IO, s 
*Snapshot) (map[string]s
        return paths, nil
 }
 
+// trackReplacementPaths records the manifest paths already checked
+// while staging a replacement so a replay only scans new data manifests.
+func (sp *snapshotProducer) trackReplacementPaths(ctx context.Context, parent 
*Snapshot, paths map[string]struct{}) error {
+       if len(paths) == 0 {
+               return nil
+       }
+
+       checked, err := manifestPaths(ctx, sp.io, parent)
+       if err != nil {
+               return err
+       }
+       sp.duplicateCheckPaths = paths

Review Comment:
   nit: the two existing places that set these fields (the append paths around 
`transaction.go` L1800 and L2543) store `maps.Clone(setToAdd)`. This stores the 
caller's map directly. Nothing mutates it after staging today, but cloning 
would match, and those two places could call this helper so there's one way to 
set it up.



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