Re: Inconsistent DB data in Streaming Replication

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: Sameer Thakur <samthakur74(at)gmail(dot)com>
Cc: Ants Aasma <ants(at)cybertec(dot)at>, Amit Kapila <amit(dot)kapila(at)huawei(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, sthomas(at)optionshouse(dot)com, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Samrat Revagade <revagade(dot)samrat(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)2ndquadrant(dot)com>
Subject: Re: Inconsistent DB data in Streaming Replication
Date: 2013-04-11 13:25:35
Message-ID: 5166B9CF.8040308@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/11/2013 01:26 PM, Sameer Thakur wrote:
> Hello,
> >The only potential use case for this that I can see, would be for
> system maintenance and a controlled failover. I agree: that's a major
> PITA >when doing DR testing, but I personally don't think this is the
> way to fix that particular edge case.
>
> This is the use case we are trying to address (I work with Samrat).
You just shut down the old master and let the standby catch
up (takas a few microseconds ;) ) before you promote it.

After this you can start up the former master with recovery.conf
and it will follow nicely.
> We were wondering why this may not be a good fix?
The proposed fix - halting all writes of data pages to disk and
to WAL files while waiting ACK from standby - will tremendously
slow down all parallel work on master.

And it does just turn around "master is ahead of slave" problem
into "slave is ahead of master" problem :)

Regards
Hannu
>
> regards
> Sameer
>
>
> On Thu, Apr 11, 2013 at 3:52 PM, Ants Aasma <ants(at)cybertec(dot)at
> <mailto:ants(at)cybertec(dot)at>> wrote:
>
> On Thu, Apr 11, 2013 at 10:09 AM, Amit Kapila
> <amit(dot)kapila(at)huawei(dot)com <mailto:amit(dot)kapila(at)huawei(dot)com>> wrote:
> > Consider the case old-master crashed during flushing the data
> page, now you
> > would need full page image from new-master.
> > It might so happen that in new-master Checkpoint would have
> purged (reused)
> > the log file's from that time line, in that case
> > it will be difficult to get the full page image, user can refer
> WAL archive
> > for that, but I think it will not be straight forward.
>
> Using a WAL archive is standard procedure when you do not wish to take
> new base backups all the time. This already works now, when archive
> recovery is set up the WAL will be automatically fetched from the
> archive.
>
> > One more point, what will be the new behavior when there are 2
> transactions
> > one has synchronous_commit =off and other with on?
>
> Exactly the same as now - waiting for commit record replication when
> reporting commit success to the client and waiting for WAL replication
> before writing a data page are orthogonal features.
>
> Regards,
> Ants Aasma
> --
> Cybertec Schönig & Schönig GmbH
> Gröhrmühlgasse 26
> A-2700 Wiener Neustadt
> Web: http://www.postgresql-support.de
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org
> <mailto:pgsql-hackers(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-04-11 13:51:14 Re: [GSOC] questions about idea "rewrite pg_dump as library"
Previous Message Sameer Thakur 2013-04-11 11:26:04 Re: Inconsistent DB data in Streaming Replication