diff --git a/sql/arc_srv_log_management.sh b/sql/arc_srv_log_management.sh index 78c2c437..f3edbf7c 100644 --- a/sql/arc_srv_log_management.sh +++ b/sql/arc_srv_log_management.sh @@ -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' diff --git a/sql/backup_from_standby.sh b/sql/backup_from_standby.sh index 8fe0d609..235679e7 100644 --- a/sql/backup_from_standby.sh +++ b/sql/backup_from_standby.sh @@ -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() @@ -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 @@ -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 @@ -280,4 +267,4 @@ rm -rf ${SBYDATA_PATH} rm -fr ${BACKUP_PATH} rm -fr ${ARCLOG_PATH} rm -fr ${SRVLOG_PATH} -rm -fr ${TBLSPC_PATH} +