From c1cc535501117f31e0e3044592170e94fffa11e2 Mon Sep 17 00:00:00 2001 From: Li0k Date: Tue, 14 May 2024 15:06:56 +0800 Subject: [PATCH] fix(object_store): fix sdk error downcast (#16743) --- src/object_store/src/object/s3.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/object_store/src/object/s3.rs b/src/object_store/src/object/s3.rs index 6832b3a8e04da..d7c151e867465 100644 --- a/src/object_store/src/object/s3.rs +++ b/src/object_store/src/object/s3.rs @@ -1006,10 +1006,10 @@ where } => { let sdk_err = inner .as_ref() - .downcast_ref::>>() - .unwrap(); + .downcast_ref::>>(); + let err_should_retry = match sdk_err { - SdkError::DispatchFailure(e) => { + Some(SdkError::DispatchFailure(e)) => { if e.is_timeout() { tracing::warn!(target: "http_timeout_retry", "{e:?} occurs, retry S3 get_object request."); true @@ -1017,7 +1017,8 @@ where false } } - SdkError::ServiceError(e) => { + + Some(SdkError::ServiceError(e)) => { let retry = match e.err().code() { None => { if config.s3.developer.object_store_retry_unknown_service_error @@ -1048,7 +1049,7 @@ where retry } - SdkError::TimeoutError(_err) => true, + Some(SdkError::TimeoutError(_err)) => true, _ => false, };