Re: Quorum commit for multiple synchronous replication.

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Quorum commit for multiple synchronous replication.
Дата
Msg-id CAB7nPqSvMP=vmj=SWVbbwz2RZv3877CzAQRQXMLLqLbY4g-EFQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Quorum commit for multiple synchronous replication.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Ответы Re: Quorum commit for multiple synchronous replication.  (Masahiko Sawada <sawada.mshk@gmail.com>)
Список pgsql-hackers
On Wed, Dec 7, 2016 at 2:49 PM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.jp> wrote:
> Aside from measurement of the two sorting methods, I'd like to
> point out that quorum commit basically doesn't need
> sorting. Counting conforming santdbys while scanning the
> walsender(receiver) LSN list comparing with the target LSN is
> O(n). Small refactoring of SyncRerpGetOldestSyncRecPtr would
> enough to do that.

Indeed, I haven't thought about that, and that's a no-brainer. That
would remove the need to allocate and sort each array, what is simply
needed is to track the number of times a newest value has been found.
So what this processing would do is updating the write/flush/apply
values for the first k loops if the new value is *older* than the
current one, where k is the quorum number, and between k+1 and N the
value gets updated only if the value compared is newer. No need to
take the mutex lock for a long time as well. By the way, the patch now
conflicts on HEAD, it needs a refresh.
-- 
Michael



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Vladimir Borodin
Дата:
Сообщение: Re: tzdata 2016j
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: patch: function xmltable