Skip to content

Commit d28ea72

Browse files
committed
fix missing streamed WAL segments
1 parent 19c30a8 commit d28ea72

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/catalog.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
654654
while(i < parray_num(files))
655655
{
656656
pgFile *file = (pgFile *) parray_get(files, i);
657-
char *path = file->path;
657+
char *path = file->path; /* for streamed WAL files */
658658
char line[BLCKSZ];
659659
int len = 0;
660660

@@ -667,13 +667,13 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
667667
if (S_ISREG(file->mode) && file->write_size > 0)
668668
backup_size_on_disk += file->write_size;
669669

670-
if (file->external_dir_num && external_list)
671-
{
672-
path = GetRelativePath(path, parray_get(external_list,
673-
file->external_dir_num - 1));
674-
}
675-
else
676-
path = file->rel_path;
670+
/* for files from PGDATA and external files use rel_path
671+
* streamed WAL files has rel_path relative not to "database/"
672+
* but to "database/pg_wal", so for them use path.
673+
*/
674+
if ((root && strstr(path, root) == path) ||
675+
(file->external_dir_num && external_list))
676+
path = file->rel_path;
677677

678678
len = sprintf(line, "{\"path\":\"%s\", \"size\":\"" INT64_FORMAT "\", "
679679
"\"mode\":\"%u\", \"is_datafile\":\"%u\", "

0 commit comments

Comments
 (0)