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+U5nMLFOYJJAMw_Md2SjQEvcAzpALaRodNHLsJM+oSwCfTqEQ@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 18 November 2014 00:02, Michael Paquier <michael.paquier@gmail.com> wrote:

>> I've not read the patches yet. But while I was reading the code around
>> sync node detection, I thought that it might be good idea to treat the
>> node with priority as special. That is, if we find the active node with
>> the priority 1, we can immediately go out of the sync-node-detection-loop.
>>
>> In many cases we can expect that the sync standby has the priority 1.
>> If yes, treating the priority 1 as special is good way to do, I think. Thought?

Agreed

> That would really save some cycles. Now we still need to fetch the
> priority numbers of all nodes for pg_stat_get_wal_senders, so in this
> case scanning all the entries in the WAL sender array is necessary.
> This optimization is orthogonal to the refactoring patch btw, no?

To the refactoring patch, possibly. But not to the changes you're
planning to make.

ISTM that we should remember the priority list of nodes and check them
in that order by direct lookups to array elements. That will work for
1 or more nodes and it also works better with large numbers of
walsenders.

Can we just wait on this patch until we have the whole feature?

We quite often break larger patches down into smaller ones, but if
they arrive in lots of small pieces its more difficult to understand
and correct issues that are happening on the larger scale. Churning
the same piece of code multiple times is rather mind numbing.

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



pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: postgres_fdw behaves oddly
Next
From: Ashutosh Bapat
Date:
Subject: Re: postgres_fdw behaves oddly