From 620967f27f5f32a0a40756fd4f0a8174172ca2d3 Mon Sep 17 00:00:00 2001 From: BInwei Yang Date: Thu, 2 May 2024 23:24:54 -0700 Subject: [PATCH] retry on 503 error 503 return code means service temporarily not available. --- .../connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/velox/connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp b/velox/connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp index 5f3ed3891fc6..ce8c8ec395f8 100644 --- a/velox/connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp +++ b/velox/connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp @@ -96,7 +96,12 @@ class S3ReadFile final : public ReadFile { request.SetBucket(awsString(bucket_)); request.SetKey(awsString(key_)); - auto outcome = client_->HeadObject(request); + + Aws::S3::Model::HeadObjectOutcome outcome; + do{ + outcome = client_->HeadObject(request); + }while(!outcome.IsSuccess() && outcome.GetError().GetResponseCode() == 503); + VELOX_CHECK_AWS_OUTCOME( outcome, "Failed to get metadata for S3 object", bucket_, key_); length_ = outcome.GetResult().GetContentLength();