Skip to content

Commit f25cb50

Browse files
authored
disable hedging for s3 express (#602)
1 parent 4782ecb commit f25cb50

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

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
}

source/s3_meta_request.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,10 @@ void aws_s3_meta_request_send_request(struct aws_s3_meta_request *meta_request,
11881188
options.on_metrics = s_s3_meta_request_stream_metrics;
11891189
}
11901190
options.on_complete = s_s3_meta_request_stream_complete;
1191-
if (request->request_type == AWS_S3_REQUEST_TYPE_UPLOAD_PART) {
1191+
if (request->request_type == AWS_S3_REQUEST_TYPE_UPLOAD_PART && !meta_request->is_express) {
1192+
/* Note: For S3express, server responses random ETag. Killing the connection in the middle may cause server
1193+
* receive two same part and result in confusing during complete MPU with etag doesn't match.
1194+
* Disable the first byte timeout for s3 express. */
11921195
options.response_first_byte_timeout_ms = aws_atomic_load_int(&meta_request->client->upload_timeout_ms);
11931196
request->upload_timeout_ms = (size_t)options.response_first_byte_timeout_ms;
11941197
}

0 commit comments

Comments
 (0)