Tune db dump logging at live upgrade, rename historydb file to .json

This commit is contained in:
Heikki Hannikainen 2012-10-22 17:09:41 +03:00
parent 8645573276
commit 9279578217
3 changed files with 6 additions and 6 deletions

View File

@ -230,7 +230,7 @@ static void dbdump_historydb(void)
FILE *fp;
char path[PATHLEN+1];
snprintf(path, PATHLEN, "%s/historydb.dump", rundir);
snprintf(path, PATHLEN, "%s/historydb.json", rundir);
fp = fopen(path,"w");
if (fp) {
historydb_dump(fp);
@ -282,10 +282,11 @@ static void dbload_all(void)
char path[PATHLEN+1];
char path_renamed[PATHLEN+1];
snprintf(path, PATHLEN, "%s/historydb.dump", rundir);
snprintf(path, PATHLEN, "%s/historydb.json", rundir);
fp = fopen(path,"r");
if (fp) {
snprintf(path_renamed, PATHLEN, "%s/historydb.dump.old", rundir);
hlog(LOG_INFO, "Live upgrade: Loading historydb from %s ...", path);
snprintf(path_renamed, PATHLEN, "%s/historydb.json.old", rundir);
if (rename(path, path_renamed) < 0) {
hlog(LOG_ERR, "Failed to rename historydb dump file %s to %s: %s",
path, path_renamed, strerror(errno));

View File

@ -264,7 +264,6 @@ int historydb_load(FILE *fp)
int ok = 0;
char buf[32768];
hlog(LOG_INFO, "Loading historydb from dump...");
while ((s = fgets(buf, sizeof(buf), fp))) {
if (historydb_load_entry(s) > 0)
ok++;

View File

@ -480,14 +480,14 @@ int status_read_liveupgrade(void)
snprintf(path, PATHLEN, "%s/liveupgrade.json", rundir);
snprintf(path_renamed, PATHLEN, "%s/liveupgrade.json.old", rundir);
hlog(LOG_DEBUG, "Live upgrade: reading status from %s", path);
fp = fopen(path, "r");
if (!fp) {
hlog(LOG_ERR, "liveupgrade dump file read failed: Could not open %s for reading: %s", path, strerror(errno));
return -1;
}
hlog(LOG_INFO, "Live upgrade: Loading client status from %s ...", path);
if (rename(path, path_renamed) < 0) {
hlog(LOG_ERR, "Failed to rename liveupgrade dump file %s to %s: %s",
path, path_renamed, strerror(errno));