1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-11-24 08:52:38 +02:00

Little fixes

- read parent-backup-id not parent_backup
- sort backup_files_list only for ptrack backup
This commit is contained in:
Arthur Zakirov 2017-04-21 11:52:12 +03:00
parent a2bcbc77bd
commit e861c7f7f2
4 changed files with 19 additions and 17 deletions

View File

@ -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++)

View File

@ -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)

View File

@ -252,6 +252,7 @@ static int
pgBackupDeleteFiles(pgBackup *backup)
{
size_t i;
char *backup_id;
char path[MAXPGPATH];
char timestamp[20];
parray *files;

10
util.c
View File

@ -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);
}