Skip to content

Commit 9e6d49b

Browse files
authored
Merge branch 'main' into update-rule-set
2 parents c9675b1 + 3f81fc9 commit 9e6d49b

File tree

6 files changed

+162
-35
lines changed

6 files changed

+162
-35
lines changed

include/aws/s3/private/s3_meta_request_impl.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct aws_s3_meta_request_event {
6666
/* data for AWS_S3_META_REQUEST_EVENT_RESPONSE_BODY */
6767
struct {
6868
struct aws_s3_request *completed_request;
69+
size_t bytes_delivered;
6970
} response_body;
7071

7172
/* data for AWS_S3_META_REQUEST_EVENT_PROGRESS */
@@ -224,12 +225,15 @@ struct aws_s3_meta_request {
224225

225226
/* Task for delivering events on the meta-request's io_event_loop thread.
226227
* We do this to ensure a meta-request's callbacks are fired sequentially and non-overlapping.
227-
* If `event_delivery_array` has items in it, then this task is scheduled.
228+
* If `event_delivery_task_scheduled` is true, then this task is scheduled.
228229
* If `event_delivery_active` is true, then this task is actively running.
229230
* Delivery is not 100% complete until `event_delivery_array` is empty AND `event_delivery_active` is false
230231
* (use aws_s3_meta_request_are_events_out_for_delivery_synced() to check) */
231232
struct aws_task event_delivery_task;
232233

234+
/* Whether or not event delivery is currently scheduled. */
235+
uint32_t event_delivery_task_scheduled : 1;
236+
233237
/* Array of `struct aws_s3_meta_request_event` to deliver when the `event_delivery_task` runs. */
234238
struct aws_array_list event_delivery_array;
235239

@@ -292,6 +296,10 @@ struct aws_s3_meta_request {
292296

293297
/* The range start for the next response body delivery */
294298
uint64_t next_deliver_range_start;
299+
300+
/* Total number of bytes that have been attempted to be delivered. (Will equal the sum of succeeded and
301+
* failed.)*/
302+
uint64_t num_bytes_delivery_completed;
295303
} io_threaded_data;
296304

297305
const bool should_compute_content_md5;

include/aws/s3/s3_client.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ struct aws_s3_client_config {
606606
*
607607
* WARNING: This feature is experimental.
608608
* Currently, backpressure is only applied to GetObject requests which are split into multiple parts,
609-
* and you may still receive some data after the window reaches 0.
609+
* - If you set body_callback, no more data will be delivered once the window reaches 0.
610+
* - If you set body_callback_ex, you may still receive some data after the window reaches 0. TODO: fix it.
610611
*/
611612
bool enable_read_backpressure;
612613

@@ -1220,7 +1221,8 @@ struct aws_future_void *aws_s3_meta_request_write(
12201221
*
12211222
* WARNING: This feature is experimental.
12221223
* Currently, backpressure is only applied to GetObject requests which are split into multiple parts,
1223-
* and you may still receive some data after the window reaches 0.
1224+
* - If you set body_callback, no more data will be delivered once the window reaches 0.
1225+
* - If you set body_callback_ex, you may still receive some data after the window reaches 0. TODO: fix it.
12241226
*/
12251227
AWS_S3_API
12261228
void aws_s3_meta_request_increment_read_window(struct aws_s3_meta_request *meta_request, uint64_t bytes);

source/s3_auto_ranged_put.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,11 @@ static void s_s3_auto_ranged_put_send_request_finish(
464464
struct aws_http_stream *stream,
465465
int error_code) {
466466
struct aws_s3_request *request = connection->request;
467-
if (request->request_tag == AWS_S3_AUTO_RANGED_PUT_REQUEST_TAG_PART) {
467+
if (request->request_tag == AWS_S3_AUTO_RANGED_PUT_REQUEST_TAG_PART && !request->meta_request->is_express) {
468468
/* TODO: the single part upload may also be improved from a timeout as multipart. */
469+
/* Note: For S3express, server responses random ETag. Killing the connection in the middle may cause server
470+
* receive two same part and result in confusing during complete MPU with etag doesn't match.
471+
* Disable the first byte timeout for s3 express. */
469472
aws_s3_client_update_upload_part_timeout(request->meta_request->client, request, error_code);
470473
}
471474
aws_s3_meta_request_send_request_finish_default(connection, stream, error_code);
@@ -1216,11 +1219,13 @@ static void s_s3_prepare_upload_part_finish(struct aws_s3_prepare_upload_part_jo
12161219
aws_s3_meta_request_lock_synced_data(meta_request);
12171220
struct aws_s3_mpu_part_info *part = NULL;
12181221
aws_array_list_get_at(&auto_ranged_put->synced_data.part_list, &part, request->part_number - 1);
1222+
/**
1223+
* 1. If request retries, get the checksum context from the previous attempt to reuse it. In case of the the
1224+
* request body in memory mangled
1225+
* 2. If this is the first attempt, the context is initialized from the previous prepare step.
1226+
**/
12191227
AWS_ASSERT(part != NULL && part->checksum_context != NULL);
1220-
/* Use checksum context if available, otherwise NULL for new parts */
12211228
checksum_context = part->checksum_context;
1222-
/* If checksum already calculated, it means either the part being retried or the part resumed from list
1223-
* parts. Keep reusing the old checksum in case of the request body in memory mangled */
12241229
aws_s3_meta_request_unlock_synced_data(meta_request);
12251230
}
12261231
/* END CRITICAL SECTION */

source/s3_checksum_context.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ struct aws_byte_cursor aws_s3_upload_request_checksum_context_get_checksum_curso
182182
return checksum_cursor;
183183
}
184184
s_lock_synced_data(context);
185-
/* If not previous calculated */
186185
if (context->synced_data.checksum_calculated) {
187186
checksum_cursor = aws_byte_cursor_from_buf(&context->synced_data.base64_checksum);
188187
}

0 commit comments

Comments
 (0)