From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | Thomas Munro <thomas(dot)munro(at)enterprisedb(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-24 14:20:13 |
Message-ID: | CA+TgmoauRRtuniDtDRnt=ZdqT0FTxNqTOCTPUFxd0jWM_Xt4pg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Mar 24, 2016 at 2:11 AM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Wed, Mar 23, 2016 at 11:32 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> Well, I wouldn't go that far. It seems pretty clear that remote_apply
>> by itself is useful - I can't imagine anybody seriously arguing the
>> contrary, whatever they think of this implementation. My view,
>> though, is that by itself that's pretty limiting: you can only have
>> one standby, and if that standby falls over then you lose
>> availability. Causal reads fixes both of those problems - admittedly
>> that requires some knowledge in the application or the pooler, but
>> it's no worse than SSI in that regard. Still, half a loaf is better
>> than none, and I imagine even just getting remote_apply would make a
>> few people quite happy.
>
> OK, let's do so then, even if causal reads don't get into 9.6 users
> could get advantage of remote_apply on multiple nodes if the N-sync
> patch gets in.
>
> 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.
I didn't think pgindent touched the docs. But I agree lines over 80
characters should be wrapped if they're being modified anyway.
> +#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).
+1.
> - 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.
You need to wait for COMMIT PREPARED, but I don't see why you need to
wait for PREPARE itself.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Stas Kelvich | 2016-03-24 14:20:14 | Re: 2PC support for pglogical |
Previous Message | Bernd Helmle | 2016-03-24 14:17:27 | Re: Re: Missing rows with index scan when collation is not "C" (PostgreSQL 9.5) |