Re: [HACKERS] issue about the streaming replication

2017-03-12 Thread Jinhua Luo
Thanks for your information. Now I know the pg_rewind tool. But why PG does not recover the diverge automatically? There exists two options at least, analogy to what "git merge" does: a) the old master find out and rewind itself to the common base of the new master in the WAL history before

Re: [HACKERS] issue about the streaming replication

2017-03-12 Thread Michael Paquier
On Sun, Mar 12, 2017 at 5:24 PM, Jinhua Luo wrote: > I think this diverge scenario is common, because it's likely the > master would crash due to some hardware issue (e.g. power off) which > would cause some committed transaction has not yet synced to slave, > while the slave

[HACKERS] issue about the streaming replication

2017-03-12 Thread Jinhua Luo
Hi, I make a test to see how postgresql handle replication diverge problem: a) setup two pg cluster A and B b) run A as master, B as salve, using streaming replication c) insert some data into table foobar on A, shutdown the network between A and B at the meantime, which ends up some data would