mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-24 08:52:38 +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_backup_label[MAXPGPATH];
|
||||||
char path_tablespace_map[MAXPGPATH];
|
char path_tablespace_map[MAXPGPATH];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
pgFile *file;
|
||||||
|
|
||||||
pgBackupGetPath(¤t, path, lengthof(path), DATABASE_DIR);
|
pgBackupGetPath(¤t, path, lengthof(path), DATABASE_DIR);
|
||||||
snprintf(path_backup_label, lengthof(path_backup_label), "%s/backup_label", path);
|
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);
|
fwrite(PQgetvalue(res, 0, 1), 1, strlen(PQgetvalue(res, 0, 1)), fp);
|
||||||
fclose(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)
|
if (strlen(PQgetvalue(res, 0, 2)) == 0)
|
||||||
return;
|
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);
|
fwrite(PQgetvalue(res, 0, 2), 1, strlen(PQgetvalue(res, 0, 2)), fp);
|
||||||
fclose(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 (;;)
|
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;
|
break;
|
||||||
|
|
||||||
/* update CRC */
|
/* update CRC */
|
||||||
COMP_CRC32C(crc, buf, read_len);
|
COMP_CRC32C(crc, buf, read_len);
|
||||||
|
|
||||||
file->write_size += sizeof(buf);
|
file->write_size += read_len;
|
||||||
file->read_size += sizeof(buf);
|
file->read_size += read_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
errno_tmp = errno;
|
errno_tmp = errno;
|
||||||
|
4
dir.c
4
dir.c
@ -31,7 +31,7 @@ const char *pgdata_exclude[] =
|
|||||||
NULL
|
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);
|
static int BlackListCompare(const void *str1, const void *str2);
|
||||||
|
|
||||||
/* create directory, also create parent directories if necessary */
|
/* create directory, also create parent directories if necessary */
|
||||||
@ -60,7 +60,7 @@ dir_create_dir(const char *dir, mode_t mode)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static pgFile *
|
pgFile *
|
||||||
pgFileNew(const char *path, bool omit_symlink)
|
pgFileNew(const char *path, bool omit_symlink)
|
||||||
{
|
{
|
||||||
struct stat st;
|
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 int dir_create_dir(const char *path, mode_t mode);
|
||||||
extern void dir_copy_files(const char *from_root, const char *to_root);
|
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 pgFileDelete(pgFile *file);
|
||||||
extern void pgFileFree(void *file);
|
extern void pgFileFree(void *file);
|
||||||
extern pg_crc32 pgFileGetCRC(pgFile *file);
|
extern pg_crc32 pgFileGetCRC(pgFile *file);
|
||||||
|
Loading…
Reference in New Issue
Block a user