diff --git a/include/aws/s3/s3.h b/include/aws/s3/s3.h index c487d8cd6..896ea93e9 100644 --- a/include/aws/s3/s3.h +++ b/include/aws/s3/s3.h @@ -43,7 +43,7 @@ enum aws_s3_errors { AWS_ERROR_S3_FILE_MODIFIED, AWS_ERROR_S3_EXCEEDS_MEMORY_LIMIT, AWS_ERROR_S3_INVALID_MEMORY_LIMIT_CONFIG, - AWS_ERROR_S3_PART_SIZE_MISMATCH, + AWS_ERROR_S3_GET_PART_SIZE_MISMATCH, AWS_ERROR_S3_END_RANGE = AWS_ERROR_ENUM_END_RANGE(AWS_C_S3_PACKAGE_ID) }; diff --git a/source/s3.c b/source/s3.c index 96be51996..6e6154633 100644 --- a/source/s3.c +++ b/source/s3.c @@ -44,7 +44,7 @@ static struct aws_error_info s_errors[] = { AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_EXCEEDS_MEMORY_LIMIT, "Request was not created due to used memory exceeding memory limit."), AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_INVALID_MEMORY_LIMIT_CONFIG, "Specified memory configuration is invalid for the system. " "Memory limit should be at least 1GiB. Part size and max part size should be smaller than memory limit."), - AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_PART_SIZE_MISMATCH, "Request body length is not equal to the part_size."), + AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_GET_PART_SIZE_MISMATCH, "Request body length is not equal to the part_size."), }; /* clang-format on */ diff --git a/source/s3_auto_ranged_get.c b/source/s3_auto_ranged_get.c index 51e80cd6e..c663bb042 100644 --- a/source/s3_auto_ranged_get.c +++ b/source/s3_auto_ranged_get.c @@ -552,7 +552,7 @@ static int s_discover_object_range_and_content_length( case AWS_S3_AUTO_RANGE_GET_REQUEST_TYPE_GET_PART_NUMBER: AWS_ASSERT(request->part_number == 1); - if (error_code != AWS_ERROR_SUCCESS && error_code != AWS_ERROR_S3_PART_SIZE_MISMATCH) { + if (error_code != AWS_ERROR_SUCCESS && error_code != AWS_ERROR_S3_GET_PART_SIZE_MISMATCH) { /* If we hit an empty file while trying to discover the object-size via part, then this request failure * is as designed. */ @@ -720,7 +720,7 @@ static void s_s3_auto_ranged_get_request_finished( case AWS_S3_AUTO_RANGE_GET_REQUEST_TYPE_GET_PART_NUMBER: auto_ranged_get->synced_data.get_first_part_completed = true; AWS_LOGF_DEBUG(AWS_LS_S3_META_REQUEST, "id=%p Get Part Number completed.", (void *)meta_request); - if (error_code == AWS_ERROR_S3_PART_SIZE_MISMATCH && found_object_size) { + if (error_code == AWS_ERROR_S3_GET_PART_SIZE_MISMATCH && found_object_size) { /* Try to fetch the first part again as a ranged get */ break; } diff --git a/source/s3_meta_request.c b/source/s3_meta_request.c index 4ca8ef9b1..a91ffe822 100644 --- a/source/s3_meta_request.c +++ b/source/s3_meta_request.c @@ -1287,7 +1287,7 @@ static int s_s3_meta_request_headers_block_done( if (content_length > meta_request->part_size || (content_length < meta_request->part_size && aws_http_headers_has(request->send_data.response_headers, g_mp_parts_count_header_name))) { - return aws_raise_error(AWS_ERROR_S3_PART_SIZE_MISMATCH); + return aws_raise_error(AWS_ERROR_S3_GET_PART_SIZE_MISMATCH); } } } @@ -1539,7 +1539,7 @@ void aws_s3_meta_request_send_request_finish_default( /* If the request failed due to an invalid (ie: unrecoverable) response status, or the meta request already * has a result, then make sure that this request isn't retried. */ // TODO: expected error, don't log at error - if (error_code == AWS_ERROR_S3_INVALID_RESPONSE_STATUS || error_code == AWS_ERROR_S3_PART_SIZE_MISMATCH || + if (error_code == AWS_ERROR_S3_INVALID_RESPONSE_STATUS || error_code == AWS_ERROR_S3_GET_PART_SIZE_MISMATCH || error_code == AWS_ERROR_S3_NON_RECOVERABLE_ASYNC_ERROR || meta_request_finishing) { finish_code = AWS_S3_CONNECTION_FINISH_CODE_FAILED; diff --git a/tests/s3_data_plane_tests.c b/tests/s3_data_plane_tests.c index 5cefb0def..28a6446e0 100644 --- a/tests/s3_data_plane_tests.c +++ b/tests/s3_data_plane_tests.c @@ -3742,8 +3742,6 @@ static int s_test_s3_download_multi_part_file_with_checksum(struct aws_allocator /*** GET FILE with part_size > first_part_size ***/ client_options.part_size = MB_TO_BYTES(7); - // TODO: Discuss this case where partSize > fileSize - // client_options.part_size = MB_TO_BYTES(20); ASSERT_SUCCESS(aws_s3_tester_client_new(&tester, &client_options, &client)); get_options.client = client; @@ -3753,7 +3751,6 @@ static int s_test_s3_download_multi_part_file_with_checksum(struct aws_allocator /*** GET FILE with part_size = first_part_size ***/ client_options.part_size = MB_TO_BYTES(5); - // client_options.part_size = MB_TO_BYTES(10); ASSERT_SUCCESS(aws_s3_tester_client_new(&tester, &client_options, &client)); get_options.client = client;