Skip to content

Commit

Permalink
Change the backup_from_standby test item.
Browse files Browse the repository at this point in the history
Change the backup_from_standby test item because it is not possible
to create a streaming replication with external tablespaces on one localhost.
So I removed command about created external tablespace.
And I used pg_basebackp command to replaced pg_backup_start() and pg_backup_stop().
  • Loading branch information
zwyan0 committed Nov 21, 2023
1 parent e412f97 commit 00d0198
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions sql/backup_from_standby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ function cleanup()
rm -fr ${BACKUP_PATH}
rm -fr ${ARCLOG_PATH}
rm -fr ${SRVLOG_PATH}
rm -fr ${TBLSPC_PATH}
mkdir -p ${ARCLOG_PATH}
mkdir -p ${SRVLOG_PATH}
mkdir -p ${TBLSPC_PATH}
}

function init_backup()
Expand Down Expand Up @@ -101,10 +99,8 @@ EOF

# start PostgreSQL
pg_ctl start -D ${PGDATA_PATH} -w -t 300 > /dev/null 2>&1
mkdir -p ${TBLSPC_PATH}/pgbench
psql --no-psqlrc -p ${TEST_PGPORT} -d postgres > /dev/null 2>&1 << EOF
CREATE TABLESPACE pgbench LOCATION '${TBLSPC_PATH}/pgbench';
CREATE DATABASE pgbench TABLESPACE = pgbench;
CREATE DATABASE pgbench;
EOF

pgbench -i -s $SCALE -p ${TEST_PGPORT} -d pgbench > ${TEST_BASE}/pgbench.log 2>&1
Expand All @@ -119,16 +115,7 @@ function init_catalog()

function setup_standby()
{
psql --no-psqlrc -p ${TEST_PGPORT} -d postgres -c "SELECT pg_start_backup('sby-bkp-test', true)" > /dev/null 2>&1

rm -rf ${SBYDATA_PATH}
cp -r ${PGDATA_PATH} ${SBYDATA_PATH}
rm ${SBYDATA_PATH}/postmaster.*

psql --no-psqlrc -p ${TEST_PGPORT} -d postgres > /dev/null 2>&1 << EOF
SELECT pg_stop_backup();
EOF

pg_basebackup -d "dbname=pgbench host=localhost port=${TEST_PGPORT}" -D ${SBYDATA_PATH} --checkpoint=fast > /dev/null 2>&1
cp ${SBYDATA_PATH}/postgresql.conf_org ${SBYDATA_PATH}/postgresql.conf
cat >> ${SBYDATA_PATH}/postgresql.conf << EOF
port = ${TEST_SBYPGPORT}
Expand Down Expand Up @@ -280,4 +267,4 @@ rm -rf ${SBYDATA_PATH}
rm -fr ${BACKUP_PATH}
rm -fr ${ARCLOG_PATH}
rm -fr ${SRVLOG_PATH}
rm -fr ${TBLSPC_PATH}

0 comments on commit 00d0198

Please sign in to comment.