1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-05 13:20:31 +02:00

[Issue #320] always backup and always restore pg_filenode.map

This commit is contained in:
Grigory Smolkin 2021-02-08 18:31:00 +03:00
parent 46c14304d7
commit b2ab1dfef8
3 changed files with 10 additions and 3 deletions

View File

@ -711,8 +711,9 @@ backup_non_data_file(pgFile *file, pgFile *prev_file,
/*
* If nonedata file exists in previous backup
* and its mtime is less than parent backup start time ... */
if (prev_file && file->exists_in_prev &&
file->mtime <= parent_backup_time)
if ((pg_strcasecmp(file->name, RELMAPPER_FILENAME) != 0) &&
(prev_file && file->exists_in_prev &&
file->mtime <= parent_backup_time))
{
file->crc = fio_get_crc32(from_fullpath, FIO_DB_HOST, false);

View File

@ -70,7 +70,8 @@ extern const char *PROGRAM_EMAIL;
#define BACKUP_RO_LOCK_FILE "backup_ro.pid"
#define DATABASE_FILE_LIST "backup_content.control"
#define PG_BACKUP_LABEL_FILE "backup_label"
#define PG_TABLESPACE_MAP_FILE "tablespace_map"
#define PG_TABLESPACE_MAP_FILE "tablespace_map"
#define RELMAPPER_FILENAME "pg_filenode.map"
#define EXTERNAL_DIR "external_directories/externaldir"
#define DATABASE_MAP "database_map"
#define HEADER_MAP "page_header_map"

View File

@ -903,6 +903,11 @@ restore_chain(pgBackup *dest_backup, parray *parent_chain,
if (parray_bsearch(dest_backup->files, file, pgFileCompareRelPathWithExternal))
redundant = false;
/* pg_filenode.map are always restored, because it's crc cannot be trusted */
if (file->external_dir_num == 0 &&
pg_strcasecmp(file->name, RELMAPPER_FILENAME) == 0)
redundant = true;
/* do not delete the useful internal directories */
if (S_ISDIR(file->mode) && !redundant)
continue;