-
Notifications
You must be signed in to change notification settings - Fork 50
Dynamic default part size #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #575 +/- ##
==========================================
+ Coverage 88.97% 89.12% +0.14%
==========================================
Files 23 23
Lines 7201 7336 +135
==========================================
+ Hits 6407 6538 +131
- Misses 794 798 +4
🚀 New features to boost your workflow:
|
|
|
||
| include(CTest) | ||
| if (BUILD_TESTING) | ||
| add_definitions(-DAWS_C_S3_ENABLE_TEST_STUBS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any concern adding this def here? Or it's better to keep as a separate one.
pro: Nothing will break.
con: Maybe people built with tests in prod and don't want to have this stub enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we enable this ourselves when we package java, python, etc...?
probably not a big concern in practice, it add a private api. we already expose a bunch of private apis used by tests only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/awslabs/aws-crt-python/blob/main/crt/CMakeLists.txt#L26
https://github.com/awslabs/aws-crt-java/blob/main/pom.xml#L185
Yeah, we do set this to off when we build the bindings.
Also, we should not build the C tests when we package for the CRT bindings.
…ata delivery in the sequential order
| bool memory_allocated_from_pool; | ||
| } crt_info_metrics; | ||
|
|
||
| struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking out loud:
maybe we should unify this with
| struct aws_s3_mpu_part_info { |
we can probably do some of the same sanity checks in upload path as well
|
|
||
| if (aws_http_headers_get(request->send_data.response_headers, g_etag_header_name, &etag_header_value)) { | ||
| if (!auto_ranged_get->initial_message_has_if_match_header) { | ||
| /* Store ETag if needed for If-Match header */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why only if needed? isnt it easier to just always store it (i.e. the old way)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the old way also only store the etag when initial_message_has_if_match_header is false.
| AWS_PRECONDITION(response_headers); | ||
|
|
||
| struct aws_byte_cursor content_range_header_value; | ||
| /* Expected Format of header is: "bytes StartByte-EndByte/TotalObjectSize" */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does s3 always respect that or there are cases where it skips start and end (which is valid in http spec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://httpwg.org/specs/rfc9110.html#field.content-range
I don't think the Spec supports skipping those for a success response. Not like Range to be sent for the request. The Content-range in the response will need to have both start and end for a range-resp
source/s3_util.c
Outdated
|
|
||
| int aws_s3_extract_parts_from_etag(struct aws_byte_cursor etag_header_value, uint32_t *out_num_parts) { | ||
|
|
||
| AWS_PRECONDITION(out_num_parts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets do AWS_ERROR_PRECONDITION here and in other places
source/s3_util.c
Outdated
| while (aws_byte_cursor_next_split(&remaining_cursor, '-', &substr)) { | ||
| split_count++; | ||
| if (split_count == 2) { | ||
| /* The ETag should follow the pattern <hash>-<parts_count>, so the second part is the parts count. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while its should be the case in most cases, the spec we have from s3 for etag is -.
value in theory can contain dashes. we should find - from the back and try to parse from that until the end as a number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to confirm this with S3, if the value contains -, find it from the back will still result in unexpected behaviors.
As far as I find, the etag value should be a hash value? So it should not contain -
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather to force the etag to be exactly have one or less - in it. So that if it's not the expected format, we will error out and fallback, instead of reading from the back try to parse the case where it's not formatted as expect.
Co-authored-by: Dmitriy Musatkin <[email protected]>
Issue #, if available:
<hash>-<number of part>, so that we can have an estimated part size that S3 stores the object.Description of changes:
TODO:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.