Re: How should the waiting backends behave in sync rep?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How should the waiting backends behave in sync rep?
Date: 2011-03-11 18:12:09
Message-ID: AANLkTimxRFCDjGoO5=aT2gNQBZ7hNd=NBrZXQGno433K@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 9, 2011 at 9:58 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Thu, Mar 10, 2011 at 2:06 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Tue, Mar 8, 2011 at 10:06 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>> How should the backends waiting for replication behave when
>>> synchrnous_standby_names
>>> is set to '' and the configuration file is reloaded? Now they keep
>>> waiting for the ACK from the
>>> standby. But I think that it's more natural for them to get out of the
>>> wait state and complete
>>> the transaction in that case. If we'll change them in that way, we
>>> would no longer need
>>> something like "pg_ctl standalone" which I mentioned in another thread. Thought?
>>
>> I think so.  Looking at assign_synchronous_standby_names, the
>> following code just looks wrong:
>>
>>        if (doit && list_length(elemlist) > 0)
>>                sync_standbys_defined = true;
>>
>> Once sync_standbys_defined becomes true, there's no way for it to ever
>> become false again.  That can't be right.  That means that if you
>> disable sync rep by zeroing out synchronous_standby_names, backends
>> that already existed at the time you made the change will continue to
>> act as though sync rep is enabled until they exit.
>
> Yes, that's a bug. Yeah, sync rep currently seems to have many TODO items.
> I added some of them in wiki.
> http://wiki.postgresql.org/wiki/PostgreSQL_9.1_Open_Items

There's a comment that looks related to this issue in syncrep.c. It reads:

/*
* We don't receive SIGHUPs at this point, so resetting
* synchronous_standby_names has no effect on waiters.
*/

It's unclear to me what this actually means. Is there some reason we
CAN'T receive SIGHUPs at that point, or have we just chosen not to
(for unexplained reasons)?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2011-03-11 18:12:10 Re: Macros for time magic values
Previous Message Bruce Momjian 2011-03-11 18:09:48 Re: Macros for time magic values