summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2019-05-21 01:37:47 +0000
committerXavi Hernandez <xhernandez@redhat.com>2019-05-21 08:36:32 +0000
commit2f50486f431b37f4a16541911f50f2042049b0e6 (patch)
treea33eaa6a82434e309b11d505e36f8fa60ae77b65 /rpc
parent836e5b6b76ee74a486b6d41c4a2d3de91e4ad2c1 (diff)
Revert "rpc: implement reconnect back-off strategy"
This reverts commit 59841f7e1ff0511b04884015441a181a56d07bea. This revert is done as a 'possible' fix for frequent regression failures, which are random in nature too (ie, different tests fails in different runs). Why exactly this patch? Because this patch seemed like most probable candidate which got merged in last 15days, and after which regressions are failing more often. Updates: bz#1711827 Change-Id: I35333162fcd4064f9609525ca93c666053c6d959
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c33
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.h1
2 files changed, 16 insertions, 18 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index c1945dfb6ec..8ef05378351 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -392,16 +392,8 @@ rpc_clnt_reconnect(void *conn_ptr)
conn->reconnect = 0;
if ((conn->connected == 0) && !clnt->disabled) {
- if (conn->reconnect_delay.tv_sec < 3) {
- conn->reconnect_delay.tv_sec *= 2;
- int64_t ns = conn->reconnect_delay.tv_nsec * 2;
- if (ns >= 1000000000ULL) {
- conn->reconnect_delay.tv_sec++;
- ns -= 1000000000ULL;
- }
- conn->reconnect_delay.tv_nsec = ns;
- }
- ts = conn->reconnect_delay;
+ ts.tv_sec = 3;
+ ts.tv_nsec = 0;
gf_log(conn->name, GF_LOG_TRACE, "attempting reconnect");
(void)rpc_transport_connect(trans, conn->config.remote_port);
@@ -846,11 +838,9 @@ rpc_clnt_handle_disconnect(struct rpc_clnt *clnt, rpc_clnt_connection_t *conn)
pthread_mutex_lock(&conn->lock);
{
- conn->reconnect_delay.tv_sec = 0;
- conn->reconnect_delay.tv_nsec = 100000000;
-
if (!conn->rpc_clnt->disabled && (conn->reconnect == NULL)) {
- ts = conn->reconnect_delay;
+ ts.tv_sec = 3;
+ ts.tv_nsec = 0;
rpc_clnt_ref(clnt);
conn->reconnect = gf_timer_call_after(clnt->ctx, ts,
@@ -1170,8 +1160,6 @@ rpc_clnt_start(struct rpc_clnt *rpc)
* rpc_clnt_reconnect fire event.
*/
rpc_clnt_ref(rpc);
- conn->reconnect_delay.tv_sec = 0;
- conn->reconnect_delay.tv_nsec = 50000000;
rpc_clnt_reconnect(conn);
return 0;
@@ -1189,7 +1177,18 @@ rpc_clnt_cleanup_and_start(struct rpc_clnt *rpc)
rpc_clnt_connection_cleanup(conn);
- return rpc_clnt_start(rpc);
+ pthread_mutex_lock(&conn->lock);
+ {
+ rpc->disabled = 0;
+ }
+ pthread_mutex_unlock(&conn->lock);
+ /* Corresponding unref will be either on successful timer cancel or last
+ * rpc_clnt_reconnect fire event.
+ */
+ rpc_clnt_ref(rpc);
+ rpc_clnt_reconnect(conn);
+
+ return 0;
}
int
diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h
index 2c252d5ff86..b46feed50c8 100644
--- a/rpc/rpc-lib/src/rpc-clnt.h
+++ b/rpc/rpc-lib/src/rpc-clnt.h
@@ -136,7 +136,6 @@ struct rpc_clnt_connection {
struct saved_frames *saved_frames;
struct timespec last_sent;
struct timespec last_received;
- struct timespec reconnect_delay;
uint64_t pingcnt;
uint64_t msgcnt;
uint64_t cleanup_gen;