From a9e7ec8168f9634ced5268cca22c8f590b88404d Mon Sep 17 00:00:00 2001 From: kanoi Date: Tue, 30 Aug 2016 00:24:50 +1000 Subject: [PATCH] ckdb - display a status_report when exiting --- src/ckdb.c | 15 +++++++++++++-- src/ckdb.h | 4 ++-- src/ckdb_cmd.c | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/ckdb.c b/src/ckdb.c index 82cd56c2..05169fc1 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -1235,7 +1235,7 @@ void setnow(tv_t *now) now->tv_usec = spec.tv_nsec / 1000; } -void status_report(tv_t *now) +void status_report(tv_t *now, bool showseq) { char ooo_buf[256]; int relq_count, _reload_processing, relqd_count; @@ -1244,9 +1244,16 @@ void status_report(tv_t *now) int64_t _earlysock_left, _pool0_discarded, _pool0_tot; uint64_t count1, count2, count3, count4; double tot1, tot2; + tv_t now0; + + if (now == NULL) { + setnow(&now0); + now = &now0; + } LOGWARNING("OoO %s", ooo_status(ooo_buf, sizeof(ooo_buf))); - sequence_report(true); + if (showseq) + sequence_report(true); K_RLOCK(breakqueue_free); relq_count = reload_breakqueue_store->count; @@ -9320,6 +9327,8 @@ int main(int argc, char **argv) update_keysummary(); everyone_die = true; + + status_report(NULL, false); } else if (confirm_sharesummary) { // TODO: add a system lock to stop running 2 at once? confirm_summaries(); @@ -9345,6 +9354,8 @@ int main(int argc, char **argv) /* Terminate from here if the listener is sent a terminate message */ join_pthread(ckp.pth_listener); + + status_report(NULL, false); } time_t start, trigger, curr; diff --git a/src/ckdb.h b/src/ckdb.h index cd6cb665..57462e88 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -58,7 +58,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.7" -#define CKDB_VERSION DB_VERSION"-2.432" +#define CKDB_VERSION DB_VERSION"-2.433" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ @@ -2948,7 +2948,7 @@ enum reply_type { extern void logmsg(int loglevel, const char *fmt, ...); extern void setnowts(ts_t *now); extern void setnow(tv_t *now); -extern void status_report(tv_t *now); +extern void status_report(tv_t *now, bool showseq); extern void tick(); extern PGconn *dbconnect(); extern void sequence_report(bool lock); diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index f76beb36..d0101642 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -6831,7 +6831,7 @@ static char *cmd_shsta(__maybe_unused PGconn *conn, char *cmd, char *id, { char buf[256]; - status_report(now); + status_report(now, true); snprintf(buf, sizeof(buf), "ok.%s", cmd); LOGDEBUG("%s.%s", id, buf);