apache / apache/iceberg-python

Remove deleted data files with expire_snapshots

オープン
#2,604 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
1.1k
フォーク
581
平均マージ
1日 17時間
マージ済み PR(30日)
77

説明

### Feature Request / Improvement

Running an expire snapshots operation will only rewrite the metadata file without the expired snapshots (and refs/ statistics). It does not delete deleted data files referenced only by the expired snapshots. This can be observed by deleting an entire table and calling `expire_snapshots` - the data files still exist. Trino and spark both clean up deleted data files when all snapshots referencing them are expired.

From the spec:
```
When a file is replaced or deleted from the dataset, its manifest entry fields store the snapshot ID
in which the file was deleted and status 2 (deleted). The file may be deleted from the file system
when the snapshot in which it was deleted is garbage collected, assuming that older snapshots
have also been garbage collected [1].
...
1. Technically, data files can be deleted when the last snapshot that contains the file as “live” data is
garbage collected. But this is harder to detect and requires finding the diff of multiple snapshots. It
is easier to track what files are deleted in a snapshot and delete them when that snapshot expires.
It is not recommended to add a deleted file back to a table. Adding a deleted file can lead to edge
cases where incremental deletes can break table snapshots.
```

Happy to work on this if others agree that it should be added :)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず expire_snapshots 操作と、それがメタデータを書き換える方法を追跡し、次に削除済みとしてマークされた manifest エントリの処理を調べます。説明されているテーブル全体の削除ケースおよび関連する既存のテストに照らして動作を確認します。完了の条件は、期限切れのスナップショットからのみ参照されるデータファイルが削除され、保持されたスナップショットにまだ必要なファイルは残ることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
databases
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。