From a7c27174ce8ada63694cc59efd42fbf60b7b7210 Mon Sep 17 00:00:00 2001 From: kanoi Date: Mon, 8 Aug 2016 18:32:13 +1000 Subject: [PATCH] ckdb - correct reload file begin time --- src/ckdb.c | 12 +++++------- src/ckdb.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ckdb.c b/src/ckdb.c index ded20a95..77b785f0 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -6267,7 +6267,7 @@ static bool reload_from(tv_t *start, const tv_t *finish) bool finished = false, ret = true, ok, apipe = false; char *filename = NULL; uint64_t count, total; - tv_t now, begin, file_begin; + tv_t now, begin, file_begin, file_end; double diff; FILE *fp = NULL; int file_N_limit; @@ -6296,7 +6296,6 @@ static bool reload_from(tv_t *start, const tv_t *finish) setnow(&now); copy_tv(&begin, &now); - copy_tv(&file_begin, &now); tvs_to_buf(&now, run, sizeof(run)); snprintf(reload_buf, MAX_READ, "reload.%s.s0", run); LOGQUE(reload_buf, true); @@ -6312,6 +6311,7 @@ static bool reload_from(tv_t *start, const tv_t *finish) LOGWARNING("%s(): processing %s", __func__, filename); processing++; count = 0; + setnow(&file_begin); /* Don't abort when matched since breakdown() will remove * the matching message sequence numbers queued from ckpool @@ -6349,8 +6349,8 @@ static bool reload_from(tv_t *start, const tv_t *finish) } } - setnow(&now); - diff = tvdiff(&now, &file_begin); + setnow(&file_end); + diff = tvdiff(&file_end, &file_begin); if (diff == 0) diff = 1; @@ -6410,10 +6410,8 @@ static bool reload_from(tv_t *start, const tv_t *finish) } filename = hour_filename(restorefrom, restorename, reload_timestamp.tv_sec); ok = logopen(&filename, &fp, &apipe); - if (ok) { - setnow(&file_begin); + if (ok) break; - } errno = 0; if (missing_count++ > 1) free(missinglast); diff --git a/src/ckdb.h b/src/ckdb.h index a1ade4ed..8f8b760d 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.7" -#define CKDB_VERSION DB_VERSION"-2.304" +#define CKDB_VERSION DB_VERSION"-2.305" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__