From 6fb7879a7eefbd711153177af1038ef2da2e40c1 Mon Sep 17 00:00:00 2001 From: kanoi Date: Mon, 20 Apr 2015 19:14:47 +1000 Subject: [PATCH] ckdb - complete the reload to the end of the log file --- src/ckdb.c | 11 ++++++++--- src/ckdb.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ckdb.c b/src/ckdb.c index e695f1ce..df758acc 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -3883,7 +3883,7 @@ static bool reload_line(PGconn *conn, char *filename, uint64_t count, char *buf) finished = true; ck_wunlock(&fpm_lock); if (finished) { - LOGERR("%s() reload completed, ckpool queue match at line %"PRIu64, __func__, count); + LOGERR("%s() reload ckpool queue match at line %"PRIu64, __func__, count); return true; } @@ -4101,7 +4101,12 @@ static bool reload_from(tv_t *start) processing++; count = 0; - while (!everyone_die && !matched && + /* Don't abort when matched since breakdown() will remove + * the matching message sequence numbers queued from ckpool + * Also since ckpool messages are not in order, we could be + * aborting early and not get the few slightly later out of + * order messages in the log file */ + while (!everyone_die && logline(reload_buf, MAX_READ, fp, filename)) matched = reload_line(conn, filename, ++count, reload_buf); @@ -4121,7 +4126,7 @@ static bool reload_from(tv_t *start) } else fclose(fp); free(filename); - if (everyone_die || matched) + if (everyone_die) break; reload_timestamp.tv_sec += ROLL_S; if (confirm_sharesummary && tv_newer(&confirm_finish, &reload_timestamp)) { diff --git a/src/ckdb.h b/src/ckdb.h index 77f01746..0d49c012 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.0" -#define CKDB_VERSION DB_VERSION"-1.071" +#define CKDB_VERSION DB_VERSION"-1.072" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__