Browse Source

ckdb - add a record counter for the 2 largest DB table loads

master
kanoi 10 years ago
parent
commit
d6ebc8ad97
  1. 5
      src/ckdb.h
  2. 31
      src/ckdb_dbio.c

5
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.101" #define CKDB_VERSION DB_VERSION"-1.103"
#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__
@ -105,6 +105,9 @@ extern int switch_state;
#define BLANK " " #define BLANK " "
extern char *EMPTY; extern char *EMPTY;
// To ensure there's space for the ticker
#define TICK_PREFIX " "
// Field patterns // Field patterns
extern const char *userpatt; extern const char *userpatt;
extern const char *mailpatt; extern const char *mailpatt;

31
src/ckdb_dbio.c

@ -9,6 +9,17 @@
#include "ckdb.h" #include "ckdb.h"
// Doesn't work with negative numbers ...
void pcom(int n)
{
if (n < 1000)
printf("%d", n);
else {
pcom(n/1000);
printf(",%03d", n % 1000);
}
}
char *pqerrmsg(PGconn *conn) char *pqerrmsg(PGconn *conn)
{ {
char *ptr, *buf = strdup(PQerrorMessage(conn)); char *ptr, *buf = strdup(PQerrorMessage(conn));
@ -2624,6 +2635,9 @@ bool workinfo_fill(PGconn *conn)
LOGDEBUG("%s(): select", __func__); LOGDEBUG("%s(): select", __func__);
printf(TICK_PREFIX"wi 0\r");
fflush(stdout);
// TODO: select the data based on sharesummary since old data isn't needed // TODO: select the data based on sharesummary since old data isn't needed
// however, the ageing rules for workinfo will decide that also // however, the ageing rules for workinfo will decide that also
// keep the last block + current? Rules will depend on payout scheme also // keep the last block + current? Rules will depend on payout scheme also
@ -2765,6 +2779,13 @@ bool workinfo_fill(PGconn *conn)
dbstatus.newest_workinfoid = row->workinfoid; dbstatus.newest_workinfoid = row->workinfoid;
} }
if (i == 0 || ((i+1) % 100000) == 0) {
printf(TICK_PREFIX"wi ");
pcom(i+1);
putchar('\r');
fflush(stdout);
}
tick(); tick();
} }
if (!ok) { if (!ok) {
@ -5896,6 +5917,9 @@ bool markersummary_fill(PGconn *conn)
LOGDEBUG("%s(): select", __func__); LOGDEBUG("%s(): select", __func__);
printf(TICK_PREFIX"ms 0\r");
fflush(stdout);
// TODO: limit how far back // TODO: limit how far back
sel = "select " sel = "select "
"markerid,userid,workername,diffacc,diffsta,diffdup,diffhi," "markerid,userid,workername,diffacc,diffsta,diffdup,diffhi,"
@ -6055,6 +6079,13 @@ bool markersummary_fill(PGconn *conn)
_userinfo_update(NULL, NULL, row, false, false); _userinfo_update(NULL, NULL, row, false, false);
if (i == 0 || ((i+1) % 100000) == 0) {
printf(TICK_PREFIX"ms ");
pcom(i+1);
putchar('\r');
fflush(stdout);
}
tick(); tick();
} }
if (!ok) { if (!ok) {

Loading…
Cancel
Save