PyArrowFileIO: every small S3 write is a 3-request multipart upload; expose allow_delayed_open
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 70/100
調査の方向性
issueで指摘されている PyArrowFileIO の _initialize_s3_fs から始めてください。ここでは固定のプロパティ群からS3ファイルシステムが構築されます。既存の s3.* プロパティがどのように読み取られ、渡されているかを確認してください。s3.allow-delayed-open プロパティを追加し、インストールされているpyarrowが21以降の場合にのみ allow_delayed_open を渡し、issueの提案どおりデフォルトを true にしてください。小さな書き込みが1回の 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時間
- マージ済み PR(30日)
- 71
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
メンテナーはふだん 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:space-accuracy good first issue track:data
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
Sara-Managed-Projects/space-radar#904 ·
メンテナーはふだん 1 日以内に返信