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

Skip to content

Commit e7d4c24

Browse files
committed
Merge branch 'issue_63'
2 parents 16dca32 + bd6c601 commit e7d4c24

File tree

7 files changed

+210
-271
lines changed

7 files changed

+210
-271
lines changed

src/backup.c

+5-8
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,8 @@ pg_stop_backup(pgBackup *backup)
20252025
*/
20262026
if (backup_files_list)
20272027
{
2028-
file = pgFileNew(backup_label, true, 0, FIO_BACKUP_HOST);
2028+
file = pgFileNew(backup_label, backup_label, true, 0,
2029+
FIO_BACKUP_HOST);
20292030
file->crc = pgFileGetCRC(file->path, true, false,
20302031
&file->read_size, FIO_BACKUP_HOST);
20312032
file->write_size = file->read_size;
@@ -2070,7 +2071,8 @@ pg_stop_backup(pgBackup *backup)
20702071

20712072
if (backup_files_list)
20722073
{
2073-
file = pgFileNew(tablespace_map, true, 0, FIO_BACKUP_HOST);
2074+
file = pgFileNew(tablespace_map, tablespace_map, true, 0,
2075+
FIO_BACKUP_HOST);
20742076
if (S_ISREG(file->mode))
20752077
{
20762078
file->crc = pgFileGetCRC(file->path, true, false,
@@ -2476,7 +2478,6 @@ backup_files(void *arg)
24762478
file);
24772479
else
24782480
{
2479-
const char *src;
24802481
const char *dst;
24812482
bool skip = false;
24822483
char external_dst[MAXPGPATH];
@@ -2498,16 +2499,12 @@ backup_files(void *arg)
24982499
makeExternalDirPathByNum(external_dst,
24992500
arguments->external_prefix,
25002501
file->external_dir_num);
2501-
src = external_path;
25022502
dst = external_dst;
25032503
}
25042504
else
2505-
{
2506-
src = arguments->from_root;
25072505
dst = arguments->to_root;
2508-
}
25092506
if (skip ||
2510-
!copy_file(src, FIO_DB_HOST, dst, FIO_BACKUP_HOST, file))
2507+
!copy_file(FIO_DB_HOST, dst, FIO_BACKUP_HOST, file))
25112508
{
25122509
/* disappeared file not to be confused with 'not changed' */
25132510
if (file->write_size != FILE_NOT_FOUND)

src/data.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,8 @@ restore_data_file(const char *to_path, pgFile *file, bool allow_truncate,
938938
* it is either small control file or already compressed cfs file.
939939
*/
940940
bool
941-
copy_file(const char *from_root, fio_location from_location,
942-
const char *to_root, fio_location to_location, pgFile *file)
941+
copy_file(fio_location from_location, const char *to_root,
942+
fio_location to_location, pgFile *file)
943943
{
944944
char to_path[MAXPGPATH];
945945
FILE *in;
@@ -976,7 +976,7 @@ copy_file(const char *from_root, fio_location from_location,
976976
}
977977

978978
/* open backup file for write */
979-
join_path_components(to_path, to_root, file->path + strlen(from_root) + 1);
979+
join_path_components(to_path, to_root, file->rel_path);
980980
out = fio_fopen(to_path, PG_BINARY_W, to_location);
981981
if (out == NULL)
982982
{

0 commit comments

Comments
 (0)