djouallah opened a new issue, #2719:
URL: https://github.com/apache/iceberg-go/issues/2719

   ### Summary
   
   `maintenance.DeleteOrphanFiles` (and so the CLI's `iceberg 
clean-orphan-files`) treats every unreferenced file under the table location as 
an orphan, **including hidden paths** such as `_delta_log/`. Apache Iceberg's 
Java `DeleteOrphanFiles` action skips them (`PartitionAwareHiddenPathFilter`: 
any path segment starting with `_` or `.`, except a partition directory whose 
field name starts with `_`).
   
   That is data loss for any table whose location is shared with another 
format's metadata, which is now common:
   
   - **Microsoft Fabric / OneLake**: an Iceberg table written through the 
OneLake Iceberg REST catalog is also shown to Fabric engines (Direct Lake, 
Spark, SQL endpoint) as Delta, by a `_delta_log/` that OneLake keeps **inside 
the same table folder**.
   - **Apache XTable**: translates one format's metadata into another's in 
place, so `metadata/` (Iceberg), `_delta_log/` (Delta) and `.hoodie/` (Hudi) 
live side by side over the same data files.
   - **Delta Lake UniForm**: writes Iceberg `metadata/` next to the table's 
`_delta_log/`.
   
   None of those files are referenced by Iceberg metadata, so once they are 
older than `older-than` (default 72h) they are all candidates, and the run 
deletes them: the Delta (or Hudi) side of the table is gone, while Iceberg 
readers keep working, so nothing on the Iceberg side notices.
   
   ### Where
   
   `table/maintenance/orphan_cleanup.go`, `walkDirectory` (at b9a9bd92): every 
non-directory entry of `WalkDir(root)` is passed on, with no filter. 
`cmd/iceberg/clean_orphan_files.go` calls `DeleteOrphanFiles` with the 
defaults, so the CLI has no way to exclude them either.
   
   ### Expected
   
   Match Java: by default, skip any file with a path segment (relative to the 
table location) starting with `_` or `.`, keeping partition directories whose 
names start with `_` (Java's `PartitionAwareHiddenPathFilter`). Optionally an 
option to override the filter (e.g. `WithCleanupPathFilter(func(string) 
bool)`), and the CLI exposing it.
   
   ### Workaround
   
   What we do today: pass `WithCleanupDeleteFunc` and refuse to delete any path 
with a `_`/`.` segment. That only works for library users; the result still 
counts those files as orphans, and CLI users have no workaround.
   
   Found while running iceberg-go maintenance (compaction, expiry, orphan 
removal) on tables in OneLake. We reached this from reading the code (our 
delete func has always skipped hidden paths), not by losing a `_delta_log/`.
   


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