Retry "already landed" check fails for an overwrite of an empty table, then deletes the landed snapshot's manifests
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #4023 của @dancsi — đã đóng, không merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with Transaction.commit_transaction, especially the landed-snapshot check, and trace how Table.overwrite registers the delete and append producers. Use the reproduction in the issue to investigate the lost-response retry and cleanup behavior. Done means regression tests show the landed snapshot is recognized and its manifests remain available; the reporter says they already have a fix with tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Apache Iceberg version: 0.12.0 (also reproduced on main at ebbc0ba3e4)
Please describe the bug 🐞
After a failed attempt, Transaction.commit_transaction checks whether the attempt actually landed:
if all(
self._table.metadata.snapshot_by_id(producer._snapshot_id) is not None
for producer in self._snapshot_producers
):
A transaction can contain a producer that never creates a snapshot. Table.overwrite on an empty table (or any delete that matches nothing, followed by an append) registers a delete producer, but only the append produces an AddSnapshotUpdate. The delete producer's _snapshot_id never appears in the table, so the check is always false, even when the append landed.
pyiceberg then rebuilds and retries. On the rebuilt attempt, the delete producer's concurrency validation sees the transaction's own landed append as a concurrent conflicting write, and raises ValidationException. That goes to _clean_all_uncommitted(), which deletes the manifest list and manifests of the snapshot that landed.
Reproduction
import tempfile
import pyarrow as pa
from pyiceberg.catalog.sql import SqlCatalog
from pyiceberg.exceptions import CommitFailedException
from pyiceberg.schema import Schema
from pyiceberg.types import LongType, NestedField
warehouse = tempfile.mkdtemp()
catalog = SqlCatalog("default", uri=f"sqlite:///{warehouse}/catalog.db", warehouse=f"file://{warehouse}")
catalog.create_namespace("default")
table = catalog.create_table(
"default.t",
Schema(NestedField(1, "a", LongType(), required=False)),
properties={"commit.retry.min-wait-ms": "0"},
)
# The catalog applies the first commit, but the client sees a failure.
commit_table = catalog.commit_table
calls = 0
def commit_table_lose_first_response(*args):
global calls
calls += 1
response = commit_table(*args)
if calls == 1:
raise CommitFailedException("simulated lost response")
return response
catalog.commit_table = commit_table_lose_first_response
try:
table.overwrite(pa.table({"a": pa.array([1, 2, 3], pa.int64())}))
except Exception as e:
print(f"overwrite raised: {type(e).__name__}: {e}")
table = catalog.load_table("default.t")
snapshot = table.current_snapshot()
print("manifest list exists:", table.io.new_input(snapshot.manifest_list).exists())
table.scan().to_arrow()
Output:
Commit failed due to a concurrent update, retrying (1/4) in 0 ms
overwrite raised: ValidationException: Added data files were found matching the filter for snapshots set()!
manifest list exists: False
FileNotFoundError: [Errno 2] Failed to open local file '.../metadata/snap-...avro'
The same overwrite with a response that isn't lost succeeds, and a plain append with a lost first response is correctly detected as landed.
Suggested fix
Base the check on the snapshots the attempt actually tried to add, i.e. the AddSnapshotUpdates in self._updates, rather than on every producer. Equivalently, skip producers that didn't produce a snapshot. Ideally, a ValidationException raised during a rebuild should also never clean up a snapshot that is present in the refreshed metadata.
Related: #4021, which covers the missing check on the last attempt.
Willingness to contribute
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
I have a fix with regression tests for both this and #4021: it keys the landed check on the AddSnapshotUpdate snapshot ids that were sent, and runs it after every CommitFailedException, including on the last attempt. I'm happy to open a PR.
- Ngôn ngữ chính
- Python
- Star
- 1.2k
- Fork
- 654
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 122
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/iceberg-python
-
`inspect.files()` and the other file metadata tables raise `ArrowInvalid` when a snapshot has no manifestsCó thể đã có người làm @YuangGao đã nhận 10 ngày trước. Đang mởkind:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/iceberg-python#4269 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`inspect.entries()` raises TypeError when a data file has no column_sizesCó thể đã có người làm @Rahul-cs50 đã nhận 14 ngày trước. Đang mởkind:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/iceberg-python#4186 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`older_than` reads a naive datetime as UTC and expires snapshots it should keepCó thể đã có người làm @Rahul-cs50 đã nhận 13 ngày trước. Đang mởkind:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/iceberg-python#4182 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
REST: Send empty first-page pageToken when rest-page-size is setCó thể đã có người làm @ehddnr301 đã nhận 32 ngày trước. Đang mởkind:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/iceberg-python#4096 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PyArrowFileIO: every small S3 write is a 3-request multipart upload; expose allow_delayed_openCó thể đã có người làm @David-Banquet đã nhận 29 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
apache/iceberg-python#4093 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/iceberg-python
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
glossyio/traffic-monitor#312 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
local devenv exampleĐang mởdocumentation enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
es-ude/elastic-ai.creator#1046 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
ENH: permit cachetools >= 7Đang mởfeature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
confident-ai/deepteam#306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL portsCó thể đã có người làm @himanchalkaushale đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
OWASP/Nettacker#1884 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày