[HACKERS] issue about the streaming replication - Mailing list pgsql-hackers

From Jinhua Luo
Subject [HACKERS] issue about the streaming replication
Date
Msg-id CAAc9rOyKAyzipiq7ee1=VbcRy2fRqV_hRujLbC0mrBkL07=7wQ@mail.gmail.com
Whole thread Raw
Responses Re: [HACKERS] issue about the streaming replication  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
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 be
missing on B
d) A crashes
e) promote B as new master, insert some data into table foobar on B
f) now data on A and B diverge

When I restart A as new slave, it reports below error in log:
record with incorrect prev-link

And worse is, when I shutdown B and promotes A as master again, it
fails to startup:
LOG:  database system was shut down in recovery
FATAL:  invalid memory alloc request size 2281725952

what's this error and why?

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 would be promoted to new master and accepts new
transactions, then how to recover the old master? Moreover, how to
recover the data on old master which is missing on new master?

Regards,
Jinhua Luo



pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] \if, \elseif, \else, \endif (was Re: PSQL commands:\quit_if, \quit_unless)
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] issue about the streaming replication