[syslog-ng] [PATCH 3/7] fix db stored/dropped messages counter handling

Gergely Nagy algernon at balabit.hu
Mon May 23 11:56:11 CEST 2011


From: NagyAttila <naat at balabit.hu>

Do not decrease the stored counter in log_queue_fifo_pop_head(), and
initialize the counters properly in afsql_dd_init(): the
stored/dropped counters were swapped.

Signed-off-by: Attila Nagy <naat at balabit.hu>
---
 lib/logqueue-fifo.c   |    3 ---
 modules/afsql/afsql.c |    2 +-
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/lib/logqueue-fifo.c b/lib/logqueue-fifo.c
index 1a34776..f78f00c 100644
--- a/lib/logqueue-fifo.c
+++ b/lib/logqueue-fifo.c
@@ -326,9 +326,6 @@ log_queue_fifo_pop_head(LogQueue *s, LogMessage **msg, LogPathOptions *path_opti
        */
       return FALSE;
     }
-  g_static_mutex_lock(&self->super.lock);
-  stats_counter_dec(self->super.stored_messages);
-  g_static_mutex_unlock(&self->super.lock);
 
   if (push_to_backlog)
     {
diff --git a/modules/afsql/afsql.c b/modules/afsql/afsql.c
index d7ac36e..a9f0d95 100644
--- a/modules/afsql/afsql.c
+++ b/modules/afsql/afsql.c
@@ -951,7 +951,7 @@ afsql_dd_init(LogPipe *s)
   stats_register_counter(0, SCS_SQL | SCS_DESTINATION, self->super.super.id, afsql_dd_format_stats_instance(self), SC_TYPE_DROPPED, &self->dropped_messages);
 
   self->queue = log_dest_driver_acquire_queue(&self->super, afsql_dd_format_persist_name(self));
-  log_queue_set_counters(self->queue, self->dropped_messages, self->stored_messages);
+  log_queue_set_counters(self->queue, self->stored_messages, self->dropped_messages);
   if (!self->fields)
     {
       GList *col, *value;
-- 
1.7.2.5



More information about the syslog-ng mailing list