repro_skipping_slot_sync.sh
application/octet-stream
Filename: repro_skipping_slot_sync.sh
Type: application/octet-stream
Part: 3
Message:
RE: speed up a logical replica setup
#!/bin/bash
# set -e
echo 'Clean up'
pg_ctl stop -D data_N1
pg_ctl stop -D data_N2
pg_ctl stop -D data_N3
rm -r data_* *log
echo 'Set up'
# Setup and start publisher
initdb -D data_N1 -U postgres
cat << EOF >> data_N1/postgresql.conf
wal_level = logical
EOF
pg_ctl -D data_N1 start -w -l N1.log
psql -U postgres -c "SELECT * FROM pg_create_physical_replication_slot('physical_slot');"
pg_basebackup -D data_N2 -d "user=postgres dbname=postgres" -R -S physical_slot
psql -U postgres -c "SELECT * FROM pg_create_logical_replication_slot('test1', 'pgoutput', false, true, true);"
cat << EOF >> data_N2/postgresql.conf
port = 9000
hot_standby_feedback = on
EOF
pg_ctl -D data_N2 start -w -l N2.log
psql -U postgres -p 9000 -c "SELECT pg_sync_replication_slots();"