@@ -30,10 +30,10 @@ init_backup
3030pgbench_objs 0001
3131pgbench -p${TEST_PGPORT} -d pgbench> /dev/null2>&1
3232psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0001-before.out
33- pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --quiet ; echo $?
34- pg_arman validate -B${BACKUP_PATH} --quiet
33+ pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --verbose > ${TEST_BASE} /TEST-0001-run.out 2>&1 ; echo $?
34+ pg_arman validate -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0001-run.out 2>&1
3535pg_ctl stop -m immediate> /dev/null2>&1
36- pg_arman restore -B${BACKUP_PATH} --quiet ; echo $?
36+ pg_arman restore -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0001-run.out 2>&1 ; echo $?
3737pg_ctl start -w -t 600> /dev/null2>&1
3838psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0001-after.out
3939diff${TEST_BASE} /TEST-0001-before.out${TEST_BASE} /TEST-0001-after.out
@@ -43,14 +43,14 @@ echo '###### RESTORE COMMAND TEST-0002 ######'
4343echo ' ###### recovery to latest from full + page backups ######'
4444init_backup
4545pgbench_objs 0002
46- pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --quiet ; echo $?
47- pg_arman validate -B${BACKUP_PATH} --quiet
46+ pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --verbose > ${TEST_BASE} /TEST-0002-run.out 2>&1 ; echo $?
47+ pg_arman validate -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0002-run.out 2>&1
4848pgbench -p${TEST_PGPORT} -d pgbench> /dev/null2>&1
49- pg_arman backup -B${BACKUP_PATH} -b page -p${TEST_PGPORT} -d postgres --quiet ; echo $?
50- pg_arman validate -B${BACKUP_PATH} --quiet
49+ pg_arman backup -B${BACKUP_PATH} -b page -p${TEST_PGPORT} -d postgres --verbose >> ${TEST_BASE} /TEST-0002-run.out 2>&1 ; echo $?
50+ pg_arman validate -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0002-run.out 2>&1
5151psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0002-before.out
5252pg_ctl stop -m immediate> /dev/null2>&1
53- pg_arman restore -B${BACKUP_PATH} --quiet ; echo $?
53+ pg_arman restore -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0002-run.out 2>&1 ; echo $?
5454pg_ctl start -w -t 600> /dev/null2>&1
5555psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0002-after.out
5656diff${TEST_BASE} /TEST-0002-before.out${TEST_BASE} /TEST-0002-after.out
@@ -61,21 +61,23 @@ echo '###### recovery to target timeline ######'
6161init_backup
6262pgbench_objs 0003
6363psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0003-before.out
64- pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --quiet ; echo $?
65- pg_arman validate -B${BACKUP_PATH} --quiet
64+ pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --verbose > ${TEST_BASE} /TEST-0003-run.out 2>&1 ; echo $?
65+ pg_arman validate -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0003-run.out 2>&1
6666TARGET_TLI=` pg_controldata| grep" TimeLineID:" | awk' {print $4}' `
6767pg_ctl stop -m immediate> /dev/null2>&1
68- pg_arman restore -B${BACKUP_PATH} --quiet ; echo $?
68+ pg_arman restore -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0003-run.out 2>&1 ; echo $?
6969pg_ctl start -w -t 600> /dev/null2>&1
7070pgbench -p${TEST_PGPORT} -d pgbench> /dev/null2>&1
7171pg_ctl stop -m immediate> /dev/null2>&1
72- pg_arman restore -B${BACKUP_PATH} --recovery-target-timeline=${TARGET_TLI} --quiet ; echo $?
72+ pg_arman restore -B${BACKUP_PATH} --recovery-target-timeline=${TARGET_TLI} --verbose >> ${TEST_BASE} /TEST-0003-run.out 2>&1 ; echo $?
7373echo " checking recovery.conf..."
7474TARGET_TLI_IN_RECOVERY_CONF=` grep" recovery_target_timeline =" ${PGDATA_PATH} /recovery.conf| awk' {print $3}' | sed -e" s/'//g" `
7575if [${TARGET_TLI} = ${TARGET_TLI_IN_RECOVERY_CONF} ]; then
7676echo ' OK: recovery.conf has the given target timeline.'
7777else
7878echo ' NG: recovery.conf does not have the given target timeline.'
79+ pg_ctl stop -m immediate -D${PGDATA_PATH}
80+ exit 1
7981fi
8082pg_ctl start -w -t 600> /dev/null2>&1
8183psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0003-after.out
@@ -88,12 +90,12 @@ init_backup
8890pgbench_objs 0004
8991pgbench -p${TEST_PGPORT} -d pgbench> /dev/null2>&1
9092psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0004-before.out
91- pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --quiet ; echo $?
92- pg_arman validate -B${BACKUP_PATH} --quiet
93+ pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --verbose > ${TEST_BASE} /TEST-0004-run.out 2>&1 ; echo $?
94+ pg_arman validate -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0004-run.out 2>&1
9395TARGET_TIME=` date +" %Y-%m-%d %H:%M:%S" `
9496pgbench -p${TEST_PGPORT} -d pgbench> /dev/null2>&1
9597pg_ctl stop -m immediate> /dev/null2>&1
96- pg_arman restore -B${BACKUP_PATH} --recovery-target-time=" ${TARGET_TIME} " --quiet ; echo $?
98+ pg_arman restore -B${BACKUP_PATH} --recovery-target-time=" ${TARGET_TIME} " --verbose >> ${TEST_BASE} /TEST-0004-run.out 2>&1 ; echo $?
9799pg_ctl start -w -t 600> /dev/null2>&1
98100psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0004-after.out
99101diff${TEST_BASE} /TEST-0004-before.out${TEST_BASE} /TEST-0004-after.out
@@ -104,8 +106,8 @@ echo '###### recovery to target XID ######'
104106init_backup
105107pgbench_objs 0005
106108psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" CREATE TABLE tbl0005 (a text);" > /dev/null2>&1
107- pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --quiet ; echo $?
108- pg_arman validate -B${BACKUP_PATH} --quiet
109+ pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --verbose > ${TEST_BASE} /TEST-0005-run.out 2>&1 ; echo $?
110+ pg_arman validate -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0005-run.out 2>&1
109111pgbench -p${TEST_PGPORT} pgbench> /dev/null2>&1
110112psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0005-before.out
111113TARGET_XID=` psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -tAq -c" INSERT INTO tbl0005 VALUES ('inserted') RETURNING (xmin);" `
@@ -116,7 +118,7 @@ pgbench -p ${TEST_PGPORT} -d pgbench > /dev/null 2>&1
116118psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c' SELECT pg_switch_xlog()' > /dev/null2>&1
117119# Fast mode is used to ensure that the last segment is archived as well.
118120pg_ctl stop -m fast> /dev/null2>&1
119- pg_arman restore -B${BACKUP_PATH} --recovery-target-xid=" ${TARGET_XID} " --quiet ; echo $?
121+ pg_arman restore -B${BACKUP_PATH} --recovery-target-xid=" ${TARGET_XID} " --verbose >> ${TEST_BASE} /TEST-0005-run.out 2>&1 ; echo $?
120122pg_ctl start -w -t 600> /dev/null2>&1
121123psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0005-after.out
122124psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM tbl0005;" > ${TEST_BASE} /TEST-0005-tbl.dump
@@ -125,6 +127,8 @@ if grep "inserted" ${TEST_BASE}/TEST-0005-tbl.dump > /dev/null ; then
125127echo ' OK: recovery-target-xid options works well.'
126128else
127129echo ' NG: recovery-target-xid options does not work well.'
130+ pg_ctl stop -m immediate -D${PGDATA_PATH} > /dev/null2>&1
131+ exit 1
128132fi
129133echo ' '
130134
@@ -133,8 +137,8 @@ echo '###### recovery with target inclusive false ######'
133137init_backup
134138pgbench_objs 0006
135139psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" CREATE TABLE tbl0006 (a text);" > /dev/null2>&1
136- pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --quiet ; echo $?
137- pg_arman validate -B${BACKUP_PATH} --quiet
140+ pg_arman backup -B${BACKUP_PATH} -b full -p${TEST_PGPORT} -d postgres --verbose > ${TEST_BASE} /TEST-0006-run.out 2>&1 ; echo $?
141+ pg_arman validate -B${BACKUP_PATH} --verbose >> ${TEST_BASE} /TEST-0003-run.out 2>&1
138142pgbench -p${TEST_PGPORT} pgbench> /dev/null2>&1
139143psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0006-before.out
140144TARGET_XID=` psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -tAq -c" INSERT INTO tbl0006 VALUES ('inserted') RETURNING (xmin);" `
@@ -145,7 +149,7 @@ pgbench -p ${TEST_PGPORT} -d pgbench > /dev/null 2>&1
145149psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c' SELECT pg_switch_xlog()' > /dev/null2>&1
146150# Fast mode is used to ensure that the last segment is archived as well.
147151pg_ctl stop -m fast> /dev/null2>&1
148- pg_arman restore -B${BACKUP_PATH} --recovery-target-xid=" ${TARGET_XID} " --recovery-target-inclusive=false --quiet ; echo $?
152+ pg_arman restore -B${BACKUP_PATH} --recovery-target-xid=" ${TARGET_XID} " --recovery-target-inclusive=false --verbose >> ${TEST_BASE} /TEST-0006-run.out 2>&1 ; echo $?
149153pg_ctl start -w -t 600> /dev/null2>&1
150154psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM pgbench_branches;" > ${TEST_BASE} /TEST-0006-after.out
151155psql --no-psqlrc -p${TEST_PGPORT} -d pgbench -c" SELECT * FROM tbl0006;" > ${TEST_BASE} /TEST-0006-tbl.dump
@@ -154,6 +158,8 @@ if grep "inserted" ${TEST_BASE}/TEST-0006-tbl.dump > /dev/null ; then
154158echo ' NG: recovery-target-inclusive=false does not work well.'
155159else
156160echo ' OK: recovery-target-inclusive=false works well.'
161+ pg_ctl stop -m immediate -D${PGDATA_PATH} > /dev/null2>&1
162+ exit 1
157163fi
158164echo ' '
159165