trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [14/22] git commit: TS-2260: Avoid flooding log when log host is down
Date Sun, 06 Oct 2013 14:57:59 GMT
TS-2260: Avoid flooding log when log host is down

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/4591314f
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/4591314f
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/4591314f

Branch: refs/heads/5.0.x
Commit: 4591314f6682b695c2b6996bf928c545d617e0c4
Parents: 54883f2
Author: Yunkai Zhang <qiushu.zyk@taobao.com>
Authored: Mon Sep 30 23:33:52 2013 +0800
Committer: Yunkai Zhang <qiushu.zyk@taobao.com>
Committed: Tue Oct 1 12:59:11 2013 +0800

----------------------------------------------------------------------
 proxy/logging/Log.cc                  | 2 +-
 proxy/logging/LogCollationClientSM.cc | 8 ++++++--
 proxy/logging/LogCollationClientSM.h  | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4591314f/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index ea6493f..ce15131 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -1382,7 +1382,7 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
       //
       while (total_bytes - bytes_written) {
         if (Log::config->logging_space_exhausted) {
-          Warning("logging space exhausted, failed to write file:%s, have dropped (%d) bytes.",
+          Debug("log", "logging space exhausted, failed to write file:%s, have dropped (%d)
bytes.",
                   logfile->m_name, (total_bytes - bytes_written));
 
           RecIncrRawStat(log_rsb, mutex->thread_holding,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4591314f/proxy/logging/LogCollationClientSM.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogCollationClientSM.cc b/proxy/logging/LogCollationClientSM.cc
index e4d2a65..ef865e6 100644
--- a/proxy/logging/LogCollationClientSM.cc
+++ b/proxy/logging/LogCollationClientSM.cc
@@ -71,6 +71,7 @@ LogCollationClientSM::LogCollationClientSM(LogHost * log_host)
     m_pending_event(NULL),
     m_abort_vio(NULL),
     m_abort_buffer(NULL),
+    m_host_is_up(false),
     m_buffer_send_list(NULL),
     m_buffer_in_iocore(NULL),
     m_flow(LOG_COLL_FLOW_ALLOW),
@@ -262,6 +263,7 @@ LogCollationClientSM::client_auth(int event, VIO * /* vio ATS_UNUSED */)
     Debug("log-coll", "[%d]client::client_auth - WRITE_COMPLETE", m_id);
 
     Note("[log-coll] host up [%s:%u]", m_log_host->ip_addr().toString(ipb, sizeof(ipb)),
m_log_host->port());
+    m_host_is_up = true;
 
     return client_send(LOG_COLL_EVENT_SWITCH, NULL);
 
@@ -403,13 +405,15 @@ LogCollationClientSM::client_fail(int event, void * /* data ATS_UNUSED
*/)
     Debug("log-coll", "[%d]client::client_fail - SWITCH", m_id);
     m_client_state = LOG_COLL_CLIENT_FAIL;
 
-    Note("[log-coll] host down [%s:%u]", m_log_host->ip_addr().toString(ipb, sizeof ipb),
m_log_host->m_port);
-    {
+    // avoid flooding log when host is down
+    if (m_host_is_up) {
+      Note("[log-coll] host down [%s:%u]", m_log_host->ip_addr().toString(ipb, sizeof
ipb), m_log_host->m_port);
       char msg_buf[128];
       snprintf(msg_buf, sizeof(msg_buf), "Collation host %s:%u down",
                m_log_host->ip_addr().toString(ipb, sizeof ipb), m_log_host->m_port
       );
       REC_SignalManager(400, msg_buf);
+      m_host_is_up = false;
     }
 
     // close our NetVConnection (do I need to delete this)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4591314f/proxy/logging/LogCollationClientSM.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogCollationClientSM.h b/proxy/logging/LogCollationClientSM.h
index 594e61c..291fe02 100644
--- a/proxy/logging/LogCollationClientSM.h
+++ b/proxy/logging/LogCollationClientSM.h
@@ -104,6 +104,7 @@ private:
   // to detect server closes (there's got to be a better way to do this)
   VIO *m_abort_vio;
   MIOBuffer *m_abort_buffer;
+  bool m_host_is_up;
 
   // send stuff
   LogBufferList *m_buffer_send_list;


Mime
View raw message