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

   ## Summary
   Fix DeleteOrphanFiles incorrectly deleting manifest files that are still 
referenced when run alongside ExpireSnapshots in Flink TableMaintenance.
   
   ### Problem
   ListMetadataFiles (used by DeleteOrphanFiles to enumerate in-use metadata 
files) did not call table.refresh() before listing snapshots and their manifest 
files. It used a stale table view loaded once at operator open() time. 
Meanwhile, MetadataTablePlanner (which lists data files) correctly called 
table.refresh(). This inconsistency meant that manifest files from snapshots 
added after operator startup were missing from the in-use set, causing 
OrphanFilesDetector to incorrectly flag them as orphans and delete them.
   
   ### Fix
   Added table.refresh() at the start of ListMetadataFiles.processElement() in 
all three Flink versions (v1.20, v2.0, v2.1), consistent with 
MetadataTablePlanner.processElement().
   
   ### Testing
   Added testMetadataFilesRefreshesTable which verifies that ListMetadataFiles 
sees new snapshots added after the operator was opened.
   
   Fixes #15487


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