After switching primary server while using replication slot.

From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: After switching primary server while using replication slot.
Date: 2014-08-18 14:16:45
Message-ID: CAD21AoDWkwwPmhWJY90UjO-4u1W5KK4NAY-9ewpU7f-8mgSmJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

After switching primary serer while using repliaction slot, the
standby server will not able to connect new primary server.
Imagine this situation, if primary server has two ASYNC standby
servers, also use each replication slots.
And the one standby(A) apply WAL without problems. But another one
standby(B) has stopped after connected to primary server.
(or sending WAL is too delayed)

In this situation, the standby(B) has not received WAL segment file
while stopping itself.
And the primary server can not remove WAL segments which has not been
received to all standby.
Therefore the primary server have to keep the WAL segment file which
has not been received to all standby.
But standby(A) can do checkpoint itself, and then it's possible to
recycle WAL segments.
The number of WAL segment of each server are different.
( The number of WAL files of standby(A) having smaller than primary server.)
After the primary server is crashed, the standby(A) promote to primary,
we can try to connect standby(B) to standby(A) as new standby server.
But it will be failed because the standby(A) server might not have WAL
segment files that standby(B) required.

To resolve this situation, I think that we should make master server
to notify about removal of WAL segment to all standby servers.
And the standby servers recycle WAL segments files base on that information.

Thought?

--
Regards,

-------
Sawada Masahiko

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-08-18 14:20:12 Re: option -T in pg_basebackup doesn't work on windows
Previous Message Noah Misch 2014-08-18 13:59:46 Re: Proposal to add a QNX 6.5 port to PostgreSQL