Skip to content

Commit

Permalink
Fixed regression test failure (#254)
Browse files Browse the repository at this point in the history
* Change the backup_from_standby test item.

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().

* Corrected parameter values.
  • Loading branch information
zwyan0 committed Nov 22, 2023
1 parent 91ebbf4 commit 14e3cea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion sql/arc_srv_log_management.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function init_backup()
cat << EOF >> $PGDATA_PATH/postgresql.conf
port = ${TEST_PGPORT}
logging_collector = on
wal_level = hot_standby
wal_level = replica
log_directory = '${SRVLOG_PATH}'
archive_mode = on
archive_command = 'cp %p ${ARCLOG_PATH}/%f'
Expand Down
25 changes: 6 additions & 19 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,32 +115,23 @@ 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}
hot_standby = on
logging_collector = on
wal_level = hot_standby
wal_level = replica
EOF
touch ${SBYDATA_PATH}/standby.signal

cat >> ${SBYDATA_PATH}/postgresql.conf << EOF
restore_command = 'cp "${ARCLOG_PATH}/%f" "%p"'
primary_conninfo = 'port=${TEST_PGPORT} application_name=slave'
primary_conninfo = 'port=${TEST_PGPORT} application_name=standby'
EOF

cat >> ${PGDATA_PATH}/postgresql.conf << EOF
synchronous_standby_names = 'slave'
synchronous_standby_names = 'standby'
EOF
pg_ctl -D ${PGDATA_PATH} reload > /dev/null 2>&1
pg_ctl -D ${SBYDATA_PATH} start -w -t 600 > /dev/null 2>&1
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 14e3cea

Please sign in to comment.