You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2019/02/05 22:41:02 UTC

[kudu] 01/02: Reduce "Failed to heartbeat..." log spam

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

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

commit 10487386a15dd1882c4bbe81876e2bb7eb1b272c
Author: Will Berkeley <wd...@gmail.org>
AuthorDate: Tue Feb 5 13:34:53 2019 -0800

    Reduce "Failed to heartbeat..." log spam
    
    Tablet servers heartbeat to the master at 1Hz by default, and previously
    would log a message every time a heartbeat failed. This was a little
    much, as it's not unusual for a server out of contact with a master to
    fail heartbeats for quite some time. This patch lowers the frequency to
    once per minute, and also enhances the error message to include the
    number of failed heartbeats since the last successful heartbeat.
    
    Change-Id: Ia48e844ebeb565343e55dbceae1674c34ea8ed5b
    Reviewed-on: http://gerrit.cloudera.org:8080/12374
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/tserver/heartbeater.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/kudu/tserver/heartbeater.cc b/src/kudu/tserver/heartbeater.cc
index 2d226ba..b9cb0a8 100644
--- a/src/kudu/tserver/heartbeater.cc
+++ b/src/kudu/tserver/heartbeater.cc
@@ -583,8 +583,9 @@ void Heartbeater::Thread::RunThread() {
     const auto& s = DoHeartbeat(&error, &error_status);
     if (!s.ok()) {
       const auto& err_msg = s.ToString();
-      LOG(WARNING) << Substitute("Failed to heartbeat to $0: $1",
-                                 master_address_.ToString(), err_msg);
+      KLOG_EVERY_N_SECS(WARNING, 60)
+          << Substitute("Failed to heartbeat to $0 ($1 consecutive failures): $2",
+                        master_address_.ToString(), consecutive_failed_heartbeats_, err_msg);
       consecutive_failed_heartbeats_++;
       // If we encountered a network error (e.g., connection
       // refused), try reconnecting.