Re: (replication) Detecting if server a slave, or a master in recovery

From: Toby Corkindale <toby(dot)corkindale(at)strategicdata(dot)com(dot)au>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: (replication) Detecting if server a slave, or a master in recovery
Date: 2011-09-12 07:32:36
Message-ID: 4E6DB594.7080005@strategicdata.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/09/11 17:27, Simon Riggs wrote:
> On Mon, Sep 12, 2011 at 8:19 AM, Toby Corkindale
> <toby(dot)corkindale(at)strategicdata(dot)com(dot)au> wrote:
>> On 12/09/11 17:13, Simon Riggs wrote:
>>>
>>> On Mon, Sep 12, 2011 at 7:54 AM, Toby Corkindale
>>>> What is the best method for determining whether you're connected to the
>>>> master or slave database?
>>>
>>> SELECT pg_is_in_recovery();
>>
>>
>> If I'm on a master database, which had previously crashed and is now in the
>> process of recovery, won't that also return "true" there?
>
>
> No, because you can't connect to the database during crash recovery,
> so the first time you can connect to a has-crashed master it will
> return false.

aaah.. Thanks! I didn't realise that.

Thanks for your help.

-Toby

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mudit Mishra 2011-09-12 07:45:20 Re: writing block 6850 of relation 1663/17231/1259
Previous Message Simon Riggs 2011-09-12 07:27:34 Re: (replication) Detecting if server a slave, or a master in recovery