Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7f21f63

Browse files
committed
bugfix: allow restore of DELTA backup to skip unchanged non-data files
1 parent ac4ea5e commit 7f21f63

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/restore.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -677,17 +677,23 @@ restore_files(void *arg)
677677
file->rel_path);
678678

679679
/*
680-
* For PAGE and PTRACK backups skip files which haven't changed
680+
* For PAGE and PTRACK backups skip datafiles which haven't changed
681681
* since previous backup and thus were not backed up.
682682
* We cannot do the same when restoring DELTA backup because we need information
683-
* about every file to correctly truncate them.
683+
* about every datafile to correctly truncate them.
684684
*/
685-
if (file->write_size == BYTES_INVALID &&
686-
(arguments->backup->backup_mode == BACKUP_MODE_DIFF_PAGE
687-
|| arguments->backup->backup_mode == BACKUP_MODE_DIFF_PTRACK))
685+
if (file->write_size == BYTES_INVALID)
688686
{
689-
elog(VERBOSE, "The file didn`t change. Skip restore: \"%s\"", file->path);
690-
continue;
687+
/* data file, only PAGE and PTRACK can skip */
688+
if (((file->is_datafile && !file->is_cfs) &&
689+
(arguments->backup->backup_mode == BACKUP_MODE_DIFF_PAGE ||
690+
arguments->backup->backup_mode == BACKUP_MODE_DIFF_PTRACK)) ||
691+
/* non-data file can be skipped regardless of backup type */
692+
!(file->is_datafile && !file->is_cfs))
693+
{
694+
elog(VERBOSE, "The file didn`t change. Skip restore: \"%s\"", file->path);
695+
continue;
696+
}
691697
}
692698

693699
/* Directories were created before */

0 commit comments

Comments
 (0)