pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Simon Riggs <simon@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Mark Kirkwood <markir@coretech.co.nz>
Cc: pgsql-hackers@postgresql.org
Subject: Re: PITR COPY Failure (was Point in Time Recovery)
Date: Tue, 20 Jul 2004 10:04:29 +0100
Message-ID: <1090314268.28049.2308.camel@stromboli> (raw)
In-Reply-To: <3607.1090296869@sss.pgh.pa.us>
References: <200407141555.i6EFtnk22984@mail.osdl.org>
	<1089833620.17493.4624.camel@stromboli>
	<40F5E14A.4090003@coretech.co.nz>
	<1089875702.17493.5539.camel@stromboli>
	<40F652C6.4070007@coretech.co.nz>
	<1089935215.17493.6906.camel@stromboli>
	<40FA0F93.8010607@coretech.co.nz>
	<40FC6BF2.5050701@coretech.co.nz>
	<3607.1090296869@sss.pgh.pa.us>

On Tue, 2004-07-20 at 05:14, Tom Lane wrote:
> Mark Kirkwood <markir@coretech.co.nz> writes:
> > I have been doing some re-testing with CVS HEAD from about 1 hour ago 
> > using the simplified example posted previously.
> 
> > It is quite interesting:

> The problem seems to be that the computation of checkPoint.redo at
> xlog.c lines 4162-4169 (all line numbers are per CVS tip) is not
> allowing for the possibility that XLogInsert will decide it doesn't
> want to split the checkpoint record across XLOG files, and will then
> insert a WASTED_SPACE record to avoid that (see comment and following
> code at lines 758-795).  This wouldn't really matter except that there
> is a safety crosscheck at line 4268 that tries to detect unexpected
> insertions of other records during a shutdown checkpoint.
> 
> I think the code in CreateCheckPoint was correct when it was written,
> because we only recently changed XLogInsert to not split records
> across files.  But it's got a boundary-case bug now, which your test
> scenario is able to exercise by making the recovery run try to write
> a shutdown checkpoint exactly at the end of a WAL file segment.
> 

Thanks for locating that, I was suspicious of that piece of code, but it
would have taken me longer than this to locate it exactly.

It was clear (to me) that it had to be of this nature, since I've done a
fair amount of recovery testing and not hit anything like that.

> The quick and dirty solution would be to dike out the safety check at
> 4268ff.  I don't much care for that, but am too tired right now to work
> out a better answer.  I'm not real sure whether it's better to adjust
> the computation of checkPoint.redo or to smarten the safety check
> ... but one or the other needs to allow for file-end padding, or maybe
> we could hack some update of the state in WasteXLInsertBuffer().  (But
> at some point you have to say "this is more trouble than it's worth",
> so maybe we'll end up taking out the safety check.)
> 

I'll take a look

> In any case this isn't a fundamental bug, just an insufficiently
> smart safety check.  But thanks for finding it!  As is, the code has
> a nonzero probability of failure in the field :-( and I don't know
> how we'd have tracked it down without a reproducible test case.

All code has a non-zero probability of failure in the field, its just
they don't tell you that usually. The main thing here is that we write
everything we need to write to the logs in the first place. 

If that is true, then the code can always be adjusted or the logs dumped
and re-spliced to recover data.

Definitely: Thanks Mark! Reproducibility is key.

Best regards, Simon Riggs





view thread (19+ messages)  latest in thread

Message-ID: <1090314268.28049.2308.camel@stromboli>
Permalink:  ../1090314268.28049.2308.camel@stromboli/
Also on:    postgresql.org/message-id/1090314268.28049.2308.camel@stromboli

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: simon@2ndquadrant.com, tgl@sss.pgh.pa.us, markir@coretech.co.nz, pgsql-hackers@postgresql.org
  Subject: Re: PITR COPY Failure (was Point in Time Recovery)
  In-Reply-To: <1090314268.28049.2308.camel@stromboli>
  References: <200407141555.i6EFtnk22984@mail.osdl.org> <1089833620.17493.4624.camel@stromboli> <40F5E14A.4090003@coretech.co.nz> <1089875702.17493.5539.camel@stromboli> <40F652C6.4070007@coretech.co.nz> <1089935215.17493.6906.camel@stromboli> <40FA0F93.8010607@coretech.co.nz> <40FC6BF2.5050701@coretech.co.nz> <3607.1090296869@sss.pgh.pa.us> <1090314268.28049.2308.camel@stromboli>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox