From d383285b3db1c3f9b3da6438b296873118f59d7a Mon Sep 17 00:00:00 2001 From: kanoi Date: Fri, 25 Sep 2015 23:29:15 +1000 Subject: [PATCH] ckdb - ignore non-processed workmarkers when determining the reload point --- src/ckdb.h | 2 +- src/ckdb_dbio.c | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/ckdb.h b/src/ckdb.h index ded07a54..045d99f2 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.3" -#define CKDB_VERSION DB_VERSION"-1.321" +#define CKDB_VERSION DB_VERSION"-1.322" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_dbio.c b/src/ckdb_dbio.c index f77abd57..ffd858e9 100644 --- a/src/ckdb_dbio.c +++ b/src/ckdb_dbio.c @@ -6872,13 +6872,30 @@ bool workmarkers_fill(PGconn *conn) } row->pps_value = workinfo_pps(wi_item, row->workinfoidend, false); - if (dbstatus.newest_workmarker_workinfoid < row->workinfoidend) { + if (CURRENT(&(row->expirydate)) && + !WMPROCESSED(row->status)) { + LOGWARNING("%s(): WARNING workmarkerid %"PRId64" (%s)" + " wid end %"PRId64" isn't processed! (%s) " + "You should abort ckdb and mark it if it " + "actually has already been processed", + __func__, row->markerid, row->description, + row->workinfoidend, row->status); + } + + /* Ignore any workmarker that isn't processed, so that the + * necessary data to process it can be reloaded, if the + * workmarker is after the last processed shift + * Any CURRENT non-processed workmarkers will give a console + * warning (above) */ + if (CURRENT(&(row->expirydate)) && + WMPROCESSED(row->status) && + dbstatus.newest_workmarker_workinfoid < row->workinfoidend) { dbstatus.newest_workmarker_workinfoid = row->workinfoidend; if (!wi_item) { LOGEMERG("%s(): FAILURE workmarkerid %"PRId64 " wid end %"PRId64" doesn't exist! " "You should abort ckdb and fix it, " - " since the reload may skip some data", + "since the reload may skip some data", __func__, row->markerid, row->workinfoidend); } else {