Re: Sync Rep: First Thoughts on Code - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Sync Rep: First Thoughts on Code
Date
Msg-id 1229333921.8673.242.camel@ebony.2ndQuadrant
Whole thread Raw
In response to Re: Sync Rep: First Thoughts on Code  (Mark Mielke <mark@mark.mielke.cc>)
Responses Re: Sync Rep: First Thoughts on Code  (Markus Wanner <markus@bluegap.ch>)
List pgsql-hackers
On Sun, 2008-12-14 at 12:57 -0500, Mark Mielke wrote:

> I'm curious about your suggestion to direct queries that need the
> latest 
> snapshot to the 'primary'. I might have misunderstood it - but it
> seems 
> that the expectation from some is that *all* sessions see the latest 
> snapshot, so would this not imply that all sessions would be redirect
> to 
> the 'primary'? I don't think it is reasonable myself, but I might be 
> misunderstanding something...

I said "a snapshot taken on the primary", but the query would run on the
standby.

Synchronising primary and standby so that they are identical from the
perspective of a query requires some synchronisation delay. I'm pointing
out that the synchronisation delay can occur 

* at the time we apply WAL - which will slow down commits (i.e. #6 on my
previous list of options)
* at the time we run a query that needs to see primary and standby
synchronised

So the same effect can be achieved in various ways.

The first way would require *all* transactions to be applied on standby,
i.e. option #6 for all transactions. That is a performance disaster and
I would not force that onto everybody.

The second way can be done by taking a snapshot on the primary, with an
associated LSN, then using that snapshot on the standby. That is
somewhat complex, but possible. I see the requirement for getting the
same answer on multiple nodes as a further extension of "transaction
isolation mode" and think that not all people will want this, so we
should allow that as an option.

I'm not going to worry about this at the moment. Hot standby will be
useful without this and so I regard this as a secondary objective. Rome
wasn't built in a single release, or something like that.

-- Simon Riggs           www.2ndQuadrant.comPostgreSQL Training, Services and Support



pgsql-hackers by date:

Previous
From: "汪琦"
Date:
Subject: About debug means ---How to debug a function seperately in an easy way?
Next
From: Simon Riggs
Date:
Subject: Re: Sync Rep: First Thoughts on Code