PyArrowFileIO: every small S3 write is a 3-request multipart upload; expose allow_delayed_open
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 70/100
Direção de pesquisa
Comece em _initialize_s3_fs no PyArrowFileIO, onde o sistema de arquivos S3 é construído a partir de um conjunto fixo de propriedades. Veja como as propriedades s3.* existentes são lidas e repassadas. Adicione a propriedade s3.allow-delayed-open, passe allow_delayed_open somente quando o pyarrow instalado for a versão 21 ou posterior e use true como padrão, conforme proposto na issue. Está pronto quando gravações pequenas são enviadas como um único PutObject e a opção fica ausente com pyarrow mais antigo.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Python
- Estrelas
- 1.2k
- Forks
- 618
- Merge médio
- 1d 19h
- PRs com merge (30d)
- 51
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/iceberg-python
-
View does not expose metadata_location: RestCatalog.load_view discards it from the server's responseTalvez já em andamento @Soumo-git-hub assumiu há 5 dias. Abertakind:bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
apache/iceberg-python#4073 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
apache/iceberg-python#4010 · 3 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
to_bytes silently rescales a Decimal with a negative scaleTalvez já em andamento @Rodrigo-Palma assumiu há 24 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/iceberg-python#3996 ·
Mantenedores costumam responder em até 1 dia
-
Deletion vector bitmap count is read from the blob and used as a loop bound without validationTalvez já em andamento @ghoshp83 assumiu há 25 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/iceberg-python#3979 ·
Mantenedores costumam responder em até 1 dia
-
FsspecFileIO: `_adls` mutates shared properties, so a second storage account gets the first account's filesystemTalvez já em andamento @krishnakaanchan-png assumiu há 42 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/iceberg-python#3885 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de apache/iceberg-python
Issues semelhantes
-
Consolidate the now-identical CLI-native and composed tasks_packages guards (#5945 follow-up)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
spec-kitty/spec-kitty#6112 ·
Mantenedores costumam responder em até 1 dia
-
[Bug]: OpenRouter streaming chunks report the requested router name instead of the model OpenRouter servedTalvez já em andamento @Mrun25 assumiu hoje. Abertabug llm translation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
BerriAI/litellm#46095 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
uberdeveloper/fastbt#29 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
andrew-blake/melcloudhome#368 ·
Mantenedores costumam responder em até 1 dia
-
lane:discover
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
SPARDiffData/differential-data-collection#33 ·
Mantenedores costumam responder em até 1 dia