Do you see any problems with this procedure for Old Master rebuild as a Slave upon switchover ?

From: Avinash Kumar <avinash(dot)vallarapu(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Do you see any problems with this procedure for Old Master rebuild as a Slave upon switchover ?
Date: 2019-04-29 03:28:31
Message-ID: CAN0Tujf0JJnC8RqbqBLX1xez9SGDSZhi6oc3JhB06WcDk1TTAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Team,

Let us say we have a Master (M1) and a Slave (S1) in replication using
Streaming Replication.

I stopped all my writes from Application and i switched a WAL and made sure
it is replicated to Slave.
I have then shutdown M1. And ran a promote on S1.
Now S1 is my new Master with a new timeline.

Now, in order to let M1 replicate changes from S1 (Master) as a Slave, i am
able to succeed with the following approach.

Add recovery_target_timeline = 'latest' and then have the appropriate
entries such as primary_conninfo, standby_mode in the recovery.conf and
start the M1 using pg_ctl.

I see that it M1 (Old Master) is able to catch up with S1 (New Master). And
replication is going fine.
Have you ever faced or think of a problem with this approach ?

Points to note are :
1. Master was neatly SHUTDOWN after shutting down writes. So, it has not
diverged. (If it is diverged, i would of course need a pg_rewind like
approach).
2. It was a planned switchover. During this entire process, there are no
writes to M1 (before Switchover) or S1 (after promote).
3. timeline history file is also accessible to the Old Master (M1) after S1
was promoted. No transactions, so no WALs generated, may be 1 or 2
considering timeout, etc.

It looks like a clean approach, but do you think there could be a problem
with this approach of rebuilding Old Master as a Slave ? Is this approach
still okay ?

Thanks,
Avinash Vallarapu.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daurnimator 2019-04-29 03:56:02 Re: BUG #15708: RLS 'using' running as wrong user when called from a view
Previous Message Noah Misch 2019-04-29 02:49:54 Re: Speed up build on Windows by generating symbol definition in batch