Re: [HACKERS] Causal reads take II - Mailing list pgsql-hackers

From Ants Aasma
Subject Re: [HACKERS] Causal reads take II
Date
Msg-id CA+CSw_tz0q+FQsqh7Zx7xxF99Jm98VaAWGdEP592e7a+zkD_Mw@mail.gmail.com
Whole thread Raw
In response to [HACKERS] Causal reads take II  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: [HACKERS] Causal reads take II  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-hackers
On Tue, Jan 3, 2017 at 3:43 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> Here is a new version of my "causal reads" patch (see the earlier
> thread from the 9.6 development cycle[1]), which provides a way to
> avoid stale reads when load balancing with streaming replication.

Thanks for working on this. It will let us do something a lot of
people have been asking for.

> Long term, I think it would be pretty cool if we could develop a set
> of features that give you distributed sequential consistency on top of
> streaming replication.  Something like (this | causality-tokens) +
> SERIALIZABLE-DEFERRABLE-on-standbys[3] +
> distributed-dirty-read-prevention[4].

Is it necessary that causal writes wait for replication before making
the transaction visible on the master? I'm asking because the per tx
variable wait time between logging commit record and making
transaction visible makes it really hard to provide matching
visibility order on master and standby. In CSN based snapshot
discussions we came to the conclusion that to make standby visibility
order match master while still allowing for async transactions to
become visible before they are durable we need to make the commit
sequence a vector clock and transmit extra visibility ordering
information to standby's. Having one more level of delay between wal
logging of commit and making it visible would make the problem even
worse.

One other thing that might be an issue for some users is that this
patch only ensures that clients observe forwards progress of database
state after a writing transaction. With two consecutive read only
transactions that go to different servers a client could still observe
database state going backwards. It seems that fixing that would
require either keeping some per client state or a global agreement on
what snapshots are safe to provide, both of which you tried to avoid
for this feature.

Regards,
Ants Aasma



pgsql-hackers by date:

Previous
From: vinayak
Date:
Subject: Re: [HACKERS] Transactions involving multiple postgres foreignservers
Next
From: Tomas Vondra
Date:
Subject: Re: [HACKERS] PoC: Grouped base relation