Browse Source

ckdb - console warning log out of order shares only if more than 1 second

master
kanoi 10 years ago
parent
commit
b74ae0f24e
  1. 2
      src/ckdb.h
  2. 20
      src/ckdb_dbio.c

2
src/ckdb.h

@ -55,7 +55,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.0" #define DB_VERSION "1.0.0"
#define CKDB_VERSION DB_VERSION"-1.033" #define CKDB_VERSION DB_VERSION"-1.034"
#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__

20
src/ckdb_dbio.c

@ -3438,10 +3438,16 @@ bool _sharesummary_update(PGconn *conn, SHARES *s_row, SHAREERRORS *e_row, K_ITE
if (!new) { if (!new) {
double td; double td;
td = tvdiff(sharecreatedate, &(row->firstshare)); td = tvdiff(sharecreatedate, &(row->firstshare));
// don't LOGERR '=' in case shares come from ckpool with the same timestamp // don't LOG '=' in case shares come from ckpool with the same timestamp
if (td < 0.0) { if (td < 0.0) {
char *tmp1, *tmp2; char *tmp1, *tmp2;
LOGERR("%s(): %s createdate (%s) is < summary firstshare (%s)", int level;
// DEBUG only for shares out of order up to 1 second
if (td < -1.0)
level = LOG_WARNING;
else
level = LOG_DEBUG;
LOGMSG(level, "%s(): OoO %s createdate (%s) is < summary firstshare (%s)",
__func__, s_row ? "shares" : "shareerrors", __func__, s_row ? "shares" : "shareerrors",
(tmp1 = ctv_to_buf(sharecreatedate, NULL, 0)), (tmp1 = ctv_to_buf(sharecreatedate, NULL, 0)),
(tmp2 = ctv_to_buf(&(row->firstshare), NULL, 0))); (tmp2 = ctv_to_buf(&(row->firstshare), NULL, 0)));
@ -3452,14 +3458,20 @@ bool _sharesummary_update(PGconn *conn, SHARES *s_row, SHAREERRORS *e_row, K_ITE
// Don't change lastdiffacc // Don't change lastdiffacc
} }
td = tvdiff(sharecreatedate, &(row->lastshare)); td = tvdiff(sharecreatedate, &(row->lastshare));
// don't LOGERR '=' in case shares come from ckpool with the same timestamp // don't LOG '=' in case shares come from ckpool with the same timestamp
if (td >= 0.0) { if (td >= 0.0) {
row->lastshare.tv_sec = sharecreatedate->tv_sec; row->lastshare.tv_sec = sharecreatedate->tv_sec;
row->lastshare.tv_usec = sharecreatedate->tv_usec; row->lastshare.tv_usec = sharecreatedate->tv_usec;
row->lastdiffacc = diff; row->lastdiffacc = diff;
} else { } else {
char *tmp1, *tmp2; char *tmp1, *tmp2;
LOGERR("%s(): %s createdate (%s) is < summary lastshare (%s)", int level;
// DEBUG only for shares out of order up to 1 second
if (td < -1.0)
level = LOG_WARNING;
else
level = LOG_DEBUG;
LOGMSG(level, "%s(): OoO %s createdate (%s) is < summary lastshare (%s)",
__func__, s_row ? "shares" : "shareerrors", __func__, s_row ? "shares" : "shareerrors",
(tmp1 = ctv_to_buf(sharecreatedate, NULL, 0)), (tmp1 = ctv_to_buf(sharecreatedate, NULL, 0)),
(tmp2 = ctv_to_buf(&(row->lastshare), NULL, 0))); (tmp2 = ctv_to_buf(&(row->lastshare), NULL, 0)));

Loading…
Cancel
Save