Finding the synchronous slave after a master crash - Mailing list pgsql-general

From Sam Crawley
Subject Finding the synchronous slave after a master crash
Date
Msg-id 51C140BA.1060003@catalyst.net.nz
Whole thread Raw
List pgsql-general
Hi,

I was just wondering if there was a reliable way to find the synchronous
slave if the master has crashed and is uncontactable. I believe the
recommended way to find the new master in this situation is to poll the
slaves, looking at the output of pg_last_xlog_replay_location(), and
find which is the most up-to-date.

However, this doesn't work if one or more of the slaves are also
uncontactable (an obscure, but not entirely unreasonable scenario). In
this case, we can't tell whether the uncontactable slave is actually the
most up-to-date (presumably because it was the most recent synchronous
slave), so can't be sure we have selected the correct new master.

This problem could easily be side-stepped if we knew which was the most
recent synchronous slave (and could query that from the slaves, as the
master is no longer contactable). We could then be sure that a new
master could be correctly selected (or that the synchronous slave is
also uncontactable, meaning we can't promote a new master without
risking data loss). Is there some mechanism for finding this that I've
missed, or some other way around this problem?

Thanks,
Sam Crawley.


pgsql-general by date:

Previous
From: Michael Paquier
Date:
Subject: Re: json functions
Next
From: sachin kotwal
Date:
Subject: Migration from DB2 to PostgreSQL