Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yma11 committed May 14, 2024
1 parent 404658a commit 1285c3c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions velox/connectors/hive/HiveConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ std::optional<uint32_t> HiveConfig::s3MaxConnections() const {
config_->get<uint32_t>(kS3MaxConnections));
}

std::optional<uint32_t> HiveConfig::s3MaxAttempts() const {
return static_cast<std::optional<std::uint32_t>>(
config_->get<uint32_t>(kS3MaxAttempts));
std::optional<int32_t> HiveConfig::s3MaxAttempts() const {
return static_cast<std::optional<std::int32_t>>(
config_->get<int32_t>(kS3MaxAttempts));
}

std::optional<std::string> HiveConfig::s3RetryMode() const {
Expand Down
2 changes: 1 addition & 1 deletion velox/connectors/hive/HiveConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class HiveConfig {

std::optional<uint32_t> s3MaxConnections() const;

std::optional<uint32_t> s3MaxAttempts() const;
std::optional<int32_t> s3MaxAttempts() const;

std::optional<std::string> s3RetryMode() const;

Expand Down
24 changes: 15 additions & 9 deletions velox/connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,11 @@ class S3FileSystem::Impl {
if (retryMode.has_value()) {
if (retryMode.value() == "standard") {
if (maxAttempts.has_value()) {
VELOX_USER_CHECK(
(maxAttempts.value() > 0),
"Invalid configuration: specify 'hive.s3.max-attempts' > 0.");
VELOX_USER_CHECK_GE(
maxAttempts.value(),
0,
"Invalid configuration: specified 'hive.s3.max-attempts' value {} is < 0.",
maxAttempts.value());
return std::make_shared<Aws::Client::StandardRetryStrategy>(
maxAttempts.value());
} else {
Expand All @@ -665,9 +667,11 @@ class S3FileSystem::Impl {
}
} else if (retryMode.value() == "adaptive") {
if (maxAttempts.has_value()) {
VELOX_USER_CHECK(
(maxAttempts.value() > 0),
"Invalid configuration: specify 'hive.s3.max-attempts' > 0.");
VELOX_USER_CHECK_GE(
maxAttempts.value(),
0,
"Invalid configuration: specified 'hive.s3.max-attempts' value {} is < 0.",
maxAttempts.value());
return std::make_shared<Aws::Client::AdaptiveRetryStrategy>(
maxAttempts.value());
} else {
Expand All @@ -676,9 +680,11 @@ class S3FileSystem::Impl {
}
} else if (retryMode.value() == "legacy") {
if (maxAttempts.has_value()) {
VELOX_USER_CHECK(
(maxAttempts.value() > 0),
"Invalid configuration: specify 'hive.s3.max-attempts' > 0.");
VELOX_USER_CHECK_GE(
maxAttempts.value(),
0,
"Invalid configuration: specified 'hive.s3.max-attempts' value {} is < 0.",
maxAttempts.value());
return std::make_shared<Aws::Client::DefaultRetryStrategy>(
maxAttempts.value());
} else {
Expand Down
2 changes: 1 addition & 1 deletion velox/connectors/hive/storage_adapters/s3fs/S3Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ inline std::string getRequestID(
getRequestID(error.GetResponseHeaders())); \
if (IsRetryableHttpResponseCode(error.GetResponseCode())) { \
auto retryHint = fmt::format( \
" This request gets retriable response and has retried {} times, you may increase 'hive.s3.max-attempts'.", \
" Request failed after retrying {} times. Try increasing the value of 'hive.s3.max-attempts'.", \
outcome.GetRetryCount()); \
errMsg.append(retryHint); \
} \
Expand Down

0 comments on commit 1285c3c

Please sign in to comment.