From 7f21f63bb038acfbf06c220a6b8a7c653bb6b3a4 Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Thu, 23 May 2019 11:53:32 +0300 Subject: [PATCH] bugfix: allow restore of DELTA backup to skip unchanged non-data files --- src/restore.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/restore.c b/src/restore.c index 1b124483..0e1fde48 100644 --- a/src/restore.c +++ b/src/restore.c @@ -677,17 +677,23 @@ restore_files(void *arg) file->rel_path); /* - * For PAGE and PTRACK backups skip files which haven't changed + * For PAGE and PTRACK backups skip datafiles which haven't changed * since previous backup and thus were not backed up. * We cannot do the same when restoring DELTA backup because we need information - * about every file to correctly truncate them. + * about every datafile to correctly truncate them. */ - if (file->write_size == BYTES_INVALID && - (arguments->backup->backup_mode == BACKUP_MODE_DIFF_PAGE - || arguments->backup->backup_mode == BACKUP_MODE_DIFF_PTRACK)) + if (file->write_size == BYTES_INVALID) { - elog(VERBOSE, "The file didn`t change. Skip restore: \"%s\"", file->path); - continue; + /* data file, only PAGE and PTRACK can skip */ + if (((file->is_datafile && !file->is_cfs) && + (arguments->backup->backup_mode == BACKUP_MODE_DIFF_PAGE || + arguments->backup->backup_mode == BACKUP_MODE_DIFF_PTRACK)) || + /* non-data file can be skipped regardless of backup type */ + !(file->is_datafile && !file->is_cfs)) + { + elog(VERBOSE, "The file didn`t change. Skip restore: \"%s\"", file->path); + continue; + } } /* Directories were created before */