dor-bernstein opened a new pull request, #4518:
URL: https://github.com/apache/iceberg-python/pull/4518

   # Rationale for this change
   
   `PyArrowFileIO` builds `pyarrow.fs.S3FileSystem` without 
`allow_delayed_open`, which defaults to `False`. With that default, Arrow's S3 
output stream calls `CreateMultipartUpload` as soon as a file is opened 
([`s3fs.cc`](https://github.com/apache/arrow/blob/main/cpp/src/arrow/filesystem/s3fs.cc),
 `ObjectOutputStream::Init`). Every object pyiceberg writes, including a 2 KB 
manifest list, then costs three requests: `CreateMultipartUpload`, `UploadPart` 
and `CompleteMultipartUpload`.
   
   With `allow_delayed_open=True`, Arrow defers the upload, and objects under 
the 10 MiB part size are sent as a single `PutObject` on close. Manifests, 
manifest lists and `metadata.json` are almost always under that size, so on a 
write-heavy table this cuts the S3 write requests of a commit by roughly 
two-thirds. We measured this in S3 server access logs: about 1.07 parts per 
multipart upload, so the Create/Complete pair is nearly all overhead.
   
   This PR adds an `s3.allow-delayed-open` FileIO property that is passed 
through to `S3FileSystem` for `s3://` and `oss://`. pyarrow exposes the option 
from 21.0.0, so the property uses the same version guard as `s3.ssl.ca-cert`. 
When it is unset, nothing changes.
   
   The trade-off, from the pyarrow docs, is that errors that would surface on 
open, such as a missing bucket, are reported on write or close instead.
   
   ## Are these changes tested?
   
   Yes. There are unit tests in `tests/io/test_pyarrow.py` for:
   - `true` / `false` reaching `S3FileSystem` for `s3://`, and `true` for 
`oss://`
   - the kwarg being left out when the property is unset
   - an `ImportError` on pyarrow < 21
   
   ## Are there any user-facing changes?
   
   Yes: a new optional FileIO property, `s3.allow-delayed-open`, documented in 
`configuration.md`. The default behavior is unchanged.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to