From 86c9a1b5b2abdf7d81e0fd25c004f0ff3003da63 Mon Sep 17 00:00:00 2001 From: Satyam Singh Date: Sun, 2 Oct 2022 10:48:35 +0530 Subject: [PATCH 1/2] Bump aws_sdk_s3 version and provide sleep and retry impl for S3 client Client is given a generic retry and sleep implementation which gets rid of warning generated by aws_sdk_s3 crate. --- server/Cargo.toml | 3 ++- server/src/s3.rs | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/Cargo.toml b/server/Cargo.toml index d53168ad1..91674a4c3 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -15,7 +15,8 @@ actix-cors = "0.6" actix-files = "0.6.1" anyhow = { version = "1.0.43", features = ["backtrace"] } async-trait = "0.1" -aws-sdk-s3 = "0.17" +aws-sdk-s3 = "0.19" +aws-smithy-async = { version = "0.49.0", features = ["rt-tokio"] } bytes = "1" chrono = "0.4.19" chrono-humanize = "0.2.2" diff --git a/server/src/s3.rs b/server/src/s3.rs index 4843614c0..b051ed1e8 100644 --- a/server/src/s3.rs +++ b/server/src/s3.rs @@ -3,7 +3,9 @@ use aws_sdk_s3::error::{HeadBucketError, HeadBucketErrorKind}; use aws_sdk_s3::model::{CommonPrefix, Delete, ObjectIdentifier}; use aws_sdk_s3::types::{ByteStream, SdkError}; use aws_sdk_s3::Error as AwsSdkError; +use aws_sdk_s3::RetryConfig; use aws_sdk_s3::{Client, Credentials, Endpoint, Region}; +use aws_smithy_async::rt::sleep::default_async_sleep; use bytes::Bytes; use crossterm::style::Stylize; use datafusion::arrow::datatypes::Schema; @@ -171,6 +173,8 @@ impl S3 { .region(options.region) .endpoint_resolver(options.endpoint) .credentials_provider(options.creds) + .retry_config(RetryConfig::standard().with_max_attempts(1)) + .sleep_impl(default_async_sleep().expect("sleep impl is provided for tokio rt")) .build(); let client = Client::from_conf(config); From 272ebe221eb3190696aeca44b138629c8fffb42b Mon Sep 17 00:00:00 2001 From: Satyam Singh Date: Sun, 2 Oct 2022 11:11:49 +0530 Subject: [PATCH 2/2] Set max retry attemps to 5 --- server/src/s3.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/s3.rs b/server/src/s3.rs index b051ed1e8..a1f878f42 100644 --- a/server/src/s3.rs +++ b/server/src/s3.rs @@ -173,7 +173,7 @@ impl S3 { .region(options.region) .endpoint_resolver(options.endpoint) .credentials_provider(options.creds) - .retry_config(RetryConfig::standard().with_max_attempts(1)) + .retry_config(RetryConfig::standard().with_max_attempts(5)) .sleep_impl(default_async_sleep().expect("sleep impl is provided for tokio rt")) .build();