diff --git a/velox/connectors/hive/HiveConfig.cpp b/velox/connectors/hive/HiveConfig.cpp index 78f0bb78f0c2a..299fb3c888c63 100644 --- a/velox/connectors/hive/HiveConfig.cpp +++ b/velox/connectors/hive/HiveConfig.cpp @@ -120,9 +120,9 @@ std::optional HiveConfig::s3MaxConnections() const { config_->get(kS3MaxConnections)); } -std::optional HiveConfig::s3MaxAttempts() const { - return static_cast>( - config_->get(kS3MaxAttempts)); +std::optional HiveConfig::s3MaxAttempts() const { + return static_cast>( + config_->get(kS3MaxAttempts)); } std::optional HiveConfig::s3RetryMode() const { diff --git a/velox/connectors/hive/HiveConfig.h b/velox/connectors/hive/HiveConfig.h index 8392e3975d632..84f3f5ee00b36 100644 --- a/velox/connectors/hive/HiveConfig.h +++ b/velox/connectors/hive/HiveConfig.h @@ -248,7 +248,7 @@ class HiveConfig { std::optional s3MaxConnections() const; - std::optional s3MaxAttempts() const; + std::optional s3MaxAttempts() const; std::optional s3RetryMode() const; diff --git a/velox/connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp b/velox/connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp index 544c82cd11d5f..cae8657f60e87 100644 --- a/velox/connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp +++ b/velox/connectors/hive/storage_adapters/s3fs/S3FileSystem.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -652,11 +653,15 @@ class S3FileSystem::Impl { auto retryMode = hiveConfig_->s3RetryMode(); auto maxAttempts = hiveConfig_->s3MaxAttempts(); if (retryMode.has_value()) { + std::cout << "***Current retry mode is:" << retryMode.value(); + std::cout << "***Current max attempts is:" << maxAttempts.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( maxAttempts.value()); } else { @@ -665,9 +670,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( maxAttempts.value()); } else { @@ -676,9 +683,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( maxAttempts.value()); } else { diff --git a/velox/connectors/hive/storage_adapters/s3fs/S3Util.h b/velox/connectors/hive/storage_adapters/s3fs/S3Util.h index 468735d0dfee7..9632dbf47b87e 100644 --- a/velox/connectors/hive/storage_adapters/s3fs/S3Util.h +++ b/velox/connectors/hive/storage_adapters/s3fs/S3Util.h @@ -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); \ } \