rahulsmahadev opened a new pull request, #19114:
URL: https://github.com/apache/iceberg/pull/19114

   Follow-up to #17622, as discussed in 
https://github.com/apache/iceberg/pull/17622#discussion_r4567258621.
   
   RepairTable commits its repaired manifests with `RewriteManifests`, and a 
REPLACE snapshot keeps the parent snapshot's totals. So after a repair, 
`total-records`, `total-files-size`, `total-position-deletes` and 
`total-equality-deletes` still reflect the incorrect stats.
   
   This adds `RewriteManifests.adjustTotal(String totalProperty, long delta)`. 
The caller passes how much a total changes, and core adds that to the totals of 
the snapshot the commit lands on, so the totals stay correct when the commit is 
retried on a newer snapshot. Only the record count and file size totals can be 
adjusted, since the replaced and new manifests must hold the same files.
   
   RepairTable on Spark 4.2 now works out the deltas while it checks each 
entry: the record count and file size it will write, minus the stored ones. It 
sums them per total and passes them to `adjustTotal`. I'll backport the Spark 
change to 3.5, 4.0 and 4.1 once this lands.
   
   Tests:
   - `TestRewriteManifests`: deltas for two corrected files, one of them 
negative, are summed into the totals, and they are applied to the latest 
snapshot when the commit lands after a concurrent append. File count totals are 
rejected.
   - `TestRepairTableAction`: after repairing a data file, an equality delete, 
a position delete, and a manifest that holds both delete types, the snapshot 
totals match the repaired files.
   
   This pull request and its description were written by Isaac.
   


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