Skip site navigation (1) Skip section navigation (2)

Re: How to reliably detect if it's a promoting standby

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Tatsuo Ishii <ishii(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org, jaime(at)2ndquadrant(dot)com, david(at)fetter(dot)org
Subject: Re: How to reliably detect if it's a promoting standby
Date: 2010-10-20 14:51:40
Message-ID: AANLkTikg50D6PgzLbwgDvgBx110inT66q47d8BgJ+cDR@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Wed, Oct 20, 2010 at 10:35 AM, Heikki Linnakangas
<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
> On 20.10.2010 17:32, Tatsuo Ishii wrote:
>>>>
>>>> pg_is_in_recovery() returns a bool, are you proposing to change that?
>>>
>>> No. I just thought about adding more condition when it returns true.
>>
>> Here is the patch. Comments are welcome!
>> ...
>>   Datum
>>   pg_is_in_recovery(PG_FUNCTION_ARGS)
>>   {
>> !       /* use volatile pointer to prevent code rearrangement */
>> !       volatile WalRcvData *walrcv = WalRcv;
>> !
>> !       PG_RETURN_BOOL(RecoveryInProgress()&&  walrcv->walRcvState ==
>> WALRCV_RUNNING);
>>   }
>>
>
> This returns 'false' if you're in hot standby mode running against an
> archive. That seems wrong, I don't think the walreceiver state should play
> any role in this.

I think what we need is a second function, not a change to the
definition of this one.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2010-10-20 14:53:58
Subject: Re: max_wal_senders must die
Previous:From: Robert HaasDate: 2010-10-20 14:49:37
Subject: Re: leaky views, yet again

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group