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

Commit820485d

Browse files
author
Michael Paquier
committed
Strip off archive backup mode
This mode is not actually necessary if we consider that the core ofpg_rman is the obtention of differential and full backups, the serverbeing afterwards in charge to recover necessary WAL segments from thearchive.Regression tests and documentation are updated in accordance to thechanges.
1 parent5988e6b commit820485d

File tree

21 files changed

+71
-812
lines changed

21 files changed

+71
-812
lines changed

‎backup.c

Lines changed: 5 additions & 378 deletions
Large diffs are not rendered by default.

‎catalog.c

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -268,37 +268,13 @@ catalog_get_last_data_backup(parray *backup_list, TimeLineID tli)
268268
returnNULL;
269269
}
270270

271-
/*
272-
* Find the last completed archived WAL backup from the backup list
273-
* on current timeline.
274-
*/
275-
pgBackup*
276-
catalog_get_last_arclog_backup(parray*backup_list,TimeLineIDtli)
277-
{
278-
inti;
279-
pgBackup*backup=NULL;
280-
281-
/* backup_list is sorted in order of descending ID */
282-
for (i=0;i<parray_num(backup_list);i++)
283-
{
284-
backup= (pgBackup*)parray_get(backup_list,i);
285-
286-
/* we need completed archived WAL backup */
287-
if (backup->status==BACKUP_STATUS_OK&&
288-
backup->tli==tli)
289-
returnbackup;
290-
}
291-
292-
returnNULL;
293-
}
294-
295271
/* create backup directory in $BACKUP_PATH */
296272
int
297273
pgBackupCreateDir(pgBackup*backup)
298274
{
299275
inti;
300276
charpath[MAXPGPATH];
301-
char*subdirs[]= {DATABASE_DIR,ARCLOG_DIR,NULL };
277+
char*subdirs[]= {DATABASE_DIR,NULL };
302278

303279
pgBackupGetPath(backup,path,lengthof(path),NULL);
304280
dir_create_dir(path,DIR_PERMISSION);
@@ -319,7 +295,7 @@ pgBackupCreateDir(pgBackup *backup)
319295
void
320296
pgBackupWriteConfigSection(FILE*out,pgBackup*backup)
321297
{
322-
staticconstchar*modes[]= {"","ARCHIVE","INCREMENTAL","FULL"};
298+
staticconstchar*modes[]= {"","INCREMENTAL","FULL"};
323299

324300
fprintf(out,"# configuration\n");
325301

@@ -361,13 +337,6 @@ pgBackupWriteResultSection(FILE *out, pgBackup *backup)
361337
if (backup->data_bytes!=BYTES_INVALID)
362338
fprintf(out,"DATA_BYTES="INT64_FORMAT"\n",
363339
backup->data_bytes);
364-
if (backup->arclog_bytes!=BYTES_INVALID)
365-
fprintf(out,"ARCLOG_BYTES="INT64_FORMAT"\n",
366-
backup->arclog_bytes);
367-
if (backup->backup_bytes!=BYTES_INVALID)
368-
fprintf(out,"BACKUP_BYTES="INT64_FORMAT"\n",
369-
backup->backup_bytes);
370-
371340
fprintf(out,"BLOCK_SIZE=%u\n",backup->block_size);
372341
fprintf(out,"XLOG_BLOCK_SIZE=%u\n",backup->wal_block_size);
373342

@@ -423,8 +392,6 @@ catalog_read_ini(const char *path)
423392
{'u',0,"recovery-xid",NULL,SOURCE_ENV },
424393
{'t',0,"recovery-time",NULL,SOURCE_ENV },
425394
{'I',0,"data-bytes",NULL,SOURCE_ENV },
426-
{'I',0,"arclog-bytes",NULL,SOURCE_ENV },
427-
{'I',0,"backup-bytes",NULL,SOURCE_ENV },
428395
{'u',0,"block-size",NULL,SOURCE_ENV },
429396
{'u',0,"xlog-block-size",NULL,SOURCE_ENV },
430397
{'s',0,"status",NULL,SOURCE_ENV },
@@ -449,8 +416,6 @@ catalog_read_ini(const char *path)
449416
options[i++].var=&backup->recovery_xid;
450417
options[i++].var=&backup->recovery_time;
451418
options[i++].var=&backup->data_bytes;
452-
options[i++].var=&backup->arclog_bytes;
453-
options[i++].var=&backup->backup_bytes;
454419
options[i++].var=&backup->block_size;
455420
options[i++].var=&backup->wal_block_size;
456421
options[i++].var=&status;
@@ -527,8 +492,6 @@ parse_backup_mode(const char *value)
527492
returnBACKUP_MODE_FULL;
528493
elseif (len>0&&pg_strncasecmp("incremental",v,len)==0)
529494
returnBACKUP_MODE_INCREMENTAL;
530-
elseif (len>0&&pg_strncasecmp("archive",v,len)==0)
531-
returnBACKUP_MODE_ARCHIVE;
532495

533496
/* Backup mode is invalid, so leave with an error */
534497
elog(ERROR_ARGS,_("invalid backup-mode \"%s\""),value);
@@ -597,6 +560,4 @@ catalog_init_config(pgBackup *backup)
597560
backup->recovery_xid=0;
598561
backup->recovery_time= (time_t)0;
599562
backup->data_bytes=BYTES_INVALID;
600-
backup->arclog_bytes=BYTES_INVALID;
601-
backup->backup_bytes=BYTES_INVALID;
602563
}

‎data/sample_backup/20090531/170553/backup.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ STOP_LSN=0/0b4c8020
88
START_TIME='2009-05-31 17:05:53'
99
END_TIME='2009-05-31 17:09:13'
1010
DATA_BYTES=1242102558
11-
ARCLOG_BYTES=9223372036854775807
12-
BACKUP_BYTES=242102558
1311
BLOCK_SIZE=8192
1412
XLOG_BLOCK_SIZE=8192
1513
STATUS=DONE

‎data/sample_backup/20090601/170553/backup.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ STOP_LSN=0/0b4c8020
88
START_TIME='2009-06-01 17:05:53'
99
END_TIME='2009-06-01 17:09:13'
1010
DATA_BYTES=9223372036854775807
11-
ARCLOG_BYTES=16777216
12-
BACKUP_BYTES=162372983
1311
BLOCK_SIZE=8192
1412
XLOG_BLOCK_SIZE=8192
1513
STATUS=DONE
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# configuration
2-
BACKUP_MODE=ARCHIVE
2+
BACKUP_MODE=FULL
33
COMPRESS_DATA=NO
44
# result
55
TIMELINEID=1
@@ -8,8 +8,6 @@ STOP_LSN=0/0b4c8020
88
START_TIME='2009-06-02 17:05:03'
99
END_TIME='2009-06-02 17:05:03'
1010
DATA_BYTES=-1
11-
ARCLOG_BYTES=-1
12-
BACKUP_BYTES=162372983
1311
BLOCK_SIZE=8192
1412
XLOG_BLOCK_SIZE=8192
1513
STATUS=DELETED

‎data/sample_backup/20090603/170553/backup.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ STOP_LSN=0/0b4c8020
88
START_TIME='2009-06-03 17:05:53'
99
END_TIME='2009-06-03 17:05:53'
1010
DATA_BYTES=-1
11-
ARCLOG_BYTES=-1
12-
BACKUP_BYTES=-1
1311
BLOCK_SIZE=8192
1412
XLOG_BLOCK_SIZE=8192
1513
STATUS=RUNNING

‎delete.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ pgBackupDeleteFiles(pgBackup *backup)
197197
files=parray_new();
198198
pgBackupGetPath(backup,path,lengthof(path),DATABASE_DIR);
199199
dir_list_file(files,path,NULL, true, true);
200-
pgBackupGetPath(backup,path,lengthof(path),ARCLOG_DIR);
201-
dir_list_file(files,path,NULL, true, true);
202200

203201
/* delete leaf node first */
204202
parray_qsort(files,pgFileComparePathDesc);

‎doc/pg_rman.txt

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@ files.
2121
== DESCRIPTION ==
2222

2323
pg_rman is a utility program to backup and restore PostgreSQL database.
24-
It takes a physical online backup of whole database cluster and archive
25-
WALs.
2624

2725
It proposes the following features:
2826

2927
- Backup while database runs including tablespaces with just one
3028
command
3129
- Recovery from backup with just one command, with customized targets
3230
to facilitate the use of PITR.
33-
- Support for full, incrementalandarchive backup
31+
- Support for fullandincremental
3432
- Compression of backup files
3533
- Management of backups with integrated catalog
3634

@@ -76,7 +74,6 @@ Backup target can be one of the following types:
7674
- Full backup, backup a whole database cluster.
7775
- Incremental backup, backup only files or pages modified after the last
7876
verified backup.
79-
- Archive WAL backup, Backup only archive WAL files.
8077

8178
It is recommended to verify backup files as soon as possible after backup.
8279
Unverified backup cannot be used in restore and in incremental backup.
@@ -143,12 +140,11 @@ Here are some commands to restore from a backup:
143140
The fields are:
144141

145142
* Start: start time of backup
146-
* Mode: Mode of backup: FULL (full), INCR (incremental)orARCH (archive)
143+
* Mode: Mode of backup: FULL (full)orINCR (incremental)
147144
* Current TLI: current timeline of backup
148145
* Parent TLI: parent timeline of backup
149146
* Time: total time necessary to take this backup
150147
* Data: size of data files
151-
* WAL: size of read WAL archive files
152148
* Log: size of read server log files
153149
* Backup: size of backup (= written size)
154150
* Status: status of backup. Possible values are:
@@ -175,8 +171,6 @@ When a date is specified, more details about a backup is retrieved:
175171
RECOVERY_XID=1759
176172
RECOVERY_TIME='2011-11-27 19:15:53'
177173
DATA_BYTES=25420184
178-
ARCLOG_BYTES=32218912
179-
BACKUP_BYTES=242919520
180174
BLOCK_SIZE=8192
181175
XLOG_BLOCK_SIZE=8192
182176
STATUS=OK
@@ -202,8 +196,8 @@ absolute paths; relative paths are not allowed.
202196
restore.
203197

204198
*-A* _PATH_ / *--arclog-path*=_PATH_::
205-
The absolute path of archive WAL directory. Requiredon backup
206-
andrestore.
199+
The absolute path of archive WAL directory. Requiredfor restore
200+
andshow command.
207201

208202
*-B* _PATH_ / *--backup-path*=_PATH_::
209203
The absolute path of backup catalog. This option is mandatory.
@@ -220,9 +214,8 @@ absolute paths; relative paths are not allowed.
220214

221215
*-b* _BACKUPMODE_ / *--backup-mode*=_BACKUPMODE_::
222216
Specify backup target files. Available options are: "full",
223-
"incremental" and "archive".
224-
Abbreviated forms (prefix match) are also available. For example,
225-
-b f means "full" backup.
217+
"incremental". Abbreviated forms (prefix match) are also available.
218+
For example, -b f means "full" backup.
226219

227220
*-Z* / *--compress-data*::
228221
Compress backup files with zlib if specified.
@@ -242,12 +235,6 @@ absolute paths; relative paths are not allowed.
242235
--keep-data-days means days to be kept.
243236
Only files exceeded one of those settings are deleted.
244237

245-
*--keep-arclog-files*=_NUMBER_ / *--keep-arclog-days*=_DAYS_::
246-
Specify how long backuped archive WAL files will be kept.
247-
--keep-arclog-files means number of backup files.
248-
--keep-arclog-days means days to be kept. When backup is run, only
249-
files exceeded one of those settings are deleted from archive storage.
250-
251238
=== RESTORE OPTIONS ===
252239

253240
The parameters whose name start are started with --recovery refer to
@@ -268,11 +255,6 @@ the same parameters as the ones in recovery.confin recovery.conf.
268255
*--recovery-target-inclusive*::
269256
Specifies whether server pauses when recovery target is reached.
270257

271-
*--hard-copy*::
272-
Archived WAL files are copied to archive WAL storage area. If you
273-
do not specify --hard-copy, pg_rman makes symlink to archive WAL
274-
where are in the backup catalog directory.
275-
276258
=== CATALOG OPTIONS ===
277259

278260
*-a* / *--show-all*::
@@ -350,7 +332,6 @@ variables or in configuration file as follows:
350332
--recovery-target-xidRECOVERY_TARGET_XIDYes
351333
--recovery-target-timeRECOVERY_TARGET_TIMEYes
352334
--recovery-target-inclusive RECOVERY_TARGET_INCLUSIVE Yes
353-
--hard-copyHARD_COPYYes
354335

355336
Variable names in configuration file are the same as long names or names
356337
of environment variables. The password can not be specified in command
@@ -403,7 +384,7 @@ pg_rman returns exit codes for each error status.
403384
13ERROR_INTERRUPTEDInterrupted by user (Ctrl+C etc.)
404385
14ERROR_PG_COMMANDSQL error
405386
15ERROR_PG_CONNECTCannot connect to PostgreSQL server
406-
20ERROR_ARCHIVE_FAILEDCannot archive WALfiles
387+
20ERROR_ARCHIVE_FAILEDCannot archive WALfile
407388
21ERROR_NO_BACKUPBackup file not found
408389
22ERROR_CORRUPTEDBackup file is broken
409390
23ERROR_ALREADY_RUNNINGCannot start because another pg_rman

‎expected/backup_restore.out

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,11 @@ CHECKPOINT
88
incremental database backup
99
CHECKPOINT
1010
CHECKPOINT
11-
archived WAL backup
1211
stop DB during running pgbench
13-
diff files in BACKUP_PATH/backup/pg_xlog
14-
diff files in BACKUP_PATH/backup/pg_xlog
1512
full database backup after recovery
1613
CHECKPOINT
17-
# of files in BACKUP_PATH/backup/pg_xlog
18-
0
1914
# of symbolic links in ARCLOG_PATH
2015
0
21-
# of files in BACKUP_PATH/timeline_history
22-
2
2316
# of recovery target option in recovery.conf
2417
3
2518
# of deleted backups (show all)
@@ -30,4 +23,4 @@ delete backup
3023
# of deleted backups
3124
4
3225
# of deleted backups
33-
9
26+
8

‎expected/init.out

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ results/init_test/
66
results/init_test/backup/
77
results/init_test/backup/pg_xlog/
88
results/init_test/pg_rman.ini
9-
results/init_test/timeline_history/
109
\! pg_rman init -B ${PWD}/results/init_test --quiet;echo $?
1110
ERROR: backup catalog already exist. and it's not empty.
1211
2

‎expected/option.out

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@ Common Options:
1717
-v, --verbose output process information
1818

1919
Backup options:
20-
-b, --backup-mode=MODE full, incremental,orarchive
20+
-b, --backup-mode=MODE fullorincremental
2121
-Z, --compress-data compress data backup with zlib
2222
-C, --smooth-checkpoint do smooth checkpoint before backup
2323
--validate validate backup after taking it
2424
--keep-data-generations=N keep GENERATION of full data backup
2525
--keep-data-days=DAY keep enough data backup to recover to DAY days age
26-
--keep-arclog-files=NUM keep NUM of archived WAL
27-
--keep-arclog-days=DAY keep archived WAL modified in DAY days
2826

2927
Restore options:
3028
--recovery-target-time time stamp up to which recovery will proceed
3129
--recovery-target-xid transaction ID up to which recovery will proceed
3230
--recovery-target-inclusive whether we stop just after the recovery target
3331
--recovery-target-timeline recovering into a particular timeline
34-
--hard-copy copying archivelog not symbolic link
3532

3633
Catalog options:
3734
-a, --show-all show deleted backup too
@@ -54,10 +51,9 @@ Read the website for details. <https://github.com/michaelpq/pg_rman>
5451
Report bugs to <https://github.com/michaelpq/pg_rman/issues>.
5552
pg_rman 1.3dev
5653
ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)
54+
ERROR: required parameter not specified: ARCLOG_PATH (-A, --arclog-path)
55+
ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)
5756
ERROR: Required parameter not specified: BACKUP_MODE (-b, --backup-mode)
58-
ERROR: Required parameter not specified: ARCLOG_PATH (-A, --arclog-path)
59-
ERROR: Required parameter not specified: ARCLOG_PATH (-A, --arclog-path)
60-
ERROR: Required parameter not specified: ARCLOG_PATH (-A, --arclog-path)
6157
ERROR: invalid backup-mode "bad"
6258
ERROR: required delete range option not specified: delete DATE
6359
INFO: validate: 2009-05-31 17:05:53 backup and archive log files by CRC
@@ -67,11 +63,8 @@ WARNING: backup 2009-06-01 17:05:53 is corrupted
6763
WARNING: syntax error in " = INFINITE"
6864
ERROR: Required parameter not specified: BACKUP_MODE (-b, --backup-mode)
6965
ERROR: invalid backup-mode ""
70-
ERROR: Required parameter not specified: ARCLOG_PATH (-A, --arclog-path)
71-
ERROR: Required parameter not specified: ARCLOG_PATH (-A, --arclog-path)
7266
ERROR: invalid backup-mode "B"
7367
ERROR: option -Z, --compress-data should be a boolean: 'FOO'
74-
ERROR: option --keep-arclog-files should be a 32bit signed integer: 'YES'
7568
ERROR: invalid option "TIMELINEID"
7669
ERROR: invalid option "BACKUP_TARGETS"
7770
ERROR: invalid backup-mode "ENV_PATH"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp