I came to think that both of you are misunderstanding how
synchronous standbys are choosed so I'd like to clarify the

At Fri, 22 Apr 2016 11:09:28 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI 
<horiguchi.kyot...@lab.ntt.co.jp> wrote in 
> > > 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..


Kyotaro Horiguchi
NTT Open Source Software Center

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to