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

pcmoritz 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 ad82c9a  ARROW-1853: [Plasma] Fix off-by-one error in retry processing
ad82c9a is described below

commit ad82c9abaf1e564cd725591e543f828e99a3eeb2
Author: Matthias Vallentin <vallen...@icir.org>
AuthorDate: Sat Nov 25 15:43:01 2017 -0800

    ARROW-1853: [Plasma] Fix off-by-one error in retry processing
    
    When a user construct a plasma client that should not perform a single 
retry, by passing `num_retries = 0`, nothing happens due to an off-by-one error 
in the retry processing. This commit fixes the issue and polishes the error 
output.
    
    Author: Matthias Vallentin <vallen...@icir.org>
    
    Closes #1358 from wesm/topic/plasma-num-retries-fix and squashes the 
following commits:
    
    082ee4c [Matthias Vallentin] Fix off-by-one error in retry processing
---
 cpp/src/plasma/io.cc | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/cpp/src/plasma/io.cc b/cpp/src/plasma/io.cc
index 2228ad9..2cba897 100644
--- a/cpp/src/plasma/io.cc
+++ b/cpp/src/plasma/io.cc
@@ -156,19 +156,14 @@ Status ConnectIpcSocketRetry(const std::string& pathname, 
int num_retries,
   if (timeout < 0) {
     timeout = CONNECT_TIMEOUT_MS;
   }
-
-  *fd = -1;
-  for (int num_attempts = 0; num_attempts < num_retries; ++num_attempts) {
-    *fd = connect_ipc_sock(pathname);
-    if (*fd >= 0) {
-      break;
-    }
-    if (num_attempts == 0) {
-      ARROW_LOG(ERROR) << "Connection to IPC socket failed for pathname " << 
pathname
-                       << ", retrying " << num_retries << " times";
-    }
+  *fd = connect_ipc_sock(pathname);
+  while (*fd < 0 && num_retries > 0) {
+    ARROW_LOG(ERROR) << "Connection to IPC socket failed for pathname " << 
pathname
+                     << ", retrying " << num_retries << " more times";
     /* Sleep for timeout milliseconds. */
     usleep(static_cast<int>(timeout * 1000));
+    *fd = connect_ipc_sock(pathname);
+    --num_retries;
   }
   /* If we could not connect to the socket, exit. */
   if (*fd == -1) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@arrow.apache.org" <commits@arrow.apache.org>'].

Reply via email to