You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by bk...@apache.org on 2020/04/02 14:09:22 UTC

[arrow] branch master updated: ARROW-8310: [C++] Improve auto-retry in S3 tests

This is an automated email from the ASF dual-hosted git repository.

bkietz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 54e9a0d  ARROW-8310: [C++] Improve auto-retry in S3 tests
54e9a0d is described below

commit 54e9a0d2dbdd3d6ad8d87ed96540998c1325cc54
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Thu Apr 2 10:08:59 2020 -0400

    ARROW-8310: [C++] Improve auto-retry in S3 tests
    
    It seems that sometimes Minio exceptions don't get recognized
    
    Closes #6809 from pitrou/ARROW-8310-s3-auto-retry
    
    Authored-by: Antoine Pitrou <an...@python.org>
    Signed-off-by: Benjamin Kietzman <be...@gmail.com>
---
 cpp/src/arrow/filesystem/s3_internal.h | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/cpp/src/arrow/filesystem/s3_internal.h b/cpp/src/arrow/filesystem/s3_internal.h
index f00bde1..709fa20 100644
--- a/cpp/src/arrow/filesystem/s3_internal.h
+++ b/cpp/src/arrow/filesystem/s3_internal.h
@@ -52,21 +52,16 @@ namespace internal {
 
 template <typename Error>
 inline bool IsConnectError(const Aws::Client::AWSError<Error>& error) {
-  if (error.GetErrorType() == Aws::Client::CoreErrors::NETWORK_CONNECTION) {
+  if (error.ShouldRetry()) {
     return true;
   }
   // Sometimes Minio may fail with a 503 error
   // (exception name: XMinioServerNotInitialized,
   //  message: "Server not initialized, please try again")
-  auto http_code = static_cast<int>(error.GetResponseCode());
-  switch (http_code) {
-    case 502:  // Bad gateway
-    case 503:  // Service unavailable
-    case 504:  // Gateway timeout
-      return true;
-    default:
-      return false;
+  if (error.GetExceptionName() == "XMinioServerNotInitialized") {
+    return true;
   }
+  return false;
 }
 
 inline bool IsNotFound(const Aws::Client::AWSError<Aws::S3::S3Errors>& error) {
@@ -155,7 +150,7 @@ inline TimePoint FromAwsDatetime(const Aws::Utils::DateTime& dt) {
 class ConnectRetryStrategy : public Aws::Client::RetryStrategy {
  public:
   static const int32_t kDefaultRetryInterval = 200;     /* milliseconds */
-  static const int32_t kDefaultMaxRetryDuration = 4000; /* milliseconds */
+  static const int32_t kDefaultMaxRetryDuration = 6000; /* milliseconds */
 
   explicit ConnectRetryStrategy(int32_t retry_interval = kDefaultRetryInterval,
                                 int32_t max_retry_duration = kDefaultMaxRetryDuration)