apache / apache/iceberg-python

Remove deleted data files with expire_snapshots

Đang mở
#2,604 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
1.1k
Fork
581
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
78

Mô tả

### 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 :)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi hoạt động expire_snapshots và cách nó ghi lại metadata, sau đó kiểm tra việc xử lý các mục manifest được đánh dấu là đã xóa. Xác nhận hành vi dựa trên trường hợp xóa toàn bộ bảng được mô tả và các kiểm thử hiện có liên quan; công việc được xem là hoàn tất khi các tệp dữ liệu chỉ được các snapshot đã hết hạn tham chiếu bị xóa, còn các tệp vẫn cần cho các snapshot được giữ lại thì vẫn tồn tại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
databases
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.