From: | Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Michael Paquier <michael(dot)paquier(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 07:51:46 |
Message-ID: | CAEepm=2Zpk5X2PyFe2w2OVw7tPbRrZihHSq_bdF9E45RCw3-2g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
On Thu, Mar 24, 2016 at 7:11 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> Just looking at 0001.
>
> - <literal>remote_write</>, <literal>local</>, and <literal>off</>.
> + <literal>remote_write</>, <literal>remote_apply</>,
> <literal>local</>, and <literal>off</>.
> The default, and safe, setting
> I imagine that a run of pgindent would be welcome for such large lines.
Fixed.
> +#define XactCompletionSyncApplyFeedback(xinfo) \
> + (!!(xinfo & XACT_COMPLETION_SYNC_APPLY_FEEDBACK))
> That's not directly something this patch should take care of, but the
> notation "!!" has better be avoided (see stdbool thread with VS2015).
Changed.
> - SyncRepWaitForLSN(gxact->prepare_end_lsn);
> + SyncRepWaitForLSN(gxact->prepare_end_lsn, false);
> Isn't it important to ensure that a PREPARE LSN is applied as well on
> the standby with remote_apply? Say if an application prepares a
> transaction, it would commit locally but its LSN may not be applied on
> the standby with this patch. That would be a surprising behavior for
> the user.
My reasoning here was that this isn't a commit, so you shouldn't wait
for it to be applied (just like we don't wait for any other
non-committed stuff to be applied), because it has no user-visible
effect other than the ability to COMMIT PREPARED on the standby if it
is promoted after that point. For that reason I do wait for it to be
flushed. After it is flushed, it is guaranteed to be applied some
time before the recovery completes and a user could potentially run
COMMIT PREPARED on the newly promoted master.
--
Thomas Munro
http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-remote-apply-v6.patch | application/octet-stream | 27.6 KB |
0002-replay-lag-v6.patch | application/octet-stream | 24.5 KB |
0003-refactor-syncrep-exit-v6.patch | application/octet-stream | 4.6 KB |
0004-causal-reads-v6.patch | application/octet-stream | 74.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Matthias Kurz | 2016-03-25 08:13:50 | Re: Alter or rename enum value |
Previous Message | Andres Freund | 2016-03-25 07:08:41 | Re: Performance degradation in commit 6150a1b0 |