issue about the streaming replication

From: Jinhua Luo <luajit(dot)io(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: issue about the streaming replication
Date: 2017-03-12 08:24:24
Message-ID: CAAc9rOyKAyzipiq7ee1=VbcRy2fRqV_hRujLbC0mrBkL07=7wQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-03-12 11:20:39 Re: issue about the streaming replication
Previous Message Fabien COELHO 2017-03-12 08:22:08 Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)