You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2021/04/30 17:29:39 UTC

[kudu] 02/05: [client] return TimedOut if the deadline has passed in master RPCs

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

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

commit 10d8e320bdc6902ae223038c8c406cc6774a6075
Author: Andrew Wong <aw...@cloudera.com>
AuthorDate: Thu Apr 29 16:28:17 2021 -0700

    [client] return TimedOut if the deadline has passed in master RPCs
    
    There was a narrow window in which we could return a NetworkError to
    users of the master-bound RPCs instead of a TimedOut error. Without this
    change I saw ClientTest.NoTxnManager fail 1/300 times and
    TxnStatusTableITest.TestSystemClientMasterDown fail ~1/3 of the time
    running in a loop via dist-test.
    
    With this change, I ran it with no issue 1000/1000 times each.
    
    This is a follow-up to 96047a8d861d61673b9e2589930eccd78a16e483.
    
    Change-Id: I309ba70d62a48b4dc8fb0e8f30f532593c254860
    Reviewed-on: http://gerrit.cloudera.org:8080/17367
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Tested-by: Andrew Wong <aw...@cloudera.com>
---
 src/kudu/client/master_proxy_rpc.cc      | 4 +++-
 src/kudu/client/txn_manager_proxy_rpc.cc | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/kudu/client/master_proxy_rpc.cc b/src/kudu/client/master_proxy_rpc.cc
index 975a7af..da4bb1e 100644
--- a/src/kudu/client/master_proxy_rpc.cc
+++ b/src/kudu/client/master_proxy_rpc.cc
@@ -37,6 +37,7 @@
 #include "kudu/util/monotime.h"
 #include "kudu/util/net/net_util.h"
 #include "kudu/util/scoped_cleanup.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 #include "kudu/util/status_callback.h"
 
@@ -241,7 +242,8 @@ bool AsyncLeaderMasterRpc<ReqClass, RespClass>::RetryOrReconnectIfNecessary(
       return true;
     }
     // And if we've passed the overall deadline, we shouldn't retry.
-    s = s.CloneAndPrepend(Substitute("$0 timed out after deadline expired", rpc_name_));
+    s = Status::TimedOut(Substitute("$0 timed out after deadline expired: $1",
+                                    rpc_name_, s.message().ToString()));
   }
 
   // Next, parse RPC errors that happened after the connection succeeded.
diff --git a/src/kudu/client/txn_manager_proxy_rpc.cc b/src/kudu/client/txn_manager_proxy_rpc.cc
index cf72650..ac7c03f 100644
--- a/src/kudu/client/txn_manager_proxy_rpc.cc
+++ b/src/kudu/client/txn_manager_proxy_rpc.cc
@@ -37,6 +37,7 @@
 #include "kudu/util/logging.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/scoped_cleanup.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 #include "kudu/util/status_callback.h"
 
@@ -184,7 +185,8 @@ bool AsyncRandomTxnManagerRpc<ReqClass, RespClass>::RetryIfNecessary(
       return true;
     }
     // And if we've passed the overall deadline, we shouldn't retry.
-    s = s.CloneAndPrepend(Substitute("$0 timed out after deadline expired", rpc_name_));
+    s = Status::TimedOut(Substitute("$0 timed out after deadline expired: $1",
+                                    rpc_name_, s.message().ToString()));
   }
 
   // Next, parse RPC errors that happened after the connection succeeded.