From 668301c66f04934e301aff542f3417846088276a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 19:48:46 +0800 Subject: [PATCH] fix(object_store): fix sdk error downcast (#16743) (#16748) Co-authored-by: Li0k --- 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 6832b3a8e04d..d7c151e86746 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, };