diff --git a/src/ckdb.c b/src/ckdb.c index 07e8b056..c0305a38 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -272,6 +272,8 @@ static tv_t reload_timestamp; * workinfo and sharesummary */ int64_t dbload_workinfoid_start = -1; int64_t dbload_workinfoid_finish = MAXID; +// Only restrict sharesummary, not workinfo +bool dbload_only_sharesummary = false; // DB users,workers,auth load is complete bool db_auths_complete = false; @@ -1235,6 +1237,8 @@ static bool setup_data() if (dbload_workinfoid_start != -1) { LOGWARNING("WARNING: dbload starting at workinfoid %"PRId64, dbload_workinfoid_start); + if (dbload_only_sharesummary) + LOGWARNING("NOTICE: dbload only restricting sharesummary"); } if (!getdata3() || everyone_die) @@ -3567,7 +3571,15 @@ int main(int argc, char **argv) case 'w': // 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) { quit(1, "Invalid workinfoid start" " %"PRId64" - must be >= 0", diff --git a/src/ckdb.h b/src/ckdb.h index b25150c2..ef97eb84 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -52,7 +52,7 @@ #define DB_VLOCK "1" #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_HERE __FILE__, __func__, __LINE__ @@ -240,6 +240,8 @@ extern int64_t confirm_last_workinfoid; * workinfo and sharesummary */ extern int64_t dbload_workinfoid_start; extern int64_t dbload_workinfoid_finish; +// Only restrict sharesummary, not workinfo +extern bool dbload_only_sharesummary; // DB users,workers,auth load is complete extern bool db_auths_complete; diff --git a/src/ckdb_dbio.c b/src/ckdb_dbio.c index c5a23fda..7d5bddd7 100644 --- a/src/ckdb_dbio.c +++ b/src/ckdb_dbio.c @@ -2274,7 +2274,10 @@ bool workinfo_fill(PGconn *conn) " workinfoid in (select workinfoid from blocks) )"; par = 0; params[par++] = tv_to_buf((tv_t *)(&default_expiry), NULL, 0); - params[par++] = bigint_to_buf(dbload_workinfoid_start, 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_finish, NULL, 0); PARCHK(par, params); res = PQexecParams(conn, sel, par, NULL, (const char **)params, NULL, NULL, 0, CKPQ_READ);