Re: Proposal: "Causal reads" mode for load balancing reads without stale data

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Thom Brown <thom(at)linux(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: "Causal reads" mode for load balancing reads without stale data
Date: 2016-03-25 13:48:49
Message-ID: CAB7nPqTzSh8O2gELZYiYmFuhhetH3-6=_Qn2UDUDrxsXNSkNEA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 25, 2016 at 4:51 PM, Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> On Thu, Mar 24, 2016 at 12:34 AM, Thomas Munro
> <thomas(dot)munro(at)enterprisedb(dot)com> wrote:
>> On Wed, Mar 23, 2016 at 12:37 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>> +static void WalRcvUnblockSigUsr2(void)
>>>
>>> And again here.
>>
>> Fixed.
>>
>>> + WalRcvUnblockSigUsr2();
>>> len = walrcv_receive(NAPTIME_PER_CYCLE, &buf);
>>> + WalRcvBlockSigUsr2();
>>>
>>> This does not seem like it will be cheap on all operating systems. I
>>> think you should try to rejigger this somehow so that it can just set
>>> the process latch and the wal receiver figures it out from looking at
>>> shared memory. Like maybe a flag in WalRcvData? An advantage of this
>>> is that it should cut down on the number of signals significantly,
>>> because it won't need to send SIGUSR1 when the latch is already set.
>>
>> Still experimenting with a latch here. I will come back on this point soon.
>
> Here is a latch-based version.

Thanks for the updated version. This looks pretty nice.

I find the routine name libpqrcv_wait to be a bit confusing. This is
not a routine aimed at being exposed externally as walrcv_send or
walrcv_receive. I would recommend changing the name, to something like
waitForWALStream or similar.

Should we worried about potential backward-incompatibilities with the
new return values of walrcv_receive?

Do you have numbers to share regarding how is performing the
latch-based approach and the approach that used SIGUSR2 when
remote_apply is used?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-03-25 14:11:38 Re: [COMMITTERS] pgsql: Move each SLRU's lwlocks to a separate tranche.
Previous Message Tom Lane 2016-03-25 13:48:43 Re: [COMMITTERS] pgsql: Move each SLRU's lwlocks to a separate tranche.