Re: Sync Rep: First Thoughts on Code

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>, Greg Stark <greg(dot)stark(at)enterprisedb(dot)com>, Markus Wanner <markus(at)bluegap(dot)ch>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, "aidan(at)highrise(dot)ca" <aidan(at)highrise(dot)ca>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Sync Rep: First Thoughts on Code
Date: 2008-12-15 13:35:53
Message-ID: 49465D39.8090406@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas wrote:
>> In fact, waiting for reply from standby server before acknowledging a commit
>> to the client is a bit pointless otherwise. It puts you in a strange
>> situation, where you're waiting for the commits in normal operation, but if
>> there's a network glitch or the standby goes down, you're willing to go
>> ahead without it. You get a high guarantee that your data is up-to-date in
>> the standby, except when it isn't. Which isn't much of a guarantee.
>
> It protects you against a catastrophic loss of the primary, which is a
> non-trivial consideration. At the risk of being ghoulish, imagine
> that you are a large financial company headquartered in the world
> trade center.

So you'd want all commits to wait until the transaction is safely
replicated in the standby. But if there's a network glitch, or the
standby is restarted, you're happy to reply to the client that it's
committed if it's only safely committed in the primary. Essentially, you
wait for the reply as long the standby responds within X seconds, but if
it takes more then Y seconds, you don't wait. I know that people do
that, but it seems counterintuitive to me. In that case, when the
primary acks the transaction as committed, you only know that it's
safely committed in the primary; it doesn't give any hard guarantee
about the state in the standby.

But when you consider the possibility to use the standby for queries,
the synchronous mode makes sense too.

I'm not opposed to providing all the options, but the synchronous mode
where we can guarantee that if you query the standby, you will see the
effects of all transactions committed in the primary, makes the
synchronous mode much more interesting. If you don't need that property,
you're most likely more happy with asynchronous mode anyway.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-15 13:36:54 Re: Restore enforce_generic_type_consistency's breaks a farms
Previous Message Robert Lor 2008-12-15 13:35:49 DTrace probes patch