Re: Sync Rep v19

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Yeb Havinga <yebhavinga(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Sync Rep v19
Date: 2011-03-03 21:49:07
Message-ID: 1299188947.10703.1162.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2011-03-03 at 22:27 +0100, Yeb Havinga wrote:
> On 2011-03-03 11:53, Simon Riggs wrote:
> > Latest version of Sync Rep, which includes substantial internal changes
> > and simplifications from previous version. (25-30 changes).
> >
> > Includes all outstanding technical comments, typos and docs. I will
> > continue to work on self review and test myself, though actively
> > encourage others to test and report issues.
> >
> > Interesting changes
> >
> > * docs updated
> >
> > * names listed in synchronous_standby_names are now in priority order
> >
> > * synchronous_standby_names = "*" matches all standby names
> >
> > * pg_stat_replication now shows standby priority - this is an ordinal
> > number so "1" means 1st, "2" means 2nd etc, though 0 means "not a sync
> > standby".
> Some initial remarks:
>
> 1) this works nice:
> application_name not in synchronous_standby_names -> sync_priority = 0 (OK)
> change synchronous_standby_names to default *, reload conf ->
> sync_priority = 1 (OK)
>
> message in log file
> LOG: 00000: standby "walreceiver" is now the synchronous standby with
> priority 1
>
> 2) priorities
> I have to get used to mapping the integers to synchronous replication
> meaning.
> 0 -> asynchronous
> 1 -> the synchronous standby that is waited for
> 2 and higher -> potential syncs
>
> Could it be hidden from the user? I liked asynchronous / synchronous /
> potential synchronous

Yes, that sounds good. I will leave it as it is now to gain other
comments since this need not delay commit.

> then the log message could be
> LOG: 00000: standby "walreceiver" is now the synchronous standby

The priority is mentioned in the LOG message, so you can understand what
happens when multiple standbys connect.

e.g.

if you have synchronous_standby_names = 'a, b, c'

and then the standbys connect in the order b, c, a then you will see log
messages

LOG: standby "b" is now the synchronous standby with priority 2
LOG: standby "a" is now the synchronous standby with priority 1

It's designed so no matter which order standbys arrive in it is the
highest priority standby that makes it to the front in the end.

> 3) walreceiver is the default application name - could there be problems
> when a second standby with that name connects (ofcourse the same
> question holds for two the same nondefault application_names)?

That's documented: in that case which standby is sync is indeterminate.

--
Simon Riggs http://www.2ndQuadrant.com/books/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2011-03-03 21:49:56 Re: Quick Extensions Question
Previous Message Tom Lane 2011-03-03 21:31:08 Re: Quick Extensions Question