Hi,
You might have to wait for pg_is_in_recovery to be false after the promotion. (in 9.6 pg_ctl promote doesn't wait for promotion to complete unlike 10). [1]
You should CHECKOINT between 2 and 3. (or wait for the first checkpoint to finish)
In the thread [2], Michael Paquier explains that:
In the thread [2], Michael Paquier explains that:
"
This makes the promoted standby update its
timeline number in the on-disk control file, which is used by pg_rewind
to check if a rewind needs to happen or not. "
timeline number in the on-disk control file, which is used by pg_rewind
to check if a rewind needs to happen or not. "