diff --git a/docs/memory_aware_request_execution.md b/docs/memory_aware_request_execution.md index 13d8cd2e1..66c7a7daf 100644 --- a/docs/memory_aware_request_execution.md +++ b/docs/memory_aware_request_execution.md @@ -16,7 +16,7 @@ put or get, breaks it into smaller part-sized requests and executes those in parallel. CRT S3 client used to allocate part sized buffer for each of those requests and release it right after the request was done. That approach, resulted in a lot of very short lived allocations and allocator thrashing, -overall leading to memory use spikes considerably higher than whats needed. To +overall leading to memory use spikes considerably higher than what's needed. To address that, the client is switching to a pooled buffer approach, discussed below. diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index e23ea9f47..411000a6a 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -672,7 +672,7 @@ struct aws_s3_client_config { */ aws_s3_buffer_pool_factory_fn *buffer_pool_factory_fn; - /* User data thats passed into pool factory. */ + /* User data that's passed into pool factory. */ void *buffer_pool_user_data; }; diff --git a/source/s3.c b/source/s3.c index 38020b087..f298f38e8 100644 --- a/source/s3.c +++ b/source/s3.c @@ -38,7 +38,7 @@ static struct aws_error_info s_errors[] = { AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_LIST_PARTS_PARSE_FAILED, "Failed to parse response from ListParts"), AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_RESUMED_PART_CHECKSUM_MISMATCH, "Checksum does not match previously uploaded part"), AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_RESUME_FAILED, "Resuming request failed"), - AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_OBJECT_MODIFIED, "The object modifed during download."), + AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_OBJECT_MODIFIED, "The object modified during download."), AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_NON_RECOVERABLE_ASYNC_ERROR, "Async error received from S3 and not recoverable from retry."), AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_METRIC_DATA_NOT_AVAILABLE, "The metric data is not available, the requests ends before the metric happens."), AWS_DEFINE_ERROR_INFO_S3(AWS_ERROR_S3_INCORRECT_CONTENT_LENGTH, "Request body length must match Content-Length header."), diff --git a/source/s3_auto_ranged_get.c b/source/s3_auto_ranged_get.c index 6eeed8774..ce9e4880e 100644 --- a/source/s3_auto_ranged_get.c +++ b/source/s3_auto_ranged_get.c @@ -608,8 +608,8 @@ static int s_discover_object_range_and_size( break; } - /* if the inital message had a ranged header, there should also be a Content-Range header that specifies the - * object range and total object size. Otherwise, the size and range should be equal to the + /* if the initial message had a ranged header, there should also be a Content-Range header that specifies + * the object range and total object size. Otherwise, the size and range should be equal to the * total_content_length. */ if (!auto_ranged_get->initial_message_has_range_header) { object_size = content_length; diff --git a/source/s3_client.c b/source/s3_client.c index 7875542f9..2e95daf47 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -94,7 +94,7 @@ static const size_t s_buffer_pool_trim_time_offset_in_s = 5; static const uint32_t s_endpoints_cleanup_time_offset_in_s = 5; /** - * The envrionment variable name for memory limit control. + * The environment variable name for memory limit control. */ static const char *s_memory_limit_env_var = "AWS_CRT_S3_MEMORY_LIMIT_IN_GIB"; @@ -170,7 +170,7 @@ static uint32_t s_get_ideal_connection_number_from_throughput(double throughput_ /* Returns the max number of connections allowed. * - * When meta request is NULL, this will return the overall allowed number of connections based on the clinet + * When meta request is NULL, this will return the overall allowed number of connections based on the client * configurations. * * If meta_request is not NULL, this will return the number of connections allowed based on the meta request @@ -331,7 +331,7 @@ struct aws_s3_client *aws_s3_client_new( } uint64_t mem_limit_configured = 0; if (client_config->memory_limit_in_bytes == 0) { - /* Try to read from the envrionment variable for memory limit */ + /* Try to read from the environment variable for memory limit */ struct aws_string *memory_limit_from_env_var = aws_get_env_nonempty(allocator, s_memory_limit_env_var); if (memory_limit_from_env_var) { uint64_t mem_limit_in_gib = 0; @@ -340,7 +340,7 @@ struct aws_s3_client *aws_s3_client_new( aws_string_destroy(memory_limit_from_env_var); AWS_LOGF_ERROR( AWS_LS_S3_CLIENT, - "Cannot create client from client_config; envrionment variable: %s, is not set correctly, only " + "Cannot create client from client_config; environment variable: %s, is not set correctly, only " "integers supported.", s_memory_limit_env_var); aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); @@ -348,13 +348,13 @@ struct aws_s3_client *aws_s3_client_new( } aws_string_destroy(memory_limit_from_env_var); uint64_t mem_limit_in_bytes = 0; - /* Covert mem_limit_in_gib to bytes */ + /* Convert mem_limit_in_gib to bytes */ if (aws_mul_u64_checked(mem_limit_in_gib, 1024, &mem_limit_in_bytes) || aws_mul_u64_checked(mem_limit_in_bytes, 1024, &mem_limit_in_bytes) || aws_mul_u64_checked(mem_limit_in_bytes, 1024, &mem_limit_in_bytes)) { AWS_LOGF_ERROR( AWS_LS_S3_CLIENT, - "Cannot create client from client_config; envrionment variable: %s, overflow detected.", + "Cannot create client from client_config; environment variable: %s, overflow detected.", s_memory_limit_env_var); aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); return NULL; @@ -1433,7 +1433,7 @@ static struct aws_s3_meta_request *s_s3_client_meta_request_factory_default( if (num_parts > 2) { uint64_t aligned_part_size = aws_s3_buffer_pool_derive_aligned_buffer_size(client->buffer_pool, part_size); - /* Incase of overflow, fallback to no alignment. */ + /* In case of overflow, fallback to no alignment. */ aligned_part_size = aligned_part_size > SIZE_MAX ? part_size : aligned_part_size; part_size = (size_t)aligned_part_size; /* update the number of parts as well. */ @@ -2180,7 +2180,7 @@ void aws_s3_client_update_meta_requests_threaded(struct aws_s3_client *client) { /** * When upload with streaming, the prepare stage will not read into buffer. - * But it should prevent more requests to be preapred so that the request will not staying in the + * But it should prevent more requests to be prepared so that the request will not stay in the * queue to wait for the connection available. Prevents the credentials to be expired during waiting * for too long. */ diff --git a/source/s3_default_buffer_pool.c b/source/s3_default_buffer_pool.c index a22319d12..1a55e15cb 100644 --- a/source/s3_default_buffer_pool.c +++ b/source/s3_default_buffer_pool.c @@ -576,11 +576,11 @@ static bool s_should_trim_for_reserve_synced( } size_t primary_overallocation = aws_sub_size_saturating(buffer_pool->primary_allocated, buffer_pool->primary_used); - /* Reserved can be more tha allocated */ + /* Reserved can be more than allocated */ primary_overallocation = aws_sub_size_saturating(primary_overallocation, buffer_pool->primary_reserved); size_t special_overallocation = aws_sub_size_saturating(buffer_pool->special_blocks_allocated, buffer_pool->special_blocks_used); - /* Reserved can be more tha allocated */ + /* Reserved can be more than allocated */ special_overallocation = aws_sub_size_saturating(special_overallocation, buffer_pool->special_blocks_reserved); size_t total_overallocation = aws_add_size_saturating(special_overallocation, primary_overallocation); diff --git a/source/s3_default_meta_request.c b/source/s3_default_meta_request.c index 7953b577b..fa1826b2b 100644 --- a/source/s3_default_meta_request.c +++ b/source/s3_default_meta_request.c @@ -365,7 +365,7 @@ static void s_s3_default_prepare_request_finish( struct aws_s3_upload_request_checksum_context *checksum_context = NULL; /** - * Note: CompleteMPU is unique in the sence that checksum on the object level is the full object checksum for + * Note: CompleteMPU is unique in the sense that checksum on the object level is the full object checksum for * all parts and not checksum of the body. So avoid any additional checksum handling if default req is * completeMPU. */ diff --git a/source/s3_part_streaming_input_stream.c b/source/s3_part_streaming_input_stream.c index 71f6b28fa..f0393fc08 100644 --- a/source/s3_part_streaming_input_stream.c +++ b/source/s3_part_streaming_input_stream.c @@ -40,8 +40,8 @@ struct aws_s3_part_streaming_input_stream_impl { size_t chunk_load_size; /* The reading counters */ - /* Incase the `offset` is not aligned with page size. The offset - page_aligned_offset will be aligned the page size - * to load the chunk. And read from the chunk can start from this `page_aligned_offset` */ + /* In case the `offset` is not aligned with page size. The offset - page_aligned_offset will be aligned the page + * size to load the chunk. And read from the chunk can start from this `page_aligned_offset` */ size_t page_aligned_offset; /* The offset of the chunk in the `reading_chunk_buf` that will start reading. */ size_t in_chunk_offset; @@ -92,7 +92,7 @@ static void s_kick_off_next_load(struct aws_s3_part_streaming_input_stream_impl /* Align the remaining length with the page size. */ if (remaining_length < impl->chunk_load_size) { size_t aligned_remaining_length = remaining_length % impl->page_size; - /* Read more tha needed to align with the page size. */ + /* Read more than needed to align with the page size. */ if (aligned_remaining_length > 0) { remaining_length = remaining_length + impl->page_size - aligned_remaining_length; AWS_LOGF_TRACE( diff --git a/tests/s3_mock_server_tests.c b/tests/s3_mock_server_tests.c index 7e6c366a6..41b270a3b 100644 --- a/tests/s3_mock_server_tests.c +++ b/tests/s3_mock_server_tests.c @@ -1748,7 +1748,7 @@ TEST_CASE(endpoint_override_mock_server) { put_options.message = message; ASSERT_SUCCESS(aws_s3_tester_send_meta_request_with_options(&tester, &put_options, NULL)); - /* 2. Create request with host info missmatch endpoint override */ + /* 2. Create request with host info mismatch endpoint override */ struct aws_http_header host_header = { .name = g_host_header_name, .value = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("bad_host"), diff --git a/tests/s3_tester.c b/tests/s3_tester.c index cc2af2d52..e79ee65a1 100644 --- a/tests/s3_tester.c +++ b/tests/s3_tester.c @@ -66,7 +66,7 @@ const struct aws_byte_cursor g_upload_folder = AWS_BYTE_CUR_INIT_FROM_STRING_LIT /* If `$CRT_S3_TEST_BUCKET_NAME` environment variable is set, use that; otherwise, use aws-c-s3-test-bucket */ struct aws_byte_cursor g_test_bucket_name = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("aws-c-s3-test-bucket"); -/* If `$CRT_S3_TEST_BUCKET_NAME` envrionment variable is set, use `$CRT_S3_TEST_BUCKET_NAME-public`; otherwise, use +/* If `$CRT_S3_TEST_BUCKET_NAME` environment variable is set, use `$CRT_S3_TEST_BUCKET_NAME-public`; otherwise, use * aws-c-s3-test-bucket-public */ struct aws_byte_cursor g_test_public_bucket_name = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("aws-c-s3-test-bucket-public"); /* If `$CRT_S3_TEST_BUCKET_NAME` environment variable is set, use diff --git a/tests/s3_tester.h b/tests/s3_tester.h index 8591ad654..0031fe310 100644 --- a/tests/s3_tester.h +++ b/tests/s3_tester.h @@ -323,7 +323,7 @@ void aws_s3_meta_request_test_results_clean_up(struct aws_s3_meta_request_test_r /* Wait for the correct number of aws_s3_tester_notify_meta_request_finished to be called */ void aws_s3_tester_wait_for_meta_request_finish(struct aws_s3_tester *tester); -/* Wait forthe correct number of aws_s3_tester_notify_meta_request_shutdown to be called. */ +/* Wait for the correct number of aws_s3_tester_notify_meta_request_shutdown to be called. */ void aws_s3_tester_wait_for_meta_request_shutdown(struct aws_s3_tester *tester); /* Notify the tester that a meta request has finished. */ @@ -472,7 +472,7 @@ int aws_s3_tester_validate_put_object_results( void aws_s3_tester_wait_for_client_shutdown(struct aws_s3_tester *tester); /* - * Value to populate test stream with. Useful for cases where we need to verify that cheksums fail. + * Value to populate test stream with. Useful for cases where we need to verify that checksums fail. */ enum aws_s3_test_stream_value { TEST_STREAM_VALUE_1, @@ -526,7 +526,7 @@ extern const struct aws_byte_cursor g_put_object_prefix; /* If `$CRT_S3_TEST_BUCKET_NAME` environment variable is set, use that; otherwise, use aws-c-s3-test-bucket */ extern struct aws_byte_cursor g_test_bucket_name; -/* If `$CRT_S3_TEST_BUCKET_NAME` envrionment variable is set, use `$CRT_S3_TEST_BUCKET_NAME-public`; otherwise, use +/* If `$CRT_S3_TEST_BUCKET_NAME` environment variable is set, use `$CRT_S3_TEST_BUCKET_NAME-public`; otherwise, use * aws-c-s3-test-bucket-public */ extern struct aws_byte_cursor g_test_public_bucket_name; diff --git a/tests/test_helper/README.md b/tests/test_helper/README.md index bab63363a..91890112c 100644 --- a/tests/test_helper/README.md +++ b/tests/test_helper/README.md @@ -26,9 +26,9 @@ python3 test_helper.py clean * Create `` in us-west-2. + Add the lifecycle to automatic clean up the `upload/` and clean up incomplete multipart uploads after one day. + Upload files: - - `pre-existing-10MB-aes256-c` [SSE-C](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html#sse-c-highlights) encrypted fille - - `pre-existing-10MB-aes256` [SSE-S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/specifying-s3-encryption.html) encrypted fille - - `pre-existing-10MB-kms` [SSE-KMS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html) encrypted fille + - `pre-existing-10MB-aes256-c` [SSE-C](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html#sse-c-highlights) encrypted file + - `pre-existing-10MB-aes256` [SSE-S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/specifying-s3-encryption.html) encrypted file + - `pre-existing-10MB-kms` [SSE-KMS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html) encrypted file - `pre-existing-10MB` - `pre-existing-1MB` - `pre-existing-1MB-@`