WZhuo opened a new pull request, #1214:
URL: https://github.com/apache/iceberg-cpp/pull/1214

   Table maintenance work such as orphan file removal, purging a table, and 
rewriting table paths needs to find every file that table metadata references. 
Iceberg Java keeps this logic in `ReachableFileUtil`. In C++ the equivalent 
code is private to `ExpireSnapshots`, so it cannot be reused. This PR moves it 
into a public `ReachableFileUtil`, which those follow-up actions can build on.
   
   Approach:
   - `ReachableFileUtil` (`util/reachable_file_util.{h,cc}`) provides the same 
location helpers as Java: `VersionHintLocation`, `MetadataFileLocations` 
(optionally recursive), `ManifestListLocations`, and 
`StatisticsFilesLocations(ForSnapshots)`.
   - It also provides manifest helpers that have no counterpart in Java's 
class: `ReachableManifests`, `ManifestsForSnapshots`, `LiveFileLocations`, and 
`LiveFileLocationsForManifests`. They take an optional `Executor`, like the 
rest of the code base.
   - `ReachableFileCleanup` in `ExpireSnapshots` now calls these helpers 
instead of its private copies. Error handling and executor use are unchanged. 
`IncrementalFileCleanup` is not touched.
   - Differences from Java's `metadataFileLocations`:
     - A visited set stops the recursive walk when metadata logs reference each 
other in a cycle.
     - The walk is a loop, not recursion, so each previous metadata file is 
freed before the next one is read.
     - When a previous metadata file can't be read, the log message gives only 
its position in the metadata log. The location and the IO error are left out 
because they may contain credentials.
     - Like Java, each step follows only the first metadata file in the log 
that can be read.
   
   Verification:
   - Built `table_update_test` locally with Arrow 25.0.0 and AppleClang. All 
1050 tests pass, and the remaining 33 are the format-version variants that were 
already skipped. This includes the new `ReachableFileUtilTest` cases and every 
existing `ExpireSnapshots*` test.
   - `pre-commit` passes, including the regenerated 
`cpp20_compatibility_internal.h`.
   - Not verified locally: GCC, MSVC, the `ICEBERG_CXX20_COMPAT` build, and the 
other test executables. CI covers these.
   
   Known limitations, out of scope here:
   - `TableMetadataUtil::Read` rejects v1 metadata that lists manifests inline 
without a `manifest-list`. The recursive walk skips such files.
   - `RunTasksParallel` does not wait for tasks the executor already accepted 
if a later `Executor::Submit` throws. That code is shared with the existing 
callers and is unchanged by this PR.
   
   AI disclosure: Claude Code (Claude Opus) wrote the code, tests, and this 
description. It was reviewed by a Claude subagent and by OpenAI Codex (`codex 
review`) over several rounds, and their findings were addressed. The human 
contributor will state what they reviewed.
   


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