Re: Sync Rep v19

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Sync Rep v19
Date: 2011-03-04 14:15:50
Message-ID: AANLkTinW_vj24e=e7-aPXT+qwUmtruVN1sZHj-WMVgtP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 4, 2011 at 7:51 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>> +             if (walsnd->pid != 0 &&
>> +                     walsnd->sync_standby_priority > 0 &&
>> +                     (priority == 0 ||
>> +                      priority < walsnd->sync_standby_priority))
>> +             {
>> +                      priority = walsnd->sync_standby_priority;
>> +                      syncWalSnd = walsnd;
>> +             }
>>
>> According to the code, the last named standby has highest priority. But the
>> document says the opposite.
>
> Priority is a difficult word here since "1" is the highest priority. I
> deliberately avoided using the word "highest" in the code for that
> reason.
>
> The code above finds the lowest non-zero standby, which is correct as
> documented.

Hmm.. that seems to find the highest standby. And, I could confirm
that in my box. Please see the following. The priority (= 2) of
synchronous standby (its sync_state is SYNC) is higher than that (= 1)
of potential one (its sync_state is POTENTIAL).

postgres=# SHOW synchronous_standby_names ;
synchronous_standby_names
---------------------------
one, two
(1 row)

postgres=# SELECT application_name, state, sync_priority, sync_state
FROM pg_stat_replication;
application_name | state | sync_priority | sync_state
------------------+-----------+---------------+------------
one | STREAMING | 1 | POTENTIAL
two | STREAMING | 2 | SYNC
(2 rows)

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yeb Havinga 2011-03-04 14:23:51 Re: pg_basebackup and wal streaming
Previous Message Yeb Havinga 2011-03-04 13:57:46 Re: Sync Rep v19