|
|
@ -47,7 +47,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
#define DB_VLOCK "1" |
|
|
|
#define DB_VLOCK "1" |
|
|
|
#define DB_VERSION "0.7" |
|
|
|
#define DB_VERSION "0.7" |
|
|
|
#define CKDB_VERSION DB_VERSION"-0.46" |
|
|
|
#define CKDB_VERSION DB_VERSION"-0.47" |
|
|
|
|
|
|
|
|
|
|
|
#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__ |
|
|
@ -704,11 +704,10 @@ static int64_t confirm_range_finish; |
|
|
|
// The workinfoid range we are processing
|
|
|
|
// The workinfoid range we are processing
|
|
|
|
static int64_t confirm_first_workinfoid; |
|
|
|
static int64_t confirm_first_workinfoid; |
|
|
|
static int64_t confirm_last_workinfoid; |
|
|
|
static int64_t confirm_last_workinfoid; |
|
|
|
/* TODO: Stop the reload once we fully complete confirm_last_workinfoid
|
|
|
|
/* Stop the reload 11min after the 'last' workinfoid+1 appears
|
|
|
|
* and report a message saying so |
|
|
|
* ckpool uses 10min - but add 1min to be sure */ |
|
|
|
* This isn't mandatory - but it's simply a waste of processing to continue |
|
|
|
#define WORKINFO_AGE 660 |
|
|
|
* reloading data since it will all be ignored anyway */ |
|
|
|
static tv_t confirm_finish; |
|
|
|
static bool confirm_finished; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DB users,workers,auth load is complete
|
|
|
|
// DB users,workers,auth load is complete
|
|
|
|
static bool db_auths_complete = false; |
|
|
|
static bool db_auths_complete = false; |
|
|
@ -8881,7 +8880,7 @@ static bool reload_from(tv_t *start) |
|
|
|
processing++; |
|
|
|
processing++; |
|
|
|
count = 0; |
|
|
|
count = 0; |
|
|
|
|
|
|
|
|
|
|
|
while (!matched && !confirm_finished && fgets_unlocked(reload_buf, MAX_READ, fp)) |
|
|
|
while (!matched && fgets_unlocked(reload_buf, MAX_READ, fp)) |
|
|
|
matched = reload_line(conn, filename, ++count, reload_buf); |
|
|
|
matched = reload_line(conn, filename, ++count, reload_buf); |
|
|
|
|
|
|
|
|
|
|
|
if (ferror(fp)) { |
|
|
|
if (ferror(fp)) { |
|
|
@ -8897,9 +8896,11 @@ static bool reload_from(tv_t *start) |
|
|
|
total += count; |
|
|
|
total += count; |
|
|
|
fclose(fp); |
|
|
|
fclose(fp); |
|
|
|
free(filename); |
|
|
|
free(filename); |
|
|
|
if (matched || confirm_finished) |
|
|
|
if (matched) |
|
|
|
break; |
|
|
|
break; |
|
|
|
start->tv_sec += ROLL_S; |
|
|
|
start->tv_sec += ROLL_S; |
|
|
|
|
|
|
|
if (confirm_sharesummary && tv_newer(&confirm_finish, start)) |
|
|
|
|
|
|
|
break; |
|
|
|
filename = rotating_filename(restorefrom, start->tv_sec); |
|
|
|
filename = rotating_filename(restorefrom, start->tv_sec); |
|
|
|
fp = fopen(filename, "re"); |
|
|
|
fp = fopen(filename, "re"); |
|
|
|
if (!fp) { |
|
|
|
if (!fp) { |
|
|
@ -8957,7 +8958,7 @@ static bool reload_from(tv_t *start) |
|
|
|
if (everyone_die) |
|
|
|
if (everyone_die) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (!matched && !confirm_finished) { |
|
|
|
if (!matched) { |
|
|
|
ck_wlock(&fpm_lock); |
|
|
|
ck_wlock(&fpm_lock); |
|
|
|
if (first_pool_message) { |
|
|
|
if (first_pool_message) { |
|
|
|
LOGERR("%s() reload completed without finding ckpool queue match '%.32s'...", |
|
|
|
LOGERR("%s() reload completed without finding ckpool queue match '%.32s'...", |
|
|
@ -9343,21 +9344,53 @@ static void confirm_reload() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
workinfo.workinfoid = confirm_first_workinfoid + 1; |
|
|
|
/* These two below find the closest valid workinfo to the ones chosen
|
|
|
|
workinfo.expirydate.tv_sec = default_expiry.tv_sec; |
|
|
|
* however we still use the original ones chosen to select/ignore data */ |
|
|
|
workinfo.expirydate.tv_usec = default_expiry.tv_usec; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Find the workinfo before confirm_first_workinfoid+1
|
|
|
|
|
|
|
|
* i.e. the one we want or the previous before it */ |
|
|
|
|
|
|
|
workinfo.workinfoid = confirm_first_workinfoid + 1; |
|
|
|
|
|
|
|
workinfo.expirydate.tv_sec = date_begin.tv_sec; |
|
|
|
|
|
|
|
workinfo.expirydate.tv_usec = date_begin.tv_usec; |
|
|
|
look.data = (void *)(&workinfo); |
|
|
|
look.data = (void *)(&workinfo); |
|
|
|
wi_item = find_before_in_ktree(workinfo_root, &look, cmp_workinfo, ctx); |
|
|
|
wi_item = find_before_in_ktree(workinfo_root, &look, cmp_workinfo, ctx); |
|
|
|
if (wi_item) { |
|
|
|
if (wi_item) { |
|
|
|
copy_tv(&start, &(DATA_WORKINFO(wi_item)->createdate)); |
|
|
|
copy_tv(&start, &(DATA_WORKINFO(wi_item)->createdate)); |
|
|
|
if (DATA_WORKINFO(wi_item)->workinfoid != confirm_first_workinfoid) { |
|
|
|
if (DATA_WORKINFO(wi_item)->workinfoid != confirm_first_workinfoid) { |
|
|
|
LOGWARNING("%s() start workinfo not found ... using %"PRId64, |
|
|
|
LOGWARNING("%s() start workinfo not found ... using time of %"PRId64, |
|
|
|
__func__, DATA_WORKINFO(wi_item)->workinfoid); |
|
|
|
__func__, DATA_WORKINFO(wi_item)->workinfoid); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
start.tv_sec = 0; |
|
|
|
start.tv_sec = start.tv_usec = 0; |
|
|
|
LOGWARNING("%s() no start workinfo found ... using 0", __func__); |
|
|
|
LOGWARNING("%s() no start workinfo found ... using time 0", __func__); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Find the workinfo after confirm_last_workinfoid-1
|
|
|
|
|
|
|
|
* i.e. the one we want or the next after it */ |
|
|
|
|
|
|
|
workinfo.workinfoid = confirm_last_workinfoid - 1; |
|
|
|
|
|
|
|
workinfo.expirydate.tv_sec = date_eot.tv_sec; |
|
|
|
|
|
|
|
workinfo.expirydate.tv_usec = date_eot.tv_usec; |
|
|
|
|
|
|
|
look.data = (void *)(&workinfo); |
|
|
|
|
|
|
|
wi_item = find_after_in_ktree(workinfo_root, &look, cmp_workinfo, ctx); |
|
|
|
|
|
|
|
if (wi_item) { |
|
|
|
|
|
|
|
/* Now find the one after the one we found to determine the
|
|
|
|
|
|
|
|
* confirm_finish timestamp */ |
|
|
|
|
|
|
|
workinfo.workinfoid = DATA_WORKINFO(wi_item)->workinfoid; |
|
|
|
|
|
|
|
workinfo.expirydate.tv_sec = date_eot.tv_sec; |
|
|
|
|
|
|
|
workinfo.expirydate.tv_usec = date_eot.tv_usec; |
|
|
|
|
|
|
|
look.data = (void *)(&workinfo); |
|
|
|
|
|
|
|
wi_item = find_after_in_ktree(workinfo_root, &look, cmp_workinfo, ctx); |
|
|
|
|
|
|
|
if (wi_item) { |
|
|
|
|
|
|
|
copy_tv(&confirm_finish, &(DATA_WORKINFO(wi_item)->createdate)); |
|
|
|
|
|
|
|
confirm_finish.tv_sec += WORKINFO_AGE; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
confirm_finish.tv_sec = date_eot.tv_sec; |
|
|
|
|
|
|
|
confirm_finish.tv_usec = date_eot.tv_usec; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
confirm_finish.tv_sec = date_eot.tv_sec; |
|
|
|
|
|
|
|
confirm_finish.tv_usec = date_eot.tv_usec; |
|
|
|
|
|
|
|
LOGWARNING("%s() no finish workinfo found ... using EOT", __func__); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
LOGWARNING("%s() workinfo range: %"PRId64" to %"PRId64" ('%s' to '%s')", |
|
|
|
LOGWARNING("%s() workinfo range: %"PRId64" to %"PRId64" ('%s' to '%s')", |
|
|
|