Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite02b7f7

Browse files
committed
Support -D options for archive-get andd archive-push commands
1 parent9865e09 commite02b7f7

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

‎src/archive.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ do_archive_push(char *wal_file_path, char *wal_file_name, bool overwrite)
2929
charcurrent_dir[MAXPGPATH];
3030
uint64system_id;
3131
boolis_compress= false;
32+
char*pgdata=instance_config.pgdata;
3233

3334
if (wal_file_name==NULL&&wal_file_path==NULL)
3435
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)
3940
if (wal_file_path==NULL)
4041
elog(ERROR,"required parameter not specified: --wal-file-path %%p");
4142

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+
}
4549
/* verify that archive-push --instance parameter is valid */
46-
system_id=get_system_identifier(current_dir);
50+
system_id=get_system_identifier(pgdata);
4751

4852
if (instance_config.pgdata==NULL)
4953
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)
5761
/* Create 'archlog_path' directory. Do nothing if it already exists. */
5862
fio_mkdir(arclog_path,DIR_PERMISSION,FIO_BACKUP_HOST);
5963

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);
6165
join_path_components(backup_wal_file_path,arclog_path,wal_file_name);
6266

6367
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)
8791
charbackup_wal_file_path[MAXPGPATH];
8892
charabsolute_wal_file_path[MAXPGPATH];
8993
charcurrent_dir[MAXPGPATH];
94+
char*pgdata=instance_config.pgdata;
9095

9196
if (wal_file_name==NULL&&wal_file_path==NULL)
9297
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)
97102
if (wal_file_path==NULL)
98103
elog(ERROR,"required parameter not specified: --wal-file-path %%p");
99104

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);
104112
join_path_components(backup_wal_file_path,arclog_path,wal_file_name);
105113

106114
elog(INFO,"pg_probackup archive-get from %s to %s",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp