Browse Source

ckdb - allow the -w option to only affect sharesummaries

master
kanoi 10 years ago
parent
commit
a4fb2ca927
  1. 14
      src/ckdb.c
  2. 4
      src/ckdb.h
  3. 3
      src/ckdb_dbio.c

14
src/ckdb.c

@ -272,6 +272,8 @@ static tv_t reload_timestamp;
* workinfo and sharesummary */ * workinfo and sharesummary */
int64_t dbload_workinfoid_start = -1; int64_t dbload_workinfoid_start = -1;
int64_t dbload_workinfoid_finish = MAXID; int64_t dbload_workinfoid_finish = MAXID;
// Only restrict sharesummary, not workinfo
bool dbload_only_sharesummary = false;
// DB users,workers,auth load is complete // DB users,workers,auth load is complete
bool db_auths_complete = false; bool db_auths_complete = false;
@ -1235,6 +1237,8 @@ static bool setup_data()
if (dbload_workinfoid_start != -1) { if (dbload_workinfoid_start != -1) {
LOGWARNING("WARNING: dbload starting at workinfoid %"PRId64, LOGWARNING("WARNING: dbload starting at workinfoid %"PRId64,
dbload_workinfoid_start); dbload_workinfoid_start);
if (dbload_only_sharesummary)
LOGWARNING("NOTICE: dbload only restricting sharesummary");
} }
if (!getdata3() || everyone_die) if (!getdata3() || everyone_die)
@ -3567,7 +3571,15 @@ int main(int argc, char **argv)
case 'w': case 'w':
// Don't use this :) // Don't use this :)
{ {
int64_t start = atoll(optarg); char *ptr = optarg;
int64_t start;
if (*ptr == 's') {
dbload_only_sharesummary = true;
ptr++;
}
start = atoll(ptr);
if (start < 0) { if (start < 0) {
quit(1, "Invalid workinfoid start" quit(1, "Invalid workinfoid start"
" %"PRId64" - must be >= 0", " %"PRId64" - must be >= 0",

4
src/ckdb.h

@ -52,7 +52,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "0.9.5" #define DB_VERSION "0.9.5"
#define CKDB_VERSION DB_VERSION"-0.650" #define CKDB_VERSION DB_VERSION"-0.651"
#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__
@ -240,6 +240,8 @@ extern int64_t confirm_last_workinfoid;
* workinfo and sharesummary */ * workinfo and sharesummary */
extern int64_t dbload_workinfoid_start; extern int64_t dbload_workinfoid_start;
extern int64_t dbload_workinfoid_finish; extern int64_t dbload_workinfoid_finish;
// Only restrict sharesummary, not workinfo
extern bool dbload_only_sharesummary;
// DB users,workers,auth load is complete // DB users,workers,auth load is complete
extern bool db_auths_complete; extern bool db_auths_complete;

3
src/ckdb_dbio.c

@ -2274,6 +2274,9 @@ bool workinfo_fill(PGconn *conn)
" workinfoid in (select workinfoid from blocks) )"; " workinfoid in (select workinfoid from blocks) )";
par = 0; par = 0;
params[par++] = tv_to_buf((tv_t *)(&default_expiry), NULL, 0); params[par++] = tv_to_buf((tv_t *)(&default_expiry), NULL, 0);
if (dbload_only_sharesummary)
params[par++] = bigint_to_buf(-1, NULL, 0);
else
params[par++] = bigint_to_buf(dbload_workinfoid_start, NULL, 0); params[par++] = bigint_to_buf(dbload_workinfoid_start, NULL, 0);
params[par++] = bigint_to_buf(dbload_workinfoid_finish, NULL, 0); params[par++] = bigint_to_buf(dbload_workinfoid_finish, NULL, 0);
PARCHK(par, params); PARCHK(par, params);

Loading…
Cancel
Save