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

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: david(at)fetter(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: How to reliably detect if it's a promoting standby
Date: 2010-10-15 00:35:24
Message-ID: 20101015.093524.666444917032355951.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> What new public interfaces do you think are needed for 9.1 in this
> regard?

At this point I'm thinking of modifying existing pg_is_in_recovery(),
thus 0 new public interface. The heart of the function is
RecoveryInProgress(). It simply returns LocalRecoveryInProgress. In
addition to that, checking WalRcvData->walRcvsState being set to other
than WALRCV_RUNNING seems to solve the problem, though I have not
tested yet. Let me see if it's working...
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

> Cheers,
> David.
> On Thu, Oct 14, 2010 at 11:10:14AM +0900, Tatsuo Ishii wrote:
>> Ok, it seems impossible to do that by using any public interfaces
>> currently available in PostgreSQL 9.0. I will create a custom C
>> function to be distributed along with pgpool-II.
>> --
>> Tatsuo Ishii
>> SRA OSS, Inc. Japan
>> English: http://www.sraoss.co.jp/index_en.php
>> Japanese: http://www.sraoss.co.jp
>>
>> > Hi,
>> >
>> > I'm looking for a way to reliably detect if it's a promoting
>> > standby. This is neccessary for pgpool-II manage streaming replication
>> > clusters. When primary goes down, standby *could* start promoting to
>> > primary. The only way to find it is calling
>> > pg_is_in_recovery(). Problem is, it returns true even if standby is
>> > promoting. If pgpool-II waits for cetain period, it may finishes
>> > promotion, thus it returns false. But how long should we wait?
>> >
>> > Any idea?
>> > --
>> > Tatsuo Ishii
>> > SRA OSS, Inc. Japan
>> > English: http://www.sraoss.co.jp/index_en.php
>> > Japanese: http://www.sraoss.co.jp
>> >
>> > --
>> > Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
>> > To make changes to your subscription:
>> > http://www.postgresql.org/mailpref/pgsql-hackers
>>
>> --
>> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers
>
> --
> David Fetter <david(at)fetter(dot)org> http://fetter.org/
> Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
> Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
> iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
>
> Remember to vote!
> Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-10-15 00:36:48 Re: shmget error text reports funny max_connections numbers
Previous Message Bruce Momjian 2010-10-14 22:27:57 Re: is sync rep stalled?