@@ -29,6 +29,7 @@ do_archive_push(char *wal_file_path, char *wal_file_name, bool overwrite)
29
29
char current_dir [MAXPGPATH ];
30
30
uint64 system_id ;
31
31
bool is_compress = false;
32
+ char * pgdata = instance_config .pgdata ;
32
33
33
34
if (wal_file_name == NULL && wal_file_path == NULL )
34
35
elog (ERROR ,"required parameters are not specified: --wal-file-name %%f --wal-file-path %%p" );
@@ -39,11 +40,14 @@ do_archive_push(char *wal_file_path, char *wal_file_name, bool overwrite)
39
40
if (wal_file_path == NULL )
40
41
elog (ERROR ,"required parameter not specified: --wal-file-path %%p" );
41
42
42
- if (!getcwd (current_dir ,sizeof (current_dir )))
43
- elog (ERROR ,"getcwd() error" );
44
-
43
+ if (pgdata == NULL )
44
+ {
45
+ if (!getcwd (current_dir ,sizeof (current_dir )))
46
+ elog (ERROR ,"getcwd() error" );
47
+ pgdata = current_dir ;
48
+ }
45
49
/* verify that archive-push --instance parameter is valid */
46
- system_id = get_system_identifier (current_dir );
50
+ system_id = get_system_identifier (pgdata );
47
51
48
52
if (instance_config .pgdata == NULL )
49
53
elog (ERROR ,"cannot read pg_probackup.conf for this instance" );
@@ -57,7 +61,7 @@ do_archive_push(char *wal_file_path, char *wal_file_name, bool overwrite)
57
61
/* Create 'archlog_path' directory. Do nothing if it already exists. */
58
62
fio_mkdir (arclog_path ,DIR_PERMISSION ,FIO_BACKUP_HOST );
59
63
60
- join_path_components (absolute_wal_file_path ,current_dir ,wal_file_path );
64
+ join_path_components (absolute_wal_file_path ,pgdata ,wal_file_path );
61
65
join_path_components (backup_wal_file_path ,arclog_path ,wal_file_name );
62
66
63
67
elog (INFO ,"pg_probackup archive-push from %s to %s" ,absolute_wal_file_path ,backup_wal_file_path );
@@ -87,6 +91,7 @@ do_archive_get(char *wal_file_path, char *wal_file_name)
87
91
char backup_wal_file_path [MAXPGPATH ];
88
92
char absolute_wal_file_path [MAXPGPATH ];
89
93
char current_dir [MAXPGPATH ];
94
+ char * pgdata = instance_config .pgdata ;
90
95
91
96
if (wal_file_name == NULL && wal_file_path == NULL )
92
97
elog (ERROR ,"required parameters are not specified: --wal-file-name %%f --wal-file-path %%p" );
@@ -97,10 +102,13 @@ do_archive_get(char *wal_file_path, char *wal_file_name)
97
102
if (wal_file_path == NULL )
98
103
elog (ERROR ,"required parameter not specified: --wal-file-path %%p" );
99
104
100
- if (!getcwd (current_dir ,sizeof (current_dir )))
101
- elog (ERROR ,"getcwd() error" );
102
-
103
- join_path_components (absolute_wal_file_path ,current_dir ,wal_file_path );
105
+ if (pgdata == NULL )
106
+ {
107
+ if (!getcwd (current_dir ,sizeof (current_dir )))
108
+ elog (ERROR ,"getcwd() error" );
109
+ pgdata = current_dir ;
110
+ }
111
+ join_path_components (absolute_wal_file_path ,pgdata ,wal_file_path );
104
112
join_path_components (backup_wal_file_path ,arclog_path ,wal_file_name );
105
113
106
114
elog (INFO ,"pg_probackup archive-get from %s to %s" ,