From 1bcfc2bd002deddbe9d40e4bbae9af86b3c5c214 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Tue, 9 May 2017 12:29:44 +0200 Subject: [PATCH] F #4809: Less verbose output --- src/raft/RaftManager.cc | 26 ++++++++++++++++++++++---- src/raft/ReplicaManager.cc | 2 -- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/raft/RaftManager.cc b/src/raft/RaftManager.cc index 23aa4e67a9..cf3f272c4b 100644 --- a/src/raft/RaftManager.cc +++ b/src/raft/RaftManager.cc @@ -757,12 +757,30 @@ void RaftManager::send_heartbeat() if ( rc == -1 ) { - std::ostringstream oss; + static time_t last_error = 0; + static int num_errors = 0; - oss << "Error sending heartbeat to follower " << it->first <<": " - << error; + num_errors++; - NebulaLog::log("RCM", Log::INFO, oss); + if ( last_error == 0 ) + { + last_error = time(0); + num_errors = 1; + } + else if ( last_error + 60 < time(0) ) + { + if ( num_errors > 10 ) + { + std::ostringstream oss; + + oss << "Detetected error condition on follower " + << it->first <<". Last error was: " << error; + + NebulaLog::log("RCM", Log::INFO, oss); + } + + last_error = 0; + } } else if ( success == false && fterm > term ) { diff --git a/src/raft/ReplicaManager.cc b/src/raft/ReplicaManager.cc index 8555e91d9b..e7b4f1ed63 100644 --- a/src/raft/ReplicaManager.cc +++ b/src/raft/ReplicaManager.cc @@ -125,8 +125,6 @@ void ReplicaThread::do_replication() if ( xml_rc == -1 ) { - NebulaLog::log("RCM", Log::ERROR, error); - if ( retry_timeout < max_retry_timeout ) { retry_timeout = 2 * retry_timeout;