Re: Fix of doc for synchronous_standby_names. - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: Fix of doc for synchronous_standby_names.
Date
Msg-id 20160422.142103.253999689.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Re: Fix of doc for synchronous_standby_names.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Responses Re: Fix of doc for synchronous_standby_names.  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers
I came to think that both of you are misunderstanding how
synchronous standbys are choosed so I'd like to clarify the
behavior.

At Fri, 22 Apr 2016 11:09:28 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> wrote in
<20160422.110928.18809311.horiguchi.kyotaro@lab.ntt.co.jp>
> > > But this particular sentence seems to be talking
> > > about what's the case for any given slot.
> > 
> > Right, that's my reading also.

In SyncRepInitConfig, every walsender sets sync_standby_priority
by itself. The priority value is the index of its
application_name in s_s_names list (1 based).

When a walsender receives a feedback from walreceiver, it may
release backends waiting for certain LSN to be secured.

First, SyncRepGetSyncStandbys collects active standbys. Then it
loops from the hightest priority value to pick up all of the
active standbys for each priority value until all of the seats
are occupied. Then SyncRepOldestSyncRepPtr calculates the oldest
LSNs only among the standbys SyncRepGetSyncStandbys
returned. Finally, it releases backends using the LSNs.

In short, every 'slot' in s_s_names can corresponds to two or
more *synchronous* standbys.

The resulting behavior is as the following.

> I don't certainly understnd what the 'sync slot' means. If it
> means a name in a replication set description, that is, 'nameN'
> in the following setting of s_s_names.
> 
> '2(name1, name2, name3)'
> 
> There may be two or more duplicates even in the
> single-sync-age. But only one synchronous standby was allowed so
> any 'sync slot' may have at least one matching synchronous
> standby in the single-sync-age. This is what I see in the
> sentense. Is this wrong?
> 
> Now, we can have multiple synchronous standbys so, for example,
> if three standbys with the name 'name1', two of them are choosed
> as synchronous. This is a new behavior in the multi-sync-age and
> syncrep.c has been changed so as to do so.
> 
> For a supplemnet, the following case.
> 
> '5(name1, name2, name3)'
> 
> and the following standbys
> 
> (name1, name1, name2, name2, name3, name3)

This was a bad example,

(name1, name1, name2, name2, name2, name2, name3)

For this case, the followings are choosed as synchornous standby.

(name1, name1, name2, name2, name2)

Three of the four name2s are choosed but which name2s is an
implement matter.

> # However, 5 for three names causes a warning..


reegards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center





pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: kqueue
Next
From: Michael Paquier
Date:
Subject: Re: VS 2015 support in src/tools/msvc