[rrd-developers] [PATCH] [BUG] report correct totals to syslog when we have multiple journals
kevin brintnall
kbrint at rufus.net
Thu Oct 2 00:15:59 CEST 2008
The totals reported in journal_replay() are now zeroed local values.
We increment the return values once we're all done.
This patch applies on top of the SLURP patch I sent a while ago.
---
src/rrd_daemon.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index f457f76..9439841 100644
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
@@ -207,7 +207,7 @@ static int journal_write(char *cmd, char *args);
static void journal_done(void);
static void journal_rotate(void);
static int journal_replay (const char *file, int log_prio,
- int *entry_cnt, int *fail_cnt);
+ int *entry_ret, int *fail_ret);
/*
* Functions
@@ -1595,11 +1595,13 @@ static int journal_write(char *cmd, char *args) /* {{{ */
/* returns number of lines processed */
static int journal_replay (const char *file, int log_prio, /* {{{ */
- int *entry_cnt, int *fail_cnt)
+ int *entry_ret, int *fail_ret)
{
FILE *fh;
uint64_t line = 0;
char entry[CMD_MAX];
+ int entry_cnt = 0;
+ int fail_cnt = 0;
if (file == NULL) return 0;
@@ -1627,23 +1629,26 @@ static int journal_replay (const char *file, int log_prio, /* {{{ */
{
RRDD_LOG(log_prio,
"Malformed journal entry in '%s' line %"PRIu64, file, line);
- (*fail_cnt)++;
+ ++fail_cnt;
continue;
}
entry[entry_len - 1] = '\0';
if (handle_request(-1, PRIV_HIGH, entry, entry_len) == 0)
- (*entry_cnt)++;
+ ++entry_cnt;
else
- (*fail_cnt)++;
+ ++fail_cnt;
}
fclose(fh);
if (line > 0)
RRDD_LOG(log_prio, "Replayed %d entries (%d failures) from '%s'",
- *entry_cnt, *fail_cnt, file);
+ entry_cnt, fail_cnt, file);
+
+ *entry_ret += entry_cnt;
+ *fail_ret += fail_cnt;
return line;
} /* }}} static int journal_replay */
--
1.6.0.2
More information about the rrd-developers
mailing list