More logging in db_upgrade().

This commit is contained in:
default 2022-11-23 14:54:22 +01:00
parent 494b1d43ba
commit 77f3488279

12
data.c
View file

@ -1320,12 +1320,17 @@ int db_upgrade(d_char **error)
int changed = 0; int changed = 0;
double f = 0.0; double f = 0.0;
do { for (;;) {
char *layout = xs_dict_get(srv_config, "layout"); char *layout = xs_dict_get(srv_config, "layout");
double nf; double nf;
f = nf = xs_number_get(layout); f = nf = xs_number_get(layout);
if (!(f < db_layout))
break;
srv_log(xs_fmt("db_upgrade %1.1lf < %1.1lf", f, db_layout));
if (f < 2.0) { if (f < 2.0) {
*error = xs_fmt("ERROR: unsupported old disk layout %1.1lf\n", f); *error = xs_fmt("ERROR: unsupported old disk layout %1.1lf\n", f);
ret = 0; ret = 0;
@ -1344,13 +1349,12 @@ int db_upgrade(d_char **error)
xs *nv = xs_number_new(f); xs *nv = xs_number_new(f);
srv_config = xs_dict_set(srv_config, "layout", nv); srv_config = xs_dict_set(srv_config, "layout", nv);
srv_log(xs_fmt("upgraded db layout to version %1.1lf", f)); srv_log(xs_fmt("db_upgrade converted to version %1.1lf", f));
changed++; changed++;
} }
else else
break; break;
}
} while (f < db_layout);
if (f > db_layout) { if (f > db_layout) {
*error = xs_fmt("ERROR: unknown future version %lf\n", f); *error = xs_fmt("ERROR: unknown future version %lf\n", f);