Skip to content

Commit 7777afc

Browse files
committed
restore code cleanup
1 parent 2b8da45 commit 7777afc

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

data.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ restore_file_partly(const char *from_root,const char *to_root, pgFile *file)
406406
fclose(out);
407407
}
408408

409-
static void
409+
void
410410
restore_compressed_file(const char *from_root,
411411
const char *to_root,
412412
pgFile *file)
@@ -436,20 +436,6 @@ restore_data_file(const char *from_root,
436436
BackupPageHeader header;
437437
BlockNumber blknum;
438438

439-
if (!file->is_datafile)
440-
{
441-
/*
442-
* If the file is not a datafile and not compressed file,
443-
* just copy it.
444-
*/
445-
if (file->generation == -1)
446-
copy_file(from_root, to_root, file);
447-
else
448-
restore_compressed_file(from_root, to_root, file);
449-
450-
return;
451-
}
452-
453439
/* open backup mode file for read */
454440
in = fopen(file->path, "r");
455441
if (in == NULL)

pg_probackup.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ extern bool backup_data_file(const char *from_root, const char *to_root,
344344
pgFile *file, XLogRecPtr prev_backup_start_lsn);
345345
extern void restore_data_file(const char *from_root, const char *to_root,
346346
pgFile *file, pgBackup *backup);
347+
extern void restore_compressed_file(const char *from_root,
348+
const char *to_root, pgFile *file);
347349
extern bool is_compressed_data_file(pgFile *file);
348350
extern bool backup_compressed_file_partially(pgFile *file,
349351
void *arg,

restore.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,15 @@ restore_files(void *arg)
666666
}
667667

668668
/* restore file */
669-
restore_data_file(from_root, pgdata, file, arguments->backup);
669+
if (file->is_datafile)
670+
{
671+
if (is_compressed_data_file(file))
672+
restore_compressed_file(from_root, pgdata, file);
673+
else
674+
restore_data_file(from_root, pgdata, file, arguments->backup);
675+
}
676+
else
677+
copy_file(from_root, pgdata, file);
670678

671679
/* print size of restored file */
672680
elog(LOG, "restored %lu\n", (unsigned long) file->write_size);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy