1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-10-31 00:17:52 +02:00

Don't write invalid fields to ini files.

git-svn-id: http://pg-rman.googlecode.com/svn/trunk@31 182aca00-e38e-11de-a668-6fd11605f5ce
This commit is contained in:
itagaki.takahiro
2010-01-29 09:10:14 +00:00
parent 2b4c33e263
commit 7889cafbe3
2 changed files with 23 additions and 11 deletions

View File

@@ -356,15 +356,30 @@ pgBackupWriteResultSection(FILE *out, pgBackup *backup)
backup->start_lsn.xrecoff);
fprintf(out, "STOP_LSN=%x/%08x\n", backup->stop_lsn.xlogid,
backup->stop_lsn.xrecoff);
time2iso(timestamp, lengthof(timestamp), backup->start_time);
fprintf(out, "START_TIME='%s'\n", timestamp);
time2iso(timestamp, lengthof(timestamp), backup->end_time);
fprintf(out, "END_TIME='%s'\n", timestamp);
fprintf(out, "TOTAL_DATA_BYTES=" INT64_FORMAT "\n", backup->total_data_bytes);
fprintf(out, "READ_DATA_BYTES=" INT64_FORMAT "\n", backup->read_data_bytes);
fprintf(out, "READ_ARCLOG_BYTES=" INT64_FORMAT "\n", backup->read_arclog_bytes);
fprintf(out, "READ_SRVLOG_BYTES=" INT64_FORMAT "\n", backup->read_srvlog_bytes);
fprintf(out, "WRITE_BYTES=" INT64_FORMAT "\n", backup->write_bytes);
if (backup->end_time > 0)
{
time2iso(timestamp, lengthof(timestamp), backup->end_time);
fprintf(out, "END_TIME='%s'\n", timestamp);
}
if (backup->total_data_bytes != BYTES_INVALID)
fprintf(out, "TOTAL_DATA_BYTES=" INT64_FORMAT "\n",
backup->total_data_bytes);
if (backup->read_data_bytes != BYTES_INVALID)
fprintf(out, "READ_DATA_BYTES=" INT64_FORMAT "\n",
backup->read_data_bytes);
if (backup->read_arclog_bytes != BYTES_INVALID)
fprintf(out, "READ_ARCLOG_BYTES=" INT64_FORMAT "\n",
backup->read_arclog_bytes);
if (backup->read_srvlog_bytes != BYTES_INVALID)
fprintf(out, "READ_SRVLOG_BYTES=" INT64_FORMAT "\n",
backup->read_srvlog_bytes);
if (backup->write_bytes != BYTES_INVALID)
fprintf(out, "WRITE_BYTES=" INT64_FORMAT "\n",
backup->write_bytes);
fprintf(out, "BLOCK_SIZE=%u\n", backup->block_size);
fprintf(out, "XLOG_BLOCK_SIZE=%u\n", backup->wal_block_size);

5
util.c
View File

@@ -19,10 +19,7 @@ time2iso(char *buf, size_t len, time_t time)
{
struct tm *tm = localtime(&time);
if (time == (time_t) 0)
strncpy(buf,"****-**-** **:**:**", len);
else
strftime(buf, len, "%Y-%m-%d %H:%M:%S", tm);
strftime(buf, len, "%Y-%m-%d %H:%M:%S", tm);
}
const char *