PyArrowFileIO: every small S3 write is a 3-request multipart upload; expose allow_delayed_open
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
從 PyArrowFileIO 中的 _initialize_s3_fs 開始,它會根據一組固定的屬性建立 S3 檔案系統。查看現有 s3.* 屬性是如何讀取和傳遞的。新增 s3.allow-delayed-open 屬性,僅當已安裝的 pyarrow 為 21 或更高版本時才傳遞 allow_delayed_open,並依 issue 的建議將預設值設為 true。當小寫入以單一 PutObject 發出,且舊版 pyarrow 中不存在該選項時,即為完成。
由索引模型根據 Issue 內容生成。
描述
Apache Iceberg version
0.12.0 (also on main)
Please describe the bug 🐞
PyArrowFileIO writes every S3 object as a multipart upload, however small it is. pyarrow's S3FileSystem.open_output_stream starts a multipart upload as soon as the stream opens (apache/arrow#51029). Each metadata.json, manifest list, manifest, version-hint.text and small data file therefore costs three requests: CreateMultipartUpload, UploadPart and CompleteMultipartUpload. All three are billed as writes, even for a 1-byte object.
pyarrow's S3FileSystem has an option for this, allow_delayed_open, since pyarrow 21. With it set, a stream that closes before reaching a part's size is sent as a single PutObject, and a larger one is still a multipart upload. _initialize_s3_fs builds the filesystem from a fixed set of properties, though, so there's no way to set the option through FileIO properties.
The cost is real for a table that commits often. Each commit writes several small metadata objects, so it makes about three times the write requests it needs.
Repro
Run against any S3-compatible endpoint (this was run against a local rustfs):
import pyarrow.fs as fs
from pyiceberg.io.pyarrow import PyArrowFileIO
fs.initialize_s3(fs.S3LogLevel.Debug) # logs each request
io = PyArrowFileIO({
"s3.endpoint": "http://127.0.0.1:9000",
"s3.access-key-id": "...",
"s3.secret-access-key": "...",
"s3.region": "us-east-1",
})
with io.new_output("s3://bucket/version-hint.text").create(overwrite=True) as f:
f.write(b"1")
The debug log shows three requests for the one byte:
POST /bucket/version-hint.text?uploads
PUT /bucket/version-hint.text?partNumber=1&uploadId=...
POST /bucket/version-hint.text?uploadId=...
When the same write goes through an S3FileSystem built with allow_delayed_open=True, the log shows a single PUT /bucket/version-hint.text.
Proposal
Pass allow_delayed_open in _initialize_s3_fs, controlled by a FileIO property such as s3.allow-delayed-open. I'd suggest defaulting it to true, since it only changes how small objects are uploaded. pyiceberg supports pyarrow 18 and up, so the option would be passed only on pyarrow 21 or later.
The workaround today is to subclass PyArrowFileIO, override _initialize_s3_fs, and rebuild the filesystem with the option added. That depends on a private method.
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
- 主要語言
- Python
- 星號
- 1.2k
- 分支
- 618
- 平均合併
- 1 天 10 小時
- 30 天內合併 PR
- 71
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
apache/iceberg-python 的其他 Issue
-
Replace `__slots__ = (field1,field2,...)` with `slots=True`可能已有人在做 @med9110 於 2 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
apache/iceberg-python#4086 · 3 則留言 ·
維護者通常 1 天內回覆
-
View does not expose metadata_location: RestCatalog.load_view discards it from the server's response可能已有人在做 @Soumo-git-hub 於 3 天前認領。 未關閉kind:bug
難度 2/5 1-3 小時 新手友好度 84/100
apache/iceberg-python#4073 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
apache/iceberg-python#4010 · 3 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
to_bytes silently rescales a Decimal with a negative scale可能已有人在做 @Rodrigo-Palma 於 22 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
apache/iceberg-python#3996 ·
維護者通常 1 天內回覆
-
Deletion vector bitmap count is read from the blob and used as a loop bound without validation可能已有人在做 @ghoshp83 於 23 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 72/100
apache/iceberg-python#3979 ·
維護者通常 1 天內回覆
查看 apache/iceberg-python 的全部 Issue
相似的 Issue
-
area: desktop area: website priority: P2 type: feature
難度 2/5 1-3 小時 新手友好度 62/100
appandflow/stim#3411 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1 小時以內 新手友好度 88/100
baptistehamon/lsapy#185 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
PolicyEngine/policyengine-us#10073 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
syedhamidali/radarx#277 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
Arekkazu/sgpmp-backend#549 ·
維護者通常 1 天內回覆