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

Commitf0703e5

Browse files
committed
Remove ARCLOG_PATH option.
1 parent6446ace commitf0703e5

File tree

11 files changed

+21
-93
lines changed

11 files changed

+21
-93
lines changed

‎README.md‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ Example backup (assuming PostgreSQL is running):
104104
```bash
105105
# Init pg_aramn backup folder
106106
pg_arman init -B /home/postgres/backup/pgarman
107-
cat<<__EOF__ >> /home/postgres/backup/pgarman/pg_arman.ini
108-
ARCLOG_PATH = '/home/postgres/backup/arman/wal'
109-
__EOF__
110107
# Make full backup with 2 thread and verbose mode.
111108
pg_arman backup -B /home/postgres/backup/pgarman -D /home/postgres/pgdata/arman -b full -v -j 2
112109
# Validate backup
@@ -142,9 +139,6 @@ Example backup (assuming PostgreSQL is running):
142139
```bash
143140
# Init pg_aramn backup folder
144141
pg_arman init -B /home/postgres/backup/pgarman
145-
cat<<__EOF__ >> /home/postgres/backup/pgarman/pg_arman.ini
146-
ARCLOG_PATH = '/home/postgres/backup/arman/wal'
147-
__EOF__
148142
# Make full backup with 2 thread and verbose mode.
149143
pg_arman backup -B /home/postgres/backup/pgarman -D /home/postgres/pgdata/arman -b full -v -j 2 --stream
150144
# Validate backup

‎expected/init.out‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@ results/init/backup/
66
results/init/backup/backup/
77
results/init/backup/backup/pg_xlog/
88
results/init/backup/pg_arman.ini
9+
results/init/backup/wal/
910
###### INIT COMMAND TEST-0002 ######
1011
###### success with archive_command and log_directory ######
1112
0
1213
results/init/backup/
1314
results/init/backup/backup/
1415
results/init/backup/backup/pg_xlog/
1516
results/init/backup/pg_arman.ini
17+
results/init/backup/wal/
1618
###### INIT COMMAND TEST-0003 ######
1719
###### success without archive_command ######
18-
WARNING: ARCLOG_PATH is not set because archive_command is empty.Please set ARCLOG_PATH in pg_arman.ini or environmental variable
1920
0
2021
results/init/backup/
2122
results/init/backup/backup/
2223
results/init/backup/backup/pg_xlog/
2324
results/init/backup/pg_arman.ini
25+
results/init/backup/wal/
2426
###### INIT COMMAND TEST-0004 ######
2527
###### failure with backup catalog already existed ######
2628
ERROR: backup catalog already exist. and it's not empty

‎expected/option.out‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Usage:
1313

1414
Common Options:
1515
-D, --pgdata=PATH location of the database storage area
16-
-A, --arclog-path=PATH location of archive WAL storage area
1716
-B, --backup-path=PATH location of the backup storage area
1817
-c, --check show what would have been done
1918
-j, --threads=NUM num threads for backup and restore
@@ -76,11 +75,6 @@ ERROR: Required parameter not specified: BACKUP_MODE (-b, --backup-mode)
7675
ERROR: invalid backup-mode "bad"
7776
1
7877

79-
###### COMMAND OPTION TEST-0006 ######
80-
###### delete failure without archive path ######
81-
ERROR: delete command needs ARCLOG_PATH (-A, --arclog-path) to be set
82-
1
83-
8478
###### COMMAND OPTION TEST-0007 ######
8579
###### delete failure without DATE ######
8680
ERROR: required delete range option not specified: delete DATE

‎init.c‎

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ int
3030
do_init(void)
3131
{
3232
charpath[MAXPGPATH];
33+
chararclog_path_dir[MAXPGPATH];
3334
char*log_directory=NULL;
3435
char*archive_command=NULL;
3536
FILE*fp;
@@ -66,51 +67,8 @@ do_init(void)
6667
if (fp==NULL)
6768
elog(ERROR,"cannot create pg_arman.ini: %s",strerror(errno));
6869

69-
/* set ARCLOG_PATH refered with log_directory */
70-
if (arclog_path==NULL&&archive_command&&archive_command[0])
71-
{
72-
char*command=pgut_strdup(archive_command);
73-
char*begin;
74-
char*end;
75-
char*fname;
76-
77-
/* example: 'cp "%p" /path/to/arclog/"%f"' */
78-
for (begin=command;*begin;)
79-
{
80-
begin=begin+strspn(begin," \n\r\t\v");
81-
end=begin+strcspn(begin," \n\r\t\v");
82-
*end='\0';
83-
84-
if ((fname=strstr(begin,"%f"))!=NULL)
85-
{
86-
while (strchr(" \n\r\t\v\"'",*begin))
87-
begin++;
88-
fname--;
89-
while (fname>begin&&strchr(" \n\r\t\v\"'/",fname[-1]))
90-
fname--;
91-
*fname='\0';
92-
93-
if (is_absolute_path(begin))
94-
arclog_path=pgut_strdup(begin);
95-
break;
96-
}
97-
98-
begin=end+1;
99-
}
100-
101-
free(command);
102-
}
103-
if (arclog_path)
104-
{
105-
fprintf(fp,"ARCLOG_PATH='%s'\n",arclog_path);
106-
elog(INFO,"ARCLOG_PATH is set to '%s'",arclog_path);
107-
}
108-
elseif (archive_command&&archive_command[0])
109-
elog(WARNING,"ARCLOG_PATH is not set because failed to parse archive_command '%s'."
110-
"Please set ARCLOG_PATH in pg_arman.ini or environmental variable",archive_command);
111-
else
112-
elog(WARNING,"ARCLOG_PATH is not set because archive_command is empty."
113-
"Please set ARCLOG_PATH in pg_arman.ini or environmental variable");
70+
join_path_components(arclog_path_dir,backup_path,"wal");
71+
dir_create_dir(arclog_path_dir,DIR_PERMISSION);
11472

11573
fprintf(fp,"\n");
11674
fclose(fp);

‎pg_arman.c‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const char *PROGRAM_EMAIL= "https://github.com/stalkerg/pg_arman/issues";
2222
/* path configuration */
2323
char*backup_path;
2424
char*pgdata;
25-
char*arclog_path=NULL;
25+
chararclog_path[MAXPGPATH];
2626

2727
/* common configuration */
2828
boolcheck= false;
@@ -57,7 +57,6 @@ static pgut_option options[] =
5757
{
5858
/* directory options */
5959
{'s','D',"pgdata",&pgdata,SOURCE_ENV },
60-
{'s','A',"arclog-path",&arclog_path,SOURCE_ENV },
6160
{'s','B',"backup-path",&backup_path,SOURCE_ENV },
6261
/* common options */
6362
{'b','c',"check",&check },
@@ -171,18 +170,13 @@ main(int argc, char *argv[])
171170
elog(ERROR,"-B, --backup-path must be an absolute path");
172171
if (pgdata!=NULL&& !is_absolute_path(pgdata))
173172
elog(ERROR,"-D, --pgdata must be an absolute path");
174-
if (arclog_path!=NULL&& !is_absolute_path(arclog_path))
175-
elog(ERROR,"-A, --arclog-path must be an absolute path");
176173

177-
/* Sanity checks with commands */
178-
if (pg_strcasecmp(cmd,"delete")==0&&arclog_path==NULL)
179-
elog(ERROR,"delete command needs ARCLOG_PATH (-A, --arclog-path) to be set");
174+
join_path_components(arclog_path,backup_path,"wal");
180175

181176
/* setup exclusion list for file search */
182177
for (i=0;pgdata_exclude[i];i++);/* find first empty slot */
183178

184-
if (arclog_path)
185-
pgdata_exclude[i++]=arclog_path;
179+
pgdata_exclude[i++]=arclog_path;
186180

187181
if(!backup_logs)
188182
pgdata_exclude[i++]="pg_log";
@@ -241,7 +235,6 @@ pgut_help(bool details)
241235

242236
printf(_("\nCommon Options:\n"));
243237
printf(_(" -D, --pgdata=PATH location of the database storage area\n"));
244-
printf(_(" -A, --arclog-path=PATH location of archive WAL storage area\n"));
245238
printf(_(" -B, --backup-path=PATH location of the backup storage area\n"));
246239
printf(_(" -c, --check show what would have been done\n"));
247240
printf(_(" -j, --threads=NUM num threads for backup and restore\n"));

‎pg_arman.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ typedef union DataPage
196196
/* path configuration */
197197
externchar*backup_path;
198198
externchar*pgdata;
199-
externchar*arclog_path;
199+
externchararclog_path[MAXPGPATH];
200200

201201
/* common configuration */
202202
externboolcheck;

‎restore.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ do_restore(const char *target_time,
6868
if (pgdata==NULL)
6969
elog(ERROR,
7070
"required parameter not specified: PGDATA (-D, --pgdata)");
71-
if (arclog_path==NULL)
72-
elog(ERROR,
73-
"required parameter not specified: ARCLOG_PATH (-A, --arclog-path)");
7471

7572
elog(LOG,"========================================");
7673
elog(LOG,"restore start");

‎show.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ do_show(pgBackupRange *range, bool show_all)
2525
* the parent TLI from history field generated by server after
2626
* child timeline is chosen.
2727
*/
28-
if (arclog_path==NULL)
29-
elog(ERROR,
30-
"required parameter not specified: ARCLOG_PATH (-A, --arclog-path)");
31-
3228
if (pgBackupRangeIsSingle(range))
3329
{
3430
pgBackup*backup;

‎sql/common.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ BASE_PATH=`pwd`
2626
TEST_BASE=${BASE_PATH}/results/${TEST_NAME}
2727
PGDATA_PATH=${TEST_BASE}/data
2828
BACKUP_PATH=${TEST_BASE}/backup
29-
ARCLOG_PATH=${TEST_BASE}/arclog
29+
ARCLOG_PATH=${BACKUP_PATH}/wal
3030
TBLSPC_PATH=${TEST_BASE}/tblspc
3131
TEST_PGPORT=54321
3232
export PGDATA=${PGDATA_PATH}

‎sql/init.sh‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
pg_ctl stop -m immediate> /dev/null2>&1
1212
rm -fr${PGDATA}
1313
rm -fr${BACKUP_PATH}
14-
rm -fr${ARCLOG_PATH}&& mkdir -p${ARCLOG_PATH}
1514

1615
initdb --no-locale> /dev/null2>&1
1716
cp${PGDATA}/postgresql.conf${PGDATA}/postgresql.conf_org

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp