diff --git a/doc/pg_arman.md b/doc/pg_arman.md index 95ecaaa5..22a92823 100644 --- a/doc/pg_arman.md +++ b/doc/pg_arman.md @@ -95,7 +95,7 @@ the file manually. It is recommended to take a full backup as soon as possible after recovery has succeeded. -If "--recovery-target-timeline" is not specifed, the last checkpoint's +If "--timeline" is not specifed, the last checkpoint's TimeLineID in control file ($PGDATA/global/pg_control) will be the restore target. If pg_control is not present, TimeLineID in the full backup used by the restore will be a restore target. @@ -184,7 +184,7 @@ STATUS=OK ``` You can check the "RECOVERY_XID" and "RECOVERY_TIME" which are used for -restore option "--recovery-target-xid", "--recovery-target-time". +restore option "--xid", "--time". The delete command deletes backup files not required by recovery after the specified ID. This command also cleans up in the WAL archive the @@ -250,19 +250,19 @@ absolute paths; relative paths are not allowed. The parameters whose name start are started with --recovery refer to the same parameters as the ones in recovery.confin recovery.conf. -**--recovery-target-timeline**=_TIMELINE_: +**--timeline**=_TIMELINE_: Specifies recovering into a particular timeline. If not specified, the current timeline is used. -**--recovery-target-time**=TIMESTAMP: +**--time**=TIMESTAMP: This parameter specifies the timestamp up to which recovery will proceed. -**--recovery-target-xid**=XID: +**--xid**=XID: This parameter specifies the transaction ID up to which recovery will proceed. -**--recovery-target-inclusive**: +**--inclusive**: Specifies whether server pauses when recovery target is reached. **-j**=NUMBER / **--threads**=NUMBER: @@ -348,10 +348,10 @@ Short Long Env File --validate VALIDATE Yes --keep-data-generations KEEP_DATA_GENERATIONS Yes --keep-data-days KEEP_DATA_DAYS Yes - --recovery-target-timeline RECOVERY_TARGET_TIMELINE Yes - --recovery-target-xid RECOVERY_TARGET_XID Yes - --recovery-target-time RECOVERY_TARGET_TIME Yes - --recovery-target-inclusive RECOVERY_TARGET_INCLUSIVE Yes + --timeline RECOVERY_TARGET_TIMELINE Yes + --xid RECOVERY_TARGET_XID Yes + --time RECOVERY_TARGET_TIME Yes + --inclusive RECOVERY_TARGET_INCLUSIVE Yes ``` Variable names in configuration file are the same as long names or names diff --git a/expected/option.out b/expected/option.out index 8f263afd..d1d5cf6a 100644 --- a/expected/option.out +++ b/expected/option.out @@ -26,10 +26,10 @@ Backup options: -S, --slot=SLOTNAME replication slot to use Restore options: - --recovery-target-time time stamp up to which recovery will proceed - --recovery-target-xid transaction ID up to which recovery will proceed - --recovery-target-inclusive whether we stop just after the recovery target - --recovery-target-timeline recovering into a particular timeline + --time time stamp up to which recovery will proceed + --xid transaction ID up to which recovery will proceed + --inclusive whether we stop just after the recovery target + --timeline recovering into a particular timeline Catalog options: -a, --show-all show deleted backup too diff --git a/expected/restore.out b/expected/restore.out index 4d539647..0dc52055 100644 --- a/expected/restore.out +++ b/expected/restore.out @@ -27,7 +27,7 @@ OK: recovery.conf has the given target timeline. ###### recovery to target XID ###### 0 0 -OK: recovery-target-xid options works well. +OK: xid options works well. ###### RESTORE COMMAND TEST-0006 ###### ###### recovery to latest from full + ptrack backups ###### @@ -64,4 +64,4 @@ OK: recovery-target-xid options works well. ###### recovery with target inclusive false ###### 0 0 -OK: recovery-target-inclusive=false works well. +OK: inclusive=false works well. diff --git a/pg_arman.c b/pg_arman.c index 80e8a3d8..cc0e292b 100644 --- a/pg_arman.c +++ b/pg_arman.c @@ -71,10 +71,10 @@ static pgut_option options[] = /* { 'i', 1, "keep-data-generations", &keep_data_generations, SOURCE_ENV }, { 'i', 2, "keep-data-days", &keep_data_days, SOURCE_ENV },*/ /* restore options */ - { 's', 3, "recovery-target-time", &target_time, SOURCE_ENV }, - { 's', 4, "recovery-target-xid", &target_xid, SOURCE_ENV }, - { 's', 5, "recovery-target-inclusive", &target_inclusive, SOURCE_ENV }, - { 'u', 6, "recovery-target-timeline", &target_tli, SOURCE_ENV }, + { 's', 3, "time", &target_time, SOURCE_ENV }, + { 's', 4, "xid", &target_xid, SOURCE_ENV }, + { 's', 5, "inclusive", &target_inclusive, SOURCE_ENV }, + { 'u', 6, "timeline", &target_tli, SOURCE_ENV }, /* catalog options */ { 'b', 'a', "show-all", &show_all }, /* delete options */ @@ -249,10 +249,10 @@ pgut_help(bool details) printf(_(" --backup-pg-log start backup pg_log directory\n")); printf(_(" -S, --slot=SLOTNAME replication slot to use\n")); printf(_("\nRestore options:\n")); - printf(_(" --recovery-target-time time stamp up to which recovery will proceed\n")); - printf(_(" --recovery-target-xid transaction ID up to which recovery will proceed\n")); - printf(_(" --recovery-target-inclusive whether we stop just after the recovery target\n")); - printf(_(" --recovery-target-timeline recovering into a particular timeline\n")); + printf(_(" --time time stamp up to which recovery will proceed\n")); + printf(_(" --xid transaction ID up to which recovery will proceed\n")); + printf(_(" --inclusive whether we stop just after the recovery target\n")); + printf(_(" --timeline recovering into a particular timeline\n")); printf(_("\nCatalog options:\n")); printf(_(" -a, --show-all show deleted backup too\n")); printf(_("\nDelete options:\n")); diff --git a/sql/restore.sh b/sql/restore.sh index bdbca96b..2352a1b3 100644 --- a/sql/restore.sh +++ b/sql/restore.sh @@ -69,7 +69,7 @@ pg_arman restore -B ${BACKUP_PATH} --verbose >> ${TEST_BASE}/TEST-0003-run.out 2 pg_ctl start -w -t 600 > /dev/null 2>&1 pgbench -p ${TEST_PGPORT} -d pgbench > /dev/null 2>&1 pg_ctl stop -m immediate > /dev/null 2>&1 -pg_arman restore -B ${BACKUP_PATH} --recovery-target-timeline=${TARGET_TLI} --verbose >> ${TEST_BASE}/TEST-0003-run.out 2>&1;echo $? +pg_arman restore -B ${BACKUP_PATH} --timeline=${TARGET_TLI} --verbose >> ${TEST_BASE}/TEST-0003-run.out 2>&1;echo $? echo "checking recovery.conf..." TARGET_TLI_IN_RECOVERY_CONF=`grep "recovery_target_timeline = " ${PGDATA_PATH}/recovery.conf | awk '{print $3}' | sed -e "s/'//g"` if [ ${TARGET_TLI} = ${TARGET_TLI_IN_RECOVERY_CONF} ]; then @@ -95,7 +95,7 @@ pg_arman validate -B ${BACKUP_PATH} --verbose >> ${TEST_BASE}/TEST-0004-run.out TARGET_TIME=`date +"%Y-%m-%d %H:%M:%S"` pgbench -p ${TEST_PGPORT} -d pgbench > /dev/null 2>&1 pg_ctl stop -m immediate > /dev/null 2>&1 -pg_arman restore -B ${BACKUP_PATH} --recovery-target-time="${TARGET_TIME}" --verbose >> ${TEST_BASE}/TEST-0004-run.out 2>&1;echo $? +pg_arman restore -B ${BACKUP_PATH} --time="${TARGET_TIME}" --verbose >> ${TEST_BASE}/TEST-0004-run.out 2>&1;echo $? pg_ctl start -w -t 600 > /dev/null 2>&1 psql --no-psqlrc -p ${TEST_PGPORT} -d pgbench -c "SELECT * FROM pgbench_branches;" > ${TEST_BASE}/TEST-0004-after.out diff ${TEST_BASE}/TEST-0004-before.out ${TEST_BASE}/TEST-0004-after.out @@ -118,15 +118,15 @@ pgbench -p ${TEST_PGPORT} -d pgbench > /dev/null 2>&1 psql --no-psqlrc -p ${TEST_PGPORT} -d pgbench -c 'SELECT pg_switch_xlog()' > /dev/null 2>&1 # Fast mode is used to ensure that the last segment is archived as well. pg_ctl stop -m fast > /dev/null 2>&1 -pg_arman restore -B ${BACKUP_PATH} --recovery-target-xid="${TARGET_XID}" --verbose >> ${TEST_BASE}/TEST-0005-run.out 2>&1;echo $? +pg_arman restore -B ${BACKUP_PATH} --xid="${TARGET_XID}" --verbose >> ${TEST_BASE}/TEST-0005-run.out 2>&1;echo $? pg_ctl start -w -t 600 > /dev/null 2>&1 psql --no-psqlrc -p ${TEST_PGPORT} -d pgbench -c "SELECT * FROM pgbench_branches;" > ${TEST_BASE}/TEST-0005-after.out psql --no-psqlrc -p ${TEST_PGPORT} -d pgbench -c "SELECT * FROM tbl0005;" > ${TEST_BASE}/TEST-0005-tbl.dump diff ${TEST_BASE}/TEST-0005-before.out ${TEST_BASE}/TEST-0005-after.out if grep "inserted" ${TEST_BASE}/TEST-0005-tbl.dump > /dev/null ; then - echo 'OK: recovery-target-xid options works well.' + echo 'OK: xid options works well.' else - echo 'NG: recovery-target-xid options does not work well.' + echo 'NG: xid options does not work well.' pg_ctl stop -m immediate -D ${PGDATA_PATH} > /dev/null 2>&1 exit 1 fi @@ -252,15 +252,15 @@ pgbench -p ${TEST_PGPORT} -d pgbench > /dev/null 2>&1 psql --no-psqlrc -p ${TEST_PGPORT} -d pgbench -c 'SELECT pg_switch_xlog()' > /dev/null 2>&1 # Fast mode is used to ensure that the last segment is archived as well. pg_ctl stop -m fast > /dev/null 2>&1 -pg_arman restore -B ${BACKUP_PATH} --recovery-target-xid="${TARGET_XID}" --recovery-target-inclusive=false --verbose >> ${TEST_BASE}/TEST-0008-run.out 2>&1;echo $? +pg_arman restore -B ${BACKUP_PATH} --xid="${TARGET_XID}" --inclusive=false --verbose >> ${TEST_BASE}/TEST-0008-run.out 2>&1;echo $? pg_ctl start -w -t 600 > /dev/null 2>&1 psql --no-psqlrc -p ${TEST_PGPORT} -d pgbench -c "SELECT * FROM pgbench_branches;" > ${TEST_BASE}/TEST-0008-after.out psql --no-psqlrc -p ${TEST_PGPORT} -d pgbench -c "SELECT * FROM tbl0008;" > ${TEST_BASE}/TEST-0008-tbl.dump diff ${TEST_BASE}/TEST-0008-before.out ${TEST_BASE}/TEST-0008-after.out if grep "inserted" ${TEST_BASE}/TEST-0008-tbl.dump > /dev/null ; then - echo 'NG: recovery-target-inclusive=false does not work well.' + echo 'NG: inclusive=false does not work well.' else - echo 'OK: recovery-target-inclusive=false works well.' + echo 'OK: inclusive=false works well.' pg_ctl stop -m immediate -D ${PGDATA_PATH} > /dev/null 2>&1 exit 1 fi