diff --git a/src/IO/S3Common.h b/src/IO/S3Common.h index 20ec982138a..726952f7897 100644 --- a/src/IO/S3Common.h +++ b/src/IO/S3Common.h @@ -9,12 +9,14 @@ #include <common/types.h> #include <aws/core/Aws.h> // Y_IGNORE #include <aws/core/client/ClientConfiguration.h> // Y_IGNORE +#include <aws/core/client/DefaultRetryStrategy.h> #include <IO/S3/PocoHTTPClient.h> #include <Poco/URI.h> namespace Aws::S3 { class S3Client; + class RetryStrategy; } namespace DB diff --git a/src/Storages/StorageS3.cpp b/src/Storages/StorageS3.cpp index 4d5d2deebfa..5b8c0b38e09 100644 --- a/src/Storages/StorageS3.cpp +++ b/src/Storages/StorageS3.cpp @@ -356,6 +356,7 @@ public: const String & format_, const Block & sample_block_, ContextPtr context_, + std::optional<FormatSettings> format_settings_, const CompressionMethod compression_method_, const std::shared_ptr<Aws::S3::S3Client> & client_, const String & bucket_, @@ -372,7 +373,7 @@ public: , key(key_) , min_upload_part_size(min_upload_part_size_) , max_single_part_upload_size(max_single_part_upload_size_) - + , format_settings(format_settings_) { std::vector<ASTPtr> arguments(1, partition_by); ASTPtr partition_by_string = makeASTFunction(FunctionToString::name, std::move(arguments)); @@ -447,6 +448,7 @@ private: const String key; size_t min_upload_part_size; size_t max_single_part_upload_size; + std::optional<FormatSettings> format_settings; ExpressionActionsPtr partition_by_expr; String partition_by_column_name; @@ -473,6 +475,7 @@ private: format, sample_block, context, + format_settings, compression_method, client, partition_bucket, @@ -647,6 +650,7 @@ SinkToStoragePtr StorageS3::write(const ASTPtr & query, const StorageMetadataPtr format_name, sample_block, local_context, + format_settings, chosen_compression_method, client_auth.client, client_auth.uri.bucket, @@ -660,6 +664,7 @@ SinkToStoragePtr StorageS3::write(const ASTPtr & query, const StorageMetadataPtr format_name, sample_block, local_context, + format_settings, chosen_compression_method, client_auth.client, client_auth.uri.bucket, @@ -713,6 +718,7 @@ void StorageS3::updateClientAndAuthSettings(ContextPtr ctx, StorageS3::ClientAut client_configuration.endpointOverride = upd.uri.endpoint; client_configuration.maxConnections = upd.max_connections; + client_configuration.retryStrategy = std::make_shared<Aws::Client::DefaultRetryStrategy>(/*maxRetry*/1, /*scope*/ 1); upd.client = S3::ClientFactory::instance().create( client_configuration,