Hi,
I found that pg_rewind is failing against the latest sources of PG
v12Beta2 / PG 13devel
Steps to reproduce -
=============
0)mkdir /tmp/archive_dir
1)Master Setup -> ./initdb -D master , add these parameters in
postgresql.conf file -
"
wal_level = hot_standby
wal_log_hints = on
hot_standby = on
archive_mode=on
archive_command='cp %p /tmp/archive_dir/%f'
port=5432
"
Start the server (./pg_ctl -D master start)
Connect to psql terminal - create table/ insert few rows / select
pg_switch_wal(); -- fire 3 times
2)Slave Setup -> ./pg_basebackup -PR -X stream -c fast -h 127.0.0.1 -U
centos -p 5432 -D slave
add these parameters in postgresql.conf file of SLAVE-
"
primary_conninfo = 'user=centos host=127.0.0.1 port=5432'
promote_trigger_file = '/tmp/t00.txt'
restore_command='cp /tmp/archive_dir/%f %p'
port=5555
"
Start Slave (./pg_ctl -D slave start)
3)Touch trigger file (touch /tmp/t00.txt) -> - standby.signal is gone
from standby directory and now able to insert rows on standby server.
4)stop master ( ./pg_ctl -D master stop)
5)Perform pg_rewind
[centos@mail-arts bin]$ ./pg_rewind -D master/
--source-server="host=localhost port=5555 user=centos password=nothing
dbname=postgres"
pg_rewind: servers diverged at WAL location 0/3000158 on timeline 1
*pg_rewind: error: could not open file
"master//pg_wal/000000010000000000000003": No such file or directory*
pg_rewind: fatal: could not find previous WAL record at 0/3000158
Earlier ,i was getting this below result -
[centos@mail-arts bin]$ ./pg_rewind -D master/
--source-server="host=localhost port=5555 user=centos password=edb
dbname=postgres"
pg_rewind: servers diverged at WAL location 0/3003538 on timeline 1
pg_rewind: rewinding from last common checkpoint at 0/2000060 on timeline 1
pg_rewind: Done!
--
regards,tushar
EnterpriseDB https://www.enterprisedb.com/
The Enterprise PostgreSQL Company