diff --git a/backup.c b/backup.c index d2b62aba..d2a926e6 100644 --- a/backup.c +++ b/backup.c @@ -208,11 +208,6 @@ do_backup_database(parray *backup_list) (uint32) (prev_backup->start_lsn >> 32), (uint32) (prev_backup->start_lsn)); elog(LOG, "current.start_lsn: %X/%X", (uint32) (current.start_lsn >> 32), (uint32) (current.start_lsn)); - - /* TODO for some reason we sort the list for both incremental modes. - * Is it necessary? - */ - parray_qsort(backup_files_list, pgFileComparePathDesc); } /* @@ -243,13 +238,15 @@ do_backup_database(parray *backup_list) "Create new full backup before an incremental one.", ptrack_lsn, prev_backup->start_lsn); } + parray_qsort(backup_files_list, pgFileComparePathDesc); make_pagemap_from_ptrack(backup_files_list); } - /* sort pathname ascending TODO What for?*/ + /* Sort pathname ascending TODO What for?*/ parray_qsort(backup_files_list, pgFileComparePath); - /* make dirs before backup + /* + * Make directories before backup * and setup threads at the same time */ for (i = 0; i < parray_num(backup_files_list); i++) diff --git a/catalog.c b/catalog.c index b5cf7fec..0b877f07 100644 --- a/catalog.c +++ b/catalog.c @@ -375,16 +375,17 @@ pgBackupCreateDir(pgBackup *backup) void pgBackupWriteControl(FILE *out, pgBackup *backup) { - char timestamp[20]; + char timestamp[20]; + fprintf(out, "#Configuration\n"); fprintf(out, "backup-mode = %s\n", backupModes[backup->backup_mode]); - fprintf(out, "stream = %s\n", backup->stream?"true":"false"); + fprintf(out, "stream = %s\n", backup->stream?"true":"false"); fprintf(out, "\n#Compatibility\n"); fprintf(out, "block-size = %u\n", backup->block_size); fprintf(out, "xlog-block-size = %u\n", backup->wal_block_size); fprintf(out, "checksum-version = %u\n", backup->checksum_version); - + fprintf(out, "\n#Result backup info\n"); fprintf(out, "timelineid = %d\n", backup->tli); fprintf(out, "start-lsn = %x/%08x\n", @@ -415,7 +416,8 @@ pgBackupWriteControl(FILE *out, pgBackup *backup) fprintf(out, "status = %s\n", status2str(backup->status)); if (backup->parent_backup != 0) { - char *parent_backup = base36enc(backup->parent_backup); + char *parent_backup = base36enc(backup->parent_backup); + fprintf(out, "parent-backup-id = '%s'\n", parent_backup); free(parent_backup); } @@ -470,7 +472,7 @@ readBackupControlFile(const char *path) {'u', 0, "checksum_version", &backup->checksum_version, SOURCE_FILE_STRICT}, {'b', 0, "stream", &backup->stream, SOURCE_FILE_STRICT}, {'s', 0, "status", &status, SOURCE_FILE_STRICT}, - {'s', 0, "parent_backup", &parent_backup, SOURCE_FILE_STRICT}, + {'s', 0, "parent-backup-id", &parent_backup, SOURCE_FILE_STRICT}, {0} }; @@ -599,7 +601,7 @@ pgBackupCompareIdDesc(const void *l, const void *r) void pgBackupGetPath(const pgBackup *backup, char *path, size_t len, const char *subdir) { - char *datetime; + char *datetime; datetime = base36enc(backup->start_time); if (subdir) diff --git a/delete.c b/delete.c index 5adfa1c2..c42c9dda 100644 --- a/delete.c +++ b/delete.c @@ -252,6 +252,7 @@ static int pgBackupDeleteFiles(pgBackup *backup) { size_t i; + char *backup_id; char path[MAXPGPATH]; char timestamp[20]; parray *files; diff --git a/util.c b/util.c index 9cc17616..0901f7c7 100644 --- a/util.c +++ b/util.c @@ -14,11 +14,12 @@ #include "storage/bufpage.h" -char *base36enc(long unsigned int value) +char * +base36enc(long unsigned int value) { - char base36[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + char base36[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /* log(2**64) / log(36) = 12.38 => max 13 char + '\0' */ - char buffer[14]; + char buffer[14]; unsigned int offset = sizeof(buffer); buffer[--offset] = '\0'; @@ -29,7 +30,8 @@ char *base36enc(long unsigned int value) return strdup(&buffer[offset]); // warning: this must be free-d by the user } -long unsigned int base36dec(const char *text) +long unsigned int +base36dec(const char *text) { return strtoul(text, NULL, 36); }