Hi, On Mon, 2011-05-23 at 11:56 +0200, Gergely Nagy wrote:
From: NagyAttila <naat@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@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) {
I'm somewhat puzzled here. The queue manages the "stored" counter itself, the increments remained there in all paths (e.g. push_tail, rewind, etc). What is going to perform the decrease operation then?
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;
This part is OK, and since it is completely independent of the other hunk, I've applied it separately with this patch: commit 966b39289785677d0c4354623f1f83780b952ee5 Author: Balazs Scheidler <bazsi@balabit.hu> Date: Sat May 28 14:17:58 2011 +0200 fix db stored/dropped messages counter handling Initialize the counters properly in afsql_dd_init(): the stored/dropped counters were swapped. Signed-off-by: Attila Nagy <naat@balabit.hu> Signed-off-by: Balazs Scheidler <bazsi@balabit.hu> -- Bazsi