Re: Review of Refactoring code for sync node detection - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Review of Refactoring code for sync node detection
Date
Msg-id CA+U5nMKTVf8bLb2681=MRe7A_rzOMXtah0+FhC4uq9U3VOq8+Q@mail.gmail.com
Whole thread Raw
In response to Re: Review of Refactoring code for sync node detection  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: Review of Refactoring code for sync node detection  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On 31 October 2014 00:27, Michael Paquier <michael.paquier@gmail.com> wrote:
> On Fri, Oct 31, 2014 at 6:59 AM, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:
>>
>> If we stick with this version I'd argue it makes more sense to just stick
>> the sync_node = and priority = statements into the if block and ditch the
>> continue. </nitpick>
>
> Let's go with the cleaner version then, I'd prefer code that can be read
> easily for this code path. Switching back is not much complicated either.

I like where you are headed with this feature set. I will do my best
to comment and review so we get something in 9.5.

Some review comments

* The new function calls them a Node rather than a Standby. That is a
good change, but it needs to be applied consistently, so we no longer
use the word Standby anywhere near the sync rep code. I'd prefer if we
continue to use the abbreviation sync for synchronous, since its less
typing and avoids spelling mistakes in code and comments.

* Rationale...
Robert Haas wrote
> Interestingly, the syncrep code has in some of its code paths the idea
> that a synchronous node is unique, while other code paths assume that
> there can be multiple synchronous nodes. If that's fine I think that
> it would be better to just make the code multiple-sync node aware, by
> having a single function call in walsender.c and syncrep.c that
> returns an integer array of WAL sender positions (WalSndCtl). as that
> seems more extensible long-term.

I thought this was the rationale for the patch, but it doesn't do
this. If you disagree with Robert, it would be best to say so now,
since I would guess he's expecting the patch to be doing as he asked.
Or perhaps I misunderstand.

* Multiple sync standbys were originally avoided because of the code
cost and complexity at ReleaseWaiters(). I'm very keen to keep the
code at that point very robust, so simplicity is essential. It would
also be useful to have some kind of micro-benchmark that allows us to
understand the overhead of various configs. Jim mentions he isn't sure
of the performance there. I don't see too much a problem with this
patch, but the later patches will require this, so we may as well do
this soon.

* We probably don't need a comment like /* Cleanup */ inserted above a
pfree. ;-)

I see this should get committed in next few days, even outside the CF.

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



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: New Event Trigger: table_rewrite
Next
From: Michael Paquier
Date:
Subject: Re: Review of Refactoring code for sync node detection