Problem / Context
In #3165 (reviving #2257 for #2259), the foundational ObjectStoreStorage::S3 backend is established. To ensure production robustness and performance in the write pipeline, several edge cases and optimizations should be addressed as follow-up work:
Proposed Improvements
-
Zero-Copy Writes in ObjectStoreWriter:
FileWrite::write receives owned bytes::Bytes.
object_store::WriteMultipart provides a put(Bytes) method that buffers without slice copying, avoiding redundant extend_from_slice allocations.
-
S3 URL Boundary Validation:
- Empty bucket strings (e.g.
s3:///path/to/file or s3://) currently pass initial URL host parsing as "". These should explicitly return ErrorKind::DataInvalid.
- Ensure paths without trailing slashes (
s3://bucket) extract bucket and empty relative path cleanly.
-
Stream Handling & State Machine Guards:
- Validate
delete_stream on empty streams (futures::stream::empty()) and ensure immediate error propagation on invalid URLs.
- Add unit test coverage for
ObjectStoreWriter state guards (e.g., verifying close() and write() error handling after writer has been closed).
-
Backpressure & Memory Throttling:
- For high-throughput streaming, evaluate
WriteMultipart::wait_for_capacity to throttle producers and prevent unbounded 5MB chunk allocations in memory ahead of S3 network uploads.
Related
AI Disclosure
Drafted with AI assistance; reviewed and verified by contributor.
Problem / Context
In #3165 (reviving #2257 for #2259), the foundational
ObjectStoreStorage::S3backend is established. To ensure production robustness and performance in the write pipeline, several edge cases and optimizations should be addressed as follow-up work:Proposed Improvements
Zero-Copy Writes in
ObjectStoreWriter:FileWrite::writereceives ownedbytes::Bytes.object_store::WriteMultipartprovides aput(Bytes)method that buffers without slice copying, avoiding redundantextend_from_sliceallocations.S3 URL Boundary Validation:
s3:///path/to/fileors3://) currently pass initial URL host parsing as"". These should explicitly returnErrorKind::DataInvalid.s3://bucket) extractbucketand empty relative path cleanly.Stream Handling & State Machine Guards:
delete_streamon empty streams (futures::stream::empty()) and ensure immediate error propagation on invalid URLs.ObjectStoreWriterstate guards (e.g., verifyingclose()andwrite()error handling after writer has been closed).Backpressure & Memory Throttling:
WriteMultipart::wait_for_capacityto throttle producers and prevent unbounded 5MB chunk allocations in memory ahead of S3 network uploads.Related
AI Disclosure
Drafted with AI assistance; reviewed and verified by contributor.