1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-02-03 14:01:57 +02:00

Rename project to pg_arman

This is officially a fork!
This commit is contained in:
Michael Paquier 2014-01-27 12:02:56 +09:00
parent 820485d225
commit c8ebcc9c41
29 changed files with 181 additions and 181 deletions

2
.gitignore vendored
View File

@ -19,7 +19,7 @@
.deps
# Binaries
/pg_rman
/pg_arman
# Generated by test suite
/regression.diffs

View File

@ -1,4 +1,4 @@
PROGRAM = pg_rman
PROGRAM = pg_arman
SRCS = \
backup.c \
catalog.c \
@ -8,7 +8,7 @@ SRCS = \
fetch.c \
init.c \
parray.c \
pg_rman.c \
pg_arman.c \
restore.c \
show.c \
status.c \
@ -19,15 +19,15 @@ SRCS = \
pgut/pgut-port.c
OBJS = $(SRCS:.c=.o)
DOCS = doc/pg_rman.txt
DOCS = doc/pg_arman.txt
# asciidoc and xmlto are present, so install the html documentation and man
# pages as well. html is part of the vanilla documentation. Man pages need a
# special handling at installation.
ifneq ($(ASCIIDOC),)
ifneq ($(XMLTO),)
man_DOCS = doc/pg_rman.1
DOCS += doc/pg_rman.html doc/README.html
man_DOCS = doc/pg_arman.1
DOCS += doc/pg_arman.html doc/README.html
endif # XMLTO
endif # ASCIIDOC
@ -41,7 +41,7 @@ PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_rman
subdir = contrib/pg_arman
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
@ -51,7 +51,7 @@ endif
LIBS := $(filter-out -lxml2, $(LIBS))
LIBS := $(filter-out -lxslt, $(LIBS))
$(OBJS): pg_rman.h
$(OBJS): pg_arman.h
# Part related to documentation
# Compile documentation as well is ASCIIDOC and XMLTO are defined

24
README
View File

@ -1,7 +1,7 @@
pg_rman
=======
pg_arman
========
pg_rman is a backup and recovery manager for PostgreSQL servers able to do
pg_arman is a backup and recovery manager for PostgreSQL servers able to do
incremental, archive and full backup as well as restore a cluster to a
state defined by a given recovery target. It is designed to perform
periodic backups of an existing PostgreSQL server, combined with WAL
@ -14,18 +14,18 @@ Download
--------
The latest version of this software can be found on the project website at
https://github.com/michaelpq/pg_rman.
https://github.com/michaelpq/pg_arman.
Installation
------------
Compiling pg_rman requires a PostgreSQL installation and can be done in
Compiling pg_arman requires a PostgreSQL installation and can be done in
two ways:
1. Put pg_rman project directory inside PostgreSQL source tree as
contrib/pg_rman, and use this command for compilation:
1. Put pg_arman project directory inside PostgreSQL source tree as
contrib/pg_arman, and use this command for compilation:
$ cd $POSTGRES_SOURCE/contrib/pg_rman
$ cd $POSTGRES_SOURCE/contrib/pg_arman
$ make
2. Keep the project directory as-is and use the PGXS development
@ -36,13 +36,13 @@ compilation:
In addition, you must have pg_config in $PATH.
The current version of pg_rman is compatible with PostgreSQL 9.3 and
The current version of pg_arman is compatible with PostgreSQL 9.3 and
upper versions.
Platforms
---------
pg_rman has been tested on Linux and Unix-based platforms.
pg_arman has been tested on Linux and Unix-based platforms.
Documentation
-------------
@ -69,7 +69,7 @@ install xmlto and asciidoc:
Regression tests
----------------
The test suite of pg_rman is available in the code tree and can be
The test suite of pg_arman is available in the code tree and can be
launched in a way similar to common PostgreSQL extensions and modules:
1) "make check" or "make installcheck" if the project directory is
@ -81,5 +81,5 @@ directory is kept as-is.
License
-------
pg_rman can be distributed under the PostgreSQL license. See COPYRIGHT
pg_arman can be distributed under the PostgreSQL license. See COPYRIGHT
file for more information.

View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <stdio.h>
#include <stdlib.h>
@ -109,7 +109,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
/* notify start of backup to PostgreSQL server */
time2iso(label, lengthof(label), current.start_time);
strncat(label, " with pg_rman", lengthof(label));
strncat(label, " with pg_arman", lengthof(label));
pg_start_backup(label, smooth_checkpoint, &current);
/* If backup_label does not exist in $PGDATA, stop taking backup */
@ -464,7 +464,7 @@ do_backup(pgBackupOption bkupopt)
elog(ERROR_SYSTEM, _("can't lock backup catalog."));
else if (ret == 1)
elog(ERROR_ALREADY_RUNNING,
_("another pg_rman is running, skip this backup."));
_("another pg_arman is running, skip this backup."));
/* initialize backup result */
current.status = BACKUP_STATUS_RUNNING;

View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <dirent.h>
#include <fcntl.h>
@ -28,7 +28,7 @@ static pgBackup *catalog_read_ini(const char *path);
static int lock_fd = -1;
/*
* Lock of the catalog with pg_rman.ini file and return 0.
* Lock of the catalog with pg_arman.ini file and return 0.
* If the lock is held by another one, return 1 immediately.
*/
int

2
data.c
View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <unistd.h>
#include <time.h>

View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
static int pgBackupDeleteFiles(pgBackup *backup);
@ -29,7 +29,7 @@ do_delete(pgBackupRange *range)
elog(ERROR_SYSTEM, _("can't lock backup catalog."));
else if (ret == 1)
elog(ERROR_ALREADY_RUNNING,
_("another pg_rman is running, stop delete."));
_("another pg_arman is running, stop delete."));
/* Get complete list of backup */
backup_list = catalog_get_backup_list(NULL);

2
dir.c
View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <libgen.h>
#include <unistd.h>

2
doc/.gitignore vendored
View File

@ -1,4 +1,4 @@
# Documentation entries
/*.html
/*.xml
/pg_rman.1
/pg_arman.1

View File

@ -1,9 +1,9 @@
manpages = pg_rman.1
manpages = pg_arman.1
EXTRA_DIST = pg_rman.txt Makefile $(manpages)
EXTRA_DIST = pg_arman.txt Makefile $(manpages)
htmls = pg_rman.html README.html
htmls = pg_arman.html README.html
# We have asciidoc and xmlto, so build everything and define correct
# rules for build.
@ -12,7 +12,7 @@ ifneq ($(XMLTO),)
dist_man_MANS = $(manpages)
doc_DATA = $(htmls)
pg_rman.1: pg_rman.xml $(doc_DATA)
pg_arman.1: pg_arman.xml $(doc_DATA)
$(XMLTO) man $<
%.xml: %.txt

View File

@ -1,12 +1,12 @@
= pg_rman(1) =
= pg_arman(1) =
== NAME ==
pg_rman - Backup and recovery manager for PostgreSQL
pg_arman - Backup and recovery manager for PostgreSQL
== SYNOPSIS ==
pg_rman [ OPTIONS ]
pg_arman [ OPTIONS ]
{ init |
backup |
restore |
@ -20,7 +20,7 @@ files.
== DESCRIPTION ==
pg_rman is a utility program to backup and restore PostgreSQL database.
pg_arman is a utility program to backup and restore PostgreSQL database.
It proposes the following features:
@ -34,7 +34,7 @@ It proposes the following features:
== COMMANDS ==
pg_rman supports the following commands. See also *OPTIONS* for more
pg_arman supports the following commands. See also *OPTIONS* for more
details.
*init*::
@ -61,11 +61,11 @@ details.
First, you need to create "a backup catalog" to store backup files and
their metadata. It is recommended to setup archive_mode and archive_command
in postgresql.conf before initializing the backup catalog. If the variables
are initialized, pg_rman can adjust the config file to the setting. In this
are initialized, pg_arman can adjust the config file to the setting. In this
case, you have to specify the database cluster path for PostgreSQL. Please
specify it in PGDATA environmental variable or -D/--pgdata option.
$ pg_rman init -B /path/to/backup/
$ pg_arman init -B /path/to/backup/
=== BACKUP ===
@ -83,7 +83,7 @@ Unverified backup cannot be used in restore and in incremental backup.
PostgreSQL server should be stopped before performing a restore. If database
cluster still exists, restore command will save unarchived transaction log
and delete all database files. You can retry recovery until a new backup is
taken. After restoring files, pg_rman creates recovery.conf in $PGDATA. The
taken. After restoring files, pg_arman creates recovery.conf in $PGDATA. The
conf file contains parameters for recovery. It is as well possible to modify
the file manually.
@ -100,9 +100,9 @@ the restore will be a restore target.
To reduce the number of command line arguments, you can set BACKUP_PATH,
an environment variable, to the absolute path of the backup catalog and
write default configuration into ${BACKUP_PATH}/pg_rman.ini.
write default configuration into ${BACKUP_PATH}/pg_arman.ini.
$ cat $BACKUP_PATH/pg_rman.ini
$ cat $BACKUP_PATH/pg_arman.ini
ARCLOG_PATH = /home/postgres/arclog
BACKUP_MODE = F
COMPRESS_DATA = YES
@ -116,20 +116,20 @@ write default configuration into ${BACKUP_PATH}/pg_rman.ini.
This example takes a full backup of the whole database. Then, it validates
all unvalidated backups.
$ pg_rman backup --backup-mode=full
$ pg_rman validate
$ pg_arman backup --backup-mode=full
$ pg_arman validate
=== RESTORE FROM A BACKUP ===
Here are some commands to restore from a backup:
$ pg_ctl stop -m immediate
$ pg_rman restore
$ pg_arman restore
$ pg_ctl start
=== SHOW A BACKUP ===
$ pg_rman show
$ pg_arman show
==================================================================================================
Start Mode Current TLI Parent TLI Time Data WAL Log Backup Status
==================================================================================================
@ -158,7 +158,7 @@ The fields are:
When a date is specified, more details about a backup is retrieved:
$ pg_rman show '2011-11-27 19:15:45'
$ pg_arman show '2011-11-27 19:15:45'
# configuration
BACKUP_MODE=FULL
COMPRESS_DATA=false
@ -183,7 +183,7 @@ the specified date.
== OPTIONS ==
pg_rman accepts the following command line parameters. Some of them can
pg_arman accepts the following command line parameters. Some of them can
be also specified as environment variables. See also *PARAMETERS* for the
details.
@ -203,12 +203,12 @@ absolute paths; relative paths are not allowed.
The absolute path of backup catalog. This option is mandatory.
*-c* / *--check*::
If specifed, pg_rman doesn't perform actual jobs but only checks
If specifed, pg_arman doesn't perform actual jobs but only checks
parameters and required resources. The option is typically used with
--verbose option to verify the operation.
*-v* / *--verbose*::
If specified, pg_rman works in verbose mode.
If specified, pg_arman works in verbose mode.
=== BACKUP OPTIONS ===
@ -286,10 +286,10 @@ Parameters to connect PostgreSQL server.
password.
*-W* / *--password*::
Force pg_rman to prompt for a password before connecting to a database.
This option is never essential, since pg_rman will automatically
Force pg_arman to prompt for a password before connecting to a database.
This option is never essential, since pg_arman will automatically
prompt for a password if the server demands password authentication.
However, pg_rman will waste a connection attempt in order to find out
However, pg_arman will waste a connection attempt in order to find out
if the server wants a password. In some cases it is worth typing -W
to avoid the extra connection attempt.
@ -342,13 +342,13 @@ environment variables supported by libpq (see Environment Variables)
== RESTRICTIONS ==
pg_rman has the following restrictions.
pg_arman has the following restrictions.
- Requires to read database cluster directory and write backup catalog
directory. It is usually necessary to mount the disk where backup
catalog is placed with NFS or related from database server.
- Major versions of pg_rman and server should match.
- Block sizes of pg_rman and server should match.
- Major versions of pg_arman and server should match.
- Block sizes of pg_arman and server should match.
- If there are some unreadable files/directories in data folder of server
WAL directory or archived WAL directory, the backup or restore will fail
depending on the backup mode selected.
@ -358,7 +358,7 @@ pg_rman has the following restrictions.
== DETAILS ==
=== RECOVERY TO POINT-IN-TIME ===
pg_rman can recover to point-in-time if timeline, transaction ID, or
pg_arman can recover to point-in-time if timeline, transaction ID, or
timestamp is specified in recovery.conf. xlogdump is a contrib module of
PostgreSQL core that allows checking in the content of WAL files and
determine when to recover. This might help.
@ -370,7 +370,7 @@ are required if the value contains whitespaces. Comments should start with
excluding values.
=== EXIT CODE ===
pg_rman returns exit codes for each error status.
pg_arman returns exit codes for each error status.
Code Name Description
0 SUCCESS Operation succeeded.
@ -387,14 +387,14 @@ pg_rman returns exit codes for each error status.
20 ERROR_ARCHIVE_FAILED Cannot archive WAL file
21 ERROR_NO_BACKUP Backup file not found
22 ERROR_CORRUPTED Backup file is broken
23 ERROR_ALREADY_RUNNING Cannot start because another pg_rman
23 ERROR_ALREADY_RUNNING Cannot start because another pg_arman
is running
24 ERROR_PG_INCOMPATIBLE Version conflicted with server
25 ERROR_PG_RUNNING Error due to server running
26 ERROR_PID_BROKEN postmaster.pid is broken
== AUTHOR ==
pg_rman was originally written by NTT, mainly Itagaki Takahiro, and maintained
in some way by Michael Paquier.
pg_arman is a fork of pg_rman that was originally written by NTT, now
maintained by Michael Paquier.
Please report bug reports at <https://github.com/michaelpq/pg_rman>.
Please report bug reports at <https://github.com/michaelpq/pg_arman>.

View File

@ -1,11 +1,11 @@
\! rm -rf results/init_test
\! pg_rman init -B ${PWD}/results/init_test --quiet;echo $?
\! pg_arman init -B ${PWD}/results/init_test --quiet;echo $?
0
\! find results/init_test | xargs ls -Fd | sort
results/init_test/
results/init_test/backup/
results/init_test/backup/pg_xlog/
results/init_test/pg_rman.ini
\! pg_rman init -B ${PWD}/results/init_test --quiet;echo $?
results/init_test/pg_arman.ini
\! pg_arman init -B ${PWD}/results/init_test --quiet;echo $?
ERROR: backup catalog already exist. and it's not empty.
2

View File

@ -1,13 +1,13 @@
\! sh sql/option.sh
pg_rman manage backup/recovery of PostgreSQL database.
pg_arman manage backup/recovery of PostgreSQL database.
Usage:
pg_rman OPTION init
pg_rman OPTION backup
pg_rman OPTION restore
pg_rman OPTION show [DATE]
pg_rman OPTION validate [DATE]
pg_rman OPTION delete DATE
pg_arman OPTION init
pg_arman OPTION backup
pg_arman OPTION restore
pg_arman OPTION show [DATE]
pg_arman OPTION validate [DATE]
pg_arman OPTION delete DATE
Common Options:
-D, --pgdata=PATH location of the database storage area
@ -47,9 +47,9 @@ Generic options:
--help show this help, then exit
--version output version information, then exit
Read the website for details. <https://github.com/michaelpq/pg_rman>
Report bugs to <https://github.com/michaelpq/pg_rman/issues>.
pg_rman 1.3dev
Read the website for details. <https://github.com/michaelpq/pg_arman>
Report bugs to <https://github.com/michaelpq/pg_arman/issues>.
pg_arman 1.3dev
ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)
ERROR: required parameter not specified: ARCLOG_PATH (-A, --arclog-path)
ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)

View File

@ -1,25 +1,25 @@
-- test show command
\! rm -rf ${PWD}/results/sample_backup
\! cp -rp data/sample_backup ${PWD}/results/sample_backup
\! pg_rman show -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
\! pg_arman show -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
==========================================================================
Start Mode Current TLI Parent TLI Time Data Status
==========================================================================
2009-06-03 17:05:53 FULL 1 0 0m ---- RUNNING
2009-06-01 17:05:53 INCR 1 0 3m 9223PB DONE
2009-05-31 17:05:53 FULL 1 0 3m 1242MB DONE
\! pg_rman validate -B ${PWD}/results/sample_backup 2009-05-31 17:05:53 --debug
\! pg_arman validate -B ${PWD}/results/sample_backup 2009-05-31 17:05:53 --debug
INFO: validate: 2009-05-31 17:05:53 backup and archive log files by CRC
LOG: database files...
LOG: (1/1) PG_VERSION
LOG: backup 2009-05-31 17:05:53 is valid
\! pg_rman validate -B ${PWD}/results/sample_backup 2009-06-01 17:05:53 --debug
\! pg_arman validate -B ${PWD}/results/sample_backup 2009-06-01 17:05:53 --debug
INFO: validate: 2009-06-01 17:05:53 backup and archive log files by CRC
LOG: database files...
LOG: (1/1) PG_VERSION
WARNING: CRC of backup file "PG_VERSION" must be 0 but FEF71BC1
WARNING: backup 2009-06-01 17:05:53 is corrupted
\! pg_rman show -a -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
\! pg_arman show -a -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
==========================================================================
Start Mode Current TLI Parent TLI Time Data Status
==========================================================================
@ -27,7 +27,7 @@ Start Mode Current TLI Parent TLI Time Data Status
2009-06-02 17:05:03 FULL 1 0 0m ---- DELETED
2009-06-01 17:05:53 INCR 1 0 3m 9223PB CORRUPT
2009-05-31 17:05:53 FULL 1 0 3m 1242MB OK
\! pg_rman show 2009-06-01 17:05:53 -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
\! pg_arman show 2009-06-01 17:05:53 -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
# configuration
BACKUP_MODE=INCREMENTAL
COMPRESS_DATA=false

View File

@ -19,7 +19,7 @@
#include <unistd.h>
#include <string.h>
#include "pg_rman.h"
#include "pg_arman.h"
/*
* Read a file into memory. The file to be read is <datadir>/<path>.

10
init.c
View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <unistd.h>
#include <dirent.h>
@ -60,11 +60,11 @@ do_init(void)
parse_postgresql_conf(path, &log_directory, &archive_command);
}
/* create pg_rman.ini */
/* create pg_arman.ini */
join_path_components(path, backup_path, PG_RMAN_INI_FILE);
fp = fopen(path, "wt");
if (fp == NULL)
elog(ERROR_SYSTEM, _("can't create pg_rman.ini: %s"), strerror(errno));
elog(ERROR_SYSTEM, _("can't create pg_arman.ini: %s"), strerror(errno));
/* set ARCLOG_PATH refered with log_directory */
if (arclog_path == NULL && archive_command && archive_command[0])
@ -107,10 +107,10 @@ do_init(void)
}
else if (archive_command && archive_command[0])
elog(WARNING, "ARCLOG_PATH is not set because failed to parse archive_command '%s'."
"Please set ARCLOG_PATH in pg_rman.ini or environmental variable", archive_command);
"Please set ARCLOG_PATH in pg_arman.ini or environmental variable", archive_command);
else
elog(WARNING, "ARCLOG_PATH is not set because archive_command is empty."
"Please set ARCLOG_PATH in pg_rman.ini or environmental variable");
"Please set ARCLOG_PATH in pg_arman.ini or environmental variable");
fprintf(fp, "\n");
fclose(fp);

View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
/* members of struct parray are hidden from client. */
struct parray

View File

@ -1,22 +1,22 @@
/*-------------------------------------------------------------------------
*
* pg_rman.c: Backup/Recovery manager for PostgreSQL.
* pg_arman.c: Backup/Recovery manager for PostgreSQL.
*
* Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
*
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/stat.h>
const char *PROGRAM_VERSION = "1.3dev";
const char *PROGRAM_URL = "https://github.com/michaelpq/pg_rman";
const char *PROGRAM_EMAIL = "https://github.com/michaelpq/pg_rman/issues";
const char *PROGRAM_VERSION = "0.1";
const char *PROGRAM_URL = "https://github.com/michaelpq/pg_arman";
const char *PROGRAM_EMAIL = "https://github.com/michaelpq/pg_arman/issues";
/* path configuration */
char *backup_path;
@ -76,7 +76,7 @@ static pgut_option options[] =
};
/*
* Entry point of pg_rman command.
* Entry point of pg_arman command.
*/
int
main(int argc, char *argv[])

View File

@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
* pg_rman.h: Backup/Recovery manager for PostgreSQL.
* pg_arman.h: Backup/Recovery manager for PostgreSQL.
*
* Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
*
@ -29,7 +29,7 @@
#define PG_XLOG_DIR "pg_xlog"
#define PG_TBLSPC_DIR "pg_tblspc"
#define BACKUP_INI_FILE "backup.ini"
#define PG_RMAN_INI_FILE "pg_rman.ini"
#define PG_RMAN_INI_FILE "pg_arman.ini"
#define MKDIRS_SH_FILE "mkdirs.sh"
#define DATABASE_FILE_LIST "file_database.txt"
#define SNAPSHOT_SCRIPT_FILE "snapshot_script"
@ -52,7 +52,7 @@
#define ERROR_ARCHIVE_FAILED 20 /* cannot archive xlog file */
#define ERROR_NO_BACKUP 21 /* backup was not found in the catalog */
#define ERROR_CORRUPTED 22 /* backup catalog is corrupted */
#define ERROR_ALREADY_RUNNING 23 /* another pg_rman is running */
#define ERROR_ALREADY_RUNNING 23 /* another pg_arman is running */
#define ERROR_PG_INCOMPATIBLE 24 /* block size is not compatible */
#define ERROR_PG_RUNNING 25 /* PostgreSQL server is running */
#define ERROR_PID_BROKEN 26 /* postmaster.pid file is broken */
@ -115,7 +115,7 @@ typedef enum BackupMode
} BackupMode;
/*
* pg_rman takes backup into the directroy $BACKUP_PATH/<date>/<time>.
* pg_arman takes backup into the directroy $BACKUP_PATH/<date>/<time>.
*
* status == -1 indicates the pgBackup is invalid.
*/

View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <fcntl.h>
#include <sys/stat.h>
@ -76,7 +76,7 @@ do_restore(const char *target_time,
elog(ERROR_SYSTEM, _("can't lock backup catalog."));
else if (ret == 1)
elog(ERROR_ALREADY_RUNNING,
_("another pg_rman is running, stop restore."));
_("another pg_arman is running, stop restore."));
/* confirm the PostgreSQL server is not running */
if (is_pg_running())
@ -439,7 +439,7 @@ create_recovery_conf(const char *target_time,
elog(ERROR_SYSTEM, _("can't open recovery.conf \"%s\": %s"), path,
strerror(errno));
fprintf(fp, "# recovery.conf generated by pg_rman %s\n",
fprintf(fp, "# recovery.conf generated by pg_arman %s\n",
PROGRAM_VERSION);
fprintf(fp, "restore_command = 'cp %s/%%f %%p'\n", arclog_path);
if (target_time)

2
show.c
View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
static void show_backup_list(FILE *out, parray *backup_list, bool show_all);
static void show_backup_detail(FILE *out, pgBackup *backup);

View File

@ -54,10 +54,10 @@ rm -rf $TBLSPC_PATH
# create new backup catalog
rm -rf $BACKUP_PATH
pg_rman init -B $BACKUP_PATH --quiet
pg_arman init -B $BACKUP_PATH --quiet
# create default configuration file
cat << EOF > $BACKUP_PATH/pg_rman.ini
cat << EOF > $BACKUP_PATH/pg_arman.ini
# comment
BACKUP_MODE = F # comment
EOF
@ -97,10 +97,10 @@ EOF
export KEEP_DATA_GENERATIONS=2
export KEEP_DATA_DAYS=0
for i in `seq 1 5`; do
# pg_rman -p $TEST_PGPORT backup --verbose -d postgres > $BASE_PATH/results/log_full_0_$i 2>&1
pg_rman -w -p $TEST_PGPORT backup --verbose -d postgres > $BASE_PATH/results/log_full_0_$i 2>&1
# pg_arman -p $TEST_PGPORT backup --verbose -d postgres > $BASE_PATH/results/log_full_0_$i 2>&1
pg_arman -w -p $TEST_PGPORT backup --verbose -d postgres > $BASE_PATH/results/log_full_0_$i 2>&1
done
pg_rman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show_d_1 2>&1
pg_arman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show_d_1 2>&1
echo "# of deleted backups"
grep -c DELETED $BASE_PATH/results/log_show_d_1
@ -108,23 +108,23 @@ pgbench -p $TEST_PGPORT -i -s $SCALE pgbench > $BASE_PATH/results/pgbench.log 2>
echo "full database backup"
psql --no-psqlrc -p $TEST_PGPORT postgres -c "checkpoint"
#pg_rman -p $TEST_PGPORT backup --verbose -d postgres > $BASE_PATH/results/log_full_1 2>&1
pg_rman -w -p $TEST_PGPORT backup --verbose -d postgres > $BASE_PATH/results/log_full_1 2>&1
#pg_arman -p $TEST_PGPORT backup --verbose -d postgres > $BASE_PATH/results/log_full_1 2>&1
pg_arman -w -p $TEST_PGPORT backup --verbose -d postgres > $BASE_PATH/results/log_full_1 2>&1
pgbench -p $TEST_PGPORT -T $DURATION -c 10 pgbench >> $BASE_PATH/results/pgbench.log 2>&1
echo "incremental database backup"
psql --no-psqlrc -p $TEST_PGPORT postgres -c "checkpoint"
#pg_rman -p $TEST_PGPORT backup -b i --verbose -d postgres > $BASE_PATH/results/log_incr1 2>&1
pg_rman -w -p $TEST_PGPORT backup -b i --verbose -d postgres > $BASE_PATH/results/log_incr1 2>&1
#pg_arman -p $TEST_PGPORT backup -b i --verbose -d postgres > $BASE_PATH/results/log_incr1 2>&1
pg_arman -w -p $TEST_PGPORT backup -b i --verbose -d postgres > $BASE_PATH/results/log_incr1 2>&1
# validate all backup
pg_rman validate `date +%Y` --verbose > $BASE_PATH/results/log_validate1 2>&1
pg_rman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show0 2>&1
pg_arman validate `date +%Y` --verbose > $BASE_PATH/results/log_validate1 2>&1
pg_arman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show0 2>&1
pg_dumpall > $BASE_PATH/results/dump_before_rtx.sql
target_xid=`psql --no-psqlrc -p $TEST_PGPORT pgbench -tAq -c "INSERT INTO pgbench_history VALUES (1) RETURNING(xmin);"`
psql --no-psqlrc -p $TEST_PGPORT postgres -c "checkpoint"
#pg_rman -p $TEST_PGPORT backup -b i --verbose -d postgres > $BASE_PATH/results/log_incr2 2>&1
pg_rman -w -p $TEST_PGPORT backup -b i --verbose -d postgres > $BASE_PATH/results/log_incr2 2>&1
#pg_arman -p $TEST_PGPORT backup -b i --verbose -d postgres > $BASE_PATH/results/log_incr2 2>&1
pg_arman -w -p $TEST_PGPORT backup -b i --verbose -d postgres > $BASE_PATH/results/log_incr2 2>&1
pgbench -p $TEST_PGPORT -T $DURATION -c 10 pgbench >> $BASE_PATH/results/pgbench.log 2>&1
@ -143,14 +143,14 @@ rm -rf $PGDATA
mv $PGDATA.bak $PGDATA
# validate all backup
pg_rman validate `date +%Y` --verbose > $BASE_PATH/results/log_validate2 2>&1
pg_arman validate `date +%Y` --verbose > $BASE_PATH/results/log_validate2 2>&1
# restore check with pg_rman
pg_rman restore -! --verbose --check > $BASE_PATH/results/log_restore_check_1 2>&1
# restore check with pg_arman
pg_arman restore -! --verbose --check > $BASE_PATH/results/log_restore_check_1 2>&1
# restore with pg_rman
# restore with pg_arman
CUR_TLI=`pg_controldata | grep "Latest checkpoint's TimeLineID:" | awk '{print $4}'`
pg_rman restore -! --verbose > $BASE_PATH/results/log_restore1_1 2>&1
pg_arman restore -! --verbose > $BASE_PATH/results/log_restore1_1 2>&1
CUR_TLI_R=`grep "current timeline ID = " $BASE_PATH/results/log_restore1_1 | awk '{print $5}'`
TARGET_TLI=`grep "target timeline ID = " $BASE_PATH/results/log_restore1_1 | awk '{print $5}'`
if [ "$CUR_TLI" != "$CUR_TLI_R" ]; then
@ -160,14 +160,14 @@ fi
# recovery database
pg_ctl start -w -t 3600 > /dev/null 2>&1
# re-restore with pg_rman
# re-restore with pg_arman
pg_ctl stop -m immediate > /dev/null 2>&1
# restore check with pg_rman
pg_rman restore -! --verbose --check > $BASE_PATH/results/log_restore_check_2 2>&1
# restore check with pg_arman
pg_arman restore -! --verbose --check > $BASE_PATH/results/log_restore_check_2 2>&1
CUR_TLI=`pg_controldata | grep "Latest checkpoint's TimeLineID:" | awk '{print $4}'`
pg_rman restore -! --verbose > $BASE_PATH/results/log_restore1_2 2>&1
pg_arman restore -! --verbose > $BASE_PATH/results/log_restore1_2 2>&1
CUR_TLI_R=`grep "current timeline ID = " $BASE_PATH/results/log_restore1_2 | awk '{print $5}'`
TARGET_TLI=`grep "target timeline ID = " $BASE_PATH/results/log_restore1_2 | awk '{print $5}'`
if [ "$CUR_TLI" != "$CUR_TLI_R" ]; then
@ -185,21 +185,21 @@ diff $BASE_PATH/results/dump_before.sql $BASE_PATH/results/dump_after.sql
# incrementa backup can't find last full backup because new timeline started.
echo "full database backup after recovery"
psql --no-psqlrc -p $TEST_PGPORT postgres -c "checkpoint"
#pg_rman -p $TEST_PGPORT backup -b f --verbose -d postgres > $BASE_PATH/results/log_full2 2>&1
pg_rman -w -p $TEST_PGPORT backup -b f --verbose -d postgres > $BASE_PATH/results/log_full2 2>&1
#pg_arman -p $TEST_PGPORT backup -b f --verbose -d postgres > $BASE_PATH/results/log_full2 2>&1
pg_arman -w -p $TEST_PGPORT backup -b f --verbose -d postgres > $BASE_PATH/results/log_full2 2>&1
# Symbolic links in $ARCLOG_PATH should be deleted.
echo "# of symbolic links in ARCLOG_PATH"
find $ARCLOG_PATH -type l | wc -l | tr -d ' '
# restore with pg_rman
# restore with pg_arman
pg_ctl stop -m immediate > /dev/null 2>&1
# restore check with pg_rman
pg_rman restore -! --verbose --check > $BASE_PATH/results/log_restore_check_3 2>&1
# restore check with pg_arman
pg_arman restore -! --verbose --check > $BASE_PATH/results/log_restore_check_3 2>&1
CUR_TLI=`pg_controldata | grep "Latest checkpoint's TimeLineID:" | awk '{print $4}'`
pg_rman restore -! --recovery-target-xid $target_xid --recovery-target-inclusive false --verbose > $BASE_PATH/results/log_restore2 2>&1
pg_arman restore -! --recovery-target-xid $target_xid --recovery-target-inclusive false --verbose > $BASE_PATH/results/log_restore2 2>&1
CUR_TLI_R=`grep "current timeline ID = " $BASE_PATH/results/log_restore2 | awk '{print $5}'`
TARGET_TLI=`grep "target timeline ID = " $BASE_PATH/results/log_restore2 | awk '{print $5}'`
if [ "$CUR_TLI" != "$CUR_TLI_R" ]; then
@ -215,24 +215,24 @@ pg_dumpall > $BASE_PATH/results/dump_after_rtx.sql
diff $BASE_PATH/results/dump_before_rtx.sql $BASE_PATH/results/dump_after_rtx.sql
# show
pg_rman -p $TEST_PGPORT show --verbose -a -d postgres > $BASE_PATH/results/log_show_timeline_1 2>&1
pg_rman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show_timeline_2 2>&1
pg_rman -p $TEST_PGPORT show `date +%Y` --verbose -d postgres > $BASE_PATH/results/log_show_timeline_3 2>&1
pg_arman -p $TEST_PGPORT show --verbose -a -d postgres > $BASE_PATH/results/log_show_timeline_1 2>&1
pg_arman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show_timeline_2 2>&1
pg_arman -p $TEST_PGPORT show `date +%Y` --verbose -d postgres > $BASE_PATH/results/log_show_timeline_3 2>&1
echo "# of deleted backups (show all)"
grep -c DELETED $BASE_PATH/results/log_show_timeline_2
echo "# of deleted backups"
grep -c DELETED $BASE_PATH/results/log_show_timeline_3
echo "delete backup"
pg_rman -p $TEST_PGPORT delete --debug -d postgres > $BASE_PATH/results/log_delete1 2>&1
pg_rman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show1 2>&1
pg_arman -p $TEST_PGPORT delete --debug -d postgres > $BASE_PATH/results/log_delete1 2>&1
pg_arman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show1 2>&1
echo "# of deleted backups"
grep -c DELETED $BASE_PATH/results/log_show1
pg_rman -p $TEST_PGPORT delete `date "+%Y-%m-%d %T"` --debug -d postgres > $BASE_PATH/results/log_delete2 2>&1
pg_rman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show2 2>&1
pg_arman -p $TEST_PGPORT delete `date "+%Y-%m-%d %T"` --debug -d postgres > $BASE_PATH/results/log_delete2 2>&1
pg_arman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show2 2>&1
echo "# of deleted backups"
grep -c DELETED $BASE_PATH/results/log_show2
pg_rman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show_timeline_4 2>&1
pg_arman -p $TEST_PGPORT show `date +%Y` -a --verbose -d postgres > $BASE_PATH/results/log_show_timeline_4 2>&1
# cleanup
pg_ctl stop -m immediate > /dev/null 2>&1

View File

@ -1,4 +1,4 @@
\! rm -rf results/init_test
\! pg_rman init -B ${PWD}/results/init_test --quiet;echo $?
\! pg_arman init -B ${PWD}/results/init_test --quiet;echo $?
\! find results/init_test | xargs ls -Fd | sort
\! pg_rman init -B ${PWD}/results/init_test --quiet;echo $?
\! pg_arman init -B ${PWD}/results/init_test --quiet;echo $?

View File

@ -1,12 +1,12 @@
#!/bin/sh
#============================================================================
# This is a test script for option test of pg_rman.
# This is a test script for option test of pg_arman.
#============================================================================
BASE_PATH=`pwd`
# Clear environment variables used by pg_rman except $PGDATA.
# Clear environment variables used by pg_arman except $PGDATA.
# List of environment variables is defined in catalog.c.
unset BACKUP_PATH
unset ARCLOG_PATH
@ -25,46 +25,46 @@ rm -rf $BACKUP_PATH
cp -rp data/sample_backup $BACKUP_PATH
# general option
pg_rman --help
pg_rman --version
pg_arman --help
pg_arman --version
# show option
# required argument check
pg_rman show
pg_rman show -B $BACKUP_PATH
pg_arman show
pg_arman show -B $BACKUP_PATH
# backup option
# required arguments check
pg_rman backup --verbose
pg_rman backup --verbose -B $BACKUP_PATH
pg_arman backup --verbose
pg_arman backup --verbose -B $BACKUP_PATH
# bad arguments check
pg_rman backup --verbose -B $BACKUP_PATH -b bad
pg_arman backup --verbose -B $BACKUP_PATH -b bad
# delete or validate requires DATE
pg_rman delete -B $BACKUP_PATH
pg_rman validate -B $BACKUP_PATH
pg_arman delete -B $BACKUP_PATH
pg_arman validate -B $BACKUP_PATH
# invalid configuration file check
echo " = INFINITE" > $BACKUP_PATH/pg_rman.ini
pg_rman backup --verbose -B $BACKUP_PATH
echo "BACKUP_MODE= " > $BACKUP_PATH/pg_rman.ini
pg_rman backup --verbose -B $BACKUP_PATH
echo "BACKUP_MODE=B" > $BACKUP_PATH/pg_rman.ini
pg_rman backup --verbose -B $BACKUP_PATH
echo "COMPRESS_DATA=FOO" > $BACKUP_PATH/pg_rman.ini
pg_rman backup --verbose -B $BACKUP_PATH
echo "TIMELINEID=-1" > $BACKUP_PATH/pg_rman.ini
pg_rman backup --verbose -B $BACKUP_PATH
echo "BACKUP_TARGETS=F" > $BACKUP_PATH/pg_rman.ini
pg_rman backup --verbose -B $BACKUP_PATH
echo " = INFINITE" > $BACKUP_PATH/pg_arman.ini
pg_arman backup --verbose -B $BACKUP_PATH
echo "BACKUP_MODE= " > $BACKUP_PATH/pg_arman.ini
pg_arman backup --verbose -B $BACKUP_PATH
echo "BACKUP_MODE=B" > $BACKUP_PATH/pg_arman.ini
pg_arman backup --verbose -B $BACKUP_PATH
echo "COMPRESS_DATA=FOO" > $BACKUP_PATH/pg_arman.ini
pg_arman backup --verbose -B $BACKUP_PATH
echo "TIMELINEID=-1" > $BACKUP_PATH/pg_arman.ini
pg_arman backup --verbose -B $BACKUP_PATH
echo "BACKUP_TARGETS=F" > $BACKUP_PATH/pg_arman.ini
pg_arman backup --verbose -B $BACKUP_PATH
# configuration priorityfile check
echo "BACKUP_MODE=ENV_PATH" > $BACKUP_PATH/pg_rman.ini
echo "BACKUP_MODE=ENV_PATH" > $BACKUP_PATH/pg_arman.ini
mkdir $BACKUP_PATH/conf_path
echo "BACKUP_PATH=$BACKUP_PATH/conf_path" > $BACKUP_PATH/pg_rman.conf
echo "BACKUP_MODE=CONF_PATH" > $BACKUP_PATH/conf_path/pg_rman.ini
echo "BACKUP_PATH=$BACKUP_PATH/conf_path" > $BACKUP_PATH/pg_arman.conf
echo "BACKUP_MODE=CONF_PATH" > $BACKUP_PATH/conf_path/pg_arman.ini
mkdir $BACKUP_PATH/comm_path
echo "BACKUP_MODE=COMM_PATH" > $BACKUP_PATH/comm_path/pg_rman.ini
echo "BACKUP_MODE=COMM_PATH" > $BACKUP_PATH/comm_path/pg_arman.ini
export BACKUP_PATH=$BACKUP_PATH
pg_rman backup --verbose
pg_arman backup --verbose

View File

@ -1,8 +1,8 @@
-- test show command
\! rm -rf ${PWD}/results/sample_backup
\! cp -rp data/sample_backup ${PWD}/results/sample_backup
\! pg_rman show -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
\! pg_rman validate -B ${PWD}/results/sample_backup 2009-05-31 17:05:53 --debug
\! pg_rman validate -B ${PWD}/results/sample_backup 2009-06-01 17:05:53 --debug
\! pg_rman show -a -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
\! pg_rman show 2009-06-01 17:05:53 -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
\! pg_arman show -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
\! pg_arman validate -B ${PWD}/results/sample_backup 2009-05-31 17:05:53 --debug
\! pg_arman validate -B ${PWD}/results/sample_backup 2009-06-01 17:05:53 --debug
\! pg_arman show -a -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup
\! pg_arman show 2009-06-01 17:05:53 -A ${PWD}/results/arclog -B ${PWD}/results/sample_backup

View File

@ -16,7 +16,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "pg_rman.h"
#include "pg_arman.h"
/* PID can be negative for standalone backend */
typedef long pgpid_t;

2
util.c
View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <time.h>

View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <sys/stat.h>
@ -23,11 +23,11 @@ do_validate(pgBackupRange *range)
int i;
parray *backup_list;
int ret;
bool another_pg_rman = false;
bool another_pg_arman = false;
ret = catalog_lock();
if (ret == 1)
another_pg_rman = true;
another_pg_arman = true;
/* get backup list matches given range */
backup_list = catalog_get_backup_list(range);
@ -40,7 +40,7 @@ do_validate(pgBackupRange *range)
pgBackup *backup = (pgBackup *)parray_get(backup_list, i);
/* clean extra backups (switch STATUS to ERROR) */
if(!another_pg_rman &&
if(!another_pg_arman &&
(backup->status == BACKUP_STATUS_RUNNING || backup->status == BACKUP_STATUS_DELETING)){
backup->status = BACKUP_STATUS_ERROR;
pgBackupWriteIni(backup);

2
xlog.c
View File

@ -7,7 +7,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_rman.h"
#include "pg_arman.h"
#include <stdio.h>
#include <sys/types.h>