summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2014-05-02 13:55:59 +0530
committerVijay Bellur <vbellur@redhat.com>2014-05-16 02:43:25 -0700
commit07e8f0226d5263501d2b23ed008c59ed45a5a5bd (patch)
tree3034a86b7c71722c86c810475710413d05e8fb79
parent40c2808ebfd51bc0440683aac68b719c4c7a874c (diff)
logging: Add extra logs to enable testing of log suppression
Note: This patch may be reverted once the testing effort is complete, if desired. Change-Id: I840399c531a43049749073d4d59bc0c85f525be3 BUG: 1075611 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/7681 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--libglusterfs/src/logging.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index e18971c26bf..2a8335eb052 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -48,6 +48,11 @@
#include "glusterfs.h"
#include "timer.h"
+/* Do not replace gf_log in TEST_LOG with gf_msg, as there is a slight chance
+ * that it could lead to an infinite recursion.*/
+#define TEST_LOG(__msg, __args ...) \
+ gf_log ("logging-infra", GF_LOG_DEBUG, __msg, ##__args);
+
void
gf_log_flush_timeout_cbk (void *data);
@@ -1796,8 +1801,11 @@ unlock:
if (list_empty (&copy))
return;
+ TEST_LOG("Log buffer size reduced. About to flush %d extra log "
+ "messages", count);
// ... and then flush them outside the lock.
gf_log_flush_list (&copy, ctx);
+ TEST_LOG("Just flushed %d extra log messages", count);
return;
}
@@ -1816,6 +1824,8 @@ __gf_log_inject_timer_event (glusterfs_ctx_t *ctx)
timeout.tv_sec = ctx->log.timeout;
timeout.tv_nsec = 0;
+ TEST_LOG("Starting timer now. Timeout = %u, current buf size = %d",
+ ctx->log.timeout, ctx->log.lru_size);
ctx->log.log_flush_timer = gf_timer_call_after (ctx, timeout,
gf_log_flush_timeout_cbk,
(void *)ctx);
@@ -1849,6 +1859,8 @@ gf_log_flush_timeout_cbk (void *data)
ctx = (glusterfs_ctx_t *) data;
+ TEST_LOG("Log timer timed out. About to flush outstanding messages if "
+ "present");
gf_log_flush_msgs (ctx);
(void) gf_log_inject_timer_event (ctx);
@@ -1966,6 +1978,10 @@ _gf_msg_internal (const char *domain, const char *file, const char *function,
/* If the list is full, flush the lru msg to disk and also
* release it after unlock, and ...
* */
+ if (first->refcount >= 1)
+ TEST_LOG("Buffer overflow of a buffer whose size limit "
+ "is %d. About to flush least recently used log"
+ " message to disk", size);
list_del_init (&first->msg_list);
ctx->log.lru_cur_size--;
flush_lru = _gf_true;