Browse Source

ckdb - display a status_report when exiting

master
kanoi 8 years ago
parent
commit
a9e7ec8168
  1. 13
      src/ckdb.c
  2. 4
      src/ckdb.h
  3. 2
      src/ckdb_cmd.c

13
src/ckdb.c

@ -1235,7 +1235,7 @@ void setnow(tv_t *now)
now->tv_usec = spec.tv_nsec / 1000; 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]; char ooo_buf[256];
int relq_count, _reload_processing, relqd_count; int relq_count, _reload_processing, relqd_count;
@ -1244,8 +1244,15 @@ void status_report(tv_t *now)
int64_t _earlysock_left, _pool0_discarded, _pool0_tot; int64_t _earlysock_left, _pool0_discarded, _pool0_tot;
uint64_t count1, count2, count3, count4; uint64_t count1, count2, count3, count4;
double tot1, tot2; double tot1, tot2;
tv_t now0;
if (now == NULL) {
setnow(&now0);
now = &now0;
}
LOGWARNING("OoO %s", ooo_status(ooo_buf, sizeof(ooo_buf))); LOGWARNING("OoO %s", ooo_status(ooo_buf, sizeof(ooo_buf)));
if (showseq)
sequence_report(true); sequence_report(true);
K_RLOCK(breakqueue_free); K_RLOCK(breakqueue_free);
@ -9320,6 +9327,8 @@ int main(int argc, char **argv)
update_keysummary(); update_keysummary();
everyone_die = true; everyone_die = true;
status_report(NULL, false);
} else if (confirm_sharesummary) { } else if (confirm_sharesummary) {
// TODO: add a system lock to stop running 2 at once? // TODO: add a system lock to stop running 2 at once?
confirm_summaries(); confirm_summaries();
@ -9345,6 +9354,8 @@ int main(int argc, char **argv)
/* Terminate from here if the listener is sent a terminate message */ /* Terminate from here if the listener is sent a terminate message */
join_pthread(ckp.pth_listener); join_pthread(ckp.pth_listener);
status_report(NULL, false);
} }
time_t start, trigger, curr; time_t start, trigger, curr;

4
src/ckdb.h

@ -58,7 +58,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.7" #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 " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -2948,7 +2948,7 @@ enum reply_type {
extern void logmsg(int loglevel, const char *fmt, ...); extern void logmsg(int loglevel, const char *fmt, ...);
extern void setnowts(ts_t *now); extern void setnowts(ts_t *now);
extern void setnow(tv_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 void tick();
extern PGconn *dbconnect(); extern PGconn *dbconnect();
extern void sequence_report(bool lock); extern void sequence_report(bool lock);

2
src/ckdb_cmd.c

@ -6831,7 +6831,7 @@ static char *cmd_shsta(__maybe_unused PGconn *conn, char *cmd, char *id,
{ {
char buf[256]; char buf[256];
status_report(now); status_report(now, true);
snprintf(buf, sizeof(buf), "ok.%s", cmd); snprintf(buf, sizeof(buf), "ok.%s", cmd);
LOGDEBUG("%s.%s", id, buf); LOGDEBUG("%s.%s", id, buf);

Loading…
Cancel
Save