mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-28 09:33:54 +02:00
Add backup_label to file_database.txt for all checks.
This commit is contained in:
parent
e829899c0a
commit
c67832583e
11
backup.c
11
backup.c
@ -888,6 +888,7 @@ get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup)
|
||||
char path_backup_label[MAXPGPATH];
|
||||
char path_tablespace_map[MAXPGPATH];
|
||||
FILE *fp;
|
||||
pgFile *file;
|
||||
|
||||
pgBackupGetPath(¤t, path, lengthof(path), DATABASE_DIR);
|
||||
snprintf(path_backup_label, lengthof(path_backup_label), "%s/backup_label", path);
|
||||
@ -900,6 +901,11 @@ get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup)
|
||||
|
||||
fwrite(PQgetvalue(res, 0, 1), 1, strlen(PQgetvalue(res, 0, 1)), fp);
|
||||
fclose(fp);
|
||||
file = pgFileNew(path_backup_label, true);
|
||||
calc_file(file);
|
||||
free(file->path);
|
||||
file->path = strdup("backup_label");
|
||||
parray_append(backup_files_list, file);
|
||||
if (strlen(PQgetvalue(res, 0, 2)) == 0)
|
||||
return;
|
||||
|
||||
@ -910,6 +916,11 @@ get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup)
|
||||
|
||||
fwrite(PQgetvalue(res, 0, 2), 1, strlen(PQgetvalue(res, 0, 2)), fp);
|
||||
fclose(fp);
|
||||
file = pgFileNew(path_tablespace_map, true);
|
||||
calc_file(file);
|
||||
free(file->path);
|
||||
file->path = strdup("tablespace_map");
|
||||
parray_append(backup_files_list, file);
|
||||
}
|
||||
}
|
||||
|
||||
|
8
data.c
8
data.c
@ -722,14 +722,16 @@ calc_file(pgFile *file)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if ((read_len = fread(buf, 1, sizeof(buf), in)) != sizeof(buf))
|
||||
read_len = fread(buf, 1, sizeof(buf), in);
|
||||
|
||||
if(read_len == 0)
|
||||
break;
|
||||
|
||||
/* update CRC */
|
||||
COMP_CRC32C(crc, buf, read_len);
|
||||
|
||||
file->write_size += sizeof(buf);
|
||||
file->read_size += sizeof(buf);
|
||||
file->write_size += read_len;
|
||||
file->read_size += read_len;
|
||||
}
|
||||
|
||||
errno_tmp = errno;
|
||||
|
4
dir.c
4
dir.c
@ -31,7 +31,7 @@ const char *pgdata_exclude[] =
|
||||
NULL
|
||||
};
|
||||
|
||||
static pgFile *pgFileNew(const char *path, bool omit_symlink);
|
||||
pgFile *pgFileNew(const char *path, bool omit_symlink);
|
||||
static int BlackListCompare(const void *str1, const void *str2);
|
||||
|
||||
/* create directory, also create parent directories if necessary */
|
||||
@ -60,7 +60,7 @@ dir_create_dir(const char *dir, mode_t mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static pgFile *
|
||||
pgFile *
|
||||
pgFileNew(const char *path, bool omit_symlink)
|
||||
{
|
||||
struct stat st;
|
||||
|
@ -283,6 +283,7 @@ extern parray *dir_read_file_list(const char *root, const char *file_txt);
|
||||
extern int dir_create_dir(const char *path, mode_t mode);
|
||||
extern void dir_copy_files(const char *from_root, const char *to_root);
|
||||
|
||||
extern pgFile *pgFileNew(const char *path, bool omit_symlink);
|
||||
extern void pgFileDelete(pgFile *file);
|
||||
extern void pgFileFree(void *file);
|
||||
extern pg_crc32 pgFileGetCRC(pgFile *file);
|
||||
|
Loading…
Reference in New Issue
Block a user