I have committed this, with some more kibitzing. hope I have not missed any comments given so far. Many thanks for the review, and please continue reviewing and testing it :-).
I have been testing the pg_rewind and have an analysis to share along with few questions -
I had a streaming replication setup with one master and one slave running successfully.
Test 1 :
- Killed postgres process on master and promoted slave. Both were in sync earlier.
- performed some operations (data changes) on newly promoted slave node and shutdown
- Executed pg_rewind on old master and got the below message
target server must be shut down cleanly
Failure, exiting
If the master is crashed or killed abruptly, it may not be possible to do a rewind. Is my understanding correct ?
Test 2 :
- On a successfully running streaming replication with one master and one slave, i did a clean shutdown of master
- promoted slave
- performed some operations (data changes) on newly promoted slave and did a clean shutdown
- Executed pg_rewind on the old master to sync with the latest changes on new master. I got the below message
The servers diverged at WAL position 0/A2000098 on timeline 1.