Re: Support for N synchronous standby servers - take 2

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, Beena Emerson <memissemerson(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Support for N synchronous standby servers - take 2
Date: 2016-04-06 08:10:12
Message-ID: CAHGQGwH9SJHxCfZYbRDtOHeMNDpm2+gbJYKrJCgBtAhUj4Wb5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 6, 2016 at 5:01 PM, Kyotaro HORIGUCHI
<horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> At Wed, 6 Apr 2016 15:29:12 +0900, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote in <CAHGQGwHGQEwH2c9buiZ=G7Ko8PQYwiU7=NsDkvCjRKUPSN8j7A(at)mail(dot)gmail(dot)com>
>> > @@ -640,6 +639,13 @@ SyncRepGetSyncStandbys(bool *am_sync)
>> > }
>> >
>> > /*
>> > + * The pending list contains eventually potentially-synchronized standbys
>> > + * and this walsender may be one of them. So once reset am_sync.
>> > + */
>> > + if (am_sync != NULL)
>> > + *am_sync = false;
>> > +
>> > + /*
>>
>> This code seems wrong in the case where this walsender is in the result list.
>> So I adopted another logic. Attached is the updated version of the patch.
>
> You must misread the patch. am_sync is originally set in the loop
> just after that for the case.
>
> ! while (priority <= lowest_priority)
> ! {
> ..
> ! for (cell = list_head(pending); cell != NULL; cell = next)
> ! {
> ...
> ! if (this_priority == priority)
> ! {
> ! result = lappend_int(result, i);
> ! if (am_sync != NULL && walsnd == MyWalSnd)
> ! *am_sync = true;

But if this walsender has the priority 1, *am_sync is set to true in
the first loop not the second one. No?

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2016-04-06 08:16:12 Re: Support for N synchronous standby servers - take 2
Previous Message Fujii Masao 2016-04-06 08:07:47 Re: Support for N synchronous standby servers - take 2