pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Recovery bug
Date: Thu, 11 Nov 2010 18:20:20 +0200
Message-ID: <4CDC17C4.4060502@enterprisedb.com> (raw)
In-Reply-To: <1289434809.22581.99.camel@jdavis-ux.asterdata.local>
References: <1287183483.30681.54.camel@jdavis-ux.asterdata.local>
	<1287355728.8516.383.camel@jdavis>
	<4CBD6458.4050400@enterprisedb.com>
	<1287507095.8516.547.camel@jdavis>
	<1287517214.20345.5.camel@jdavis-ux.asterdata.local>
	<4CC56DA5.3040908@enterprisedb.com>
	<1288022672.8516.801.camel@jdavis>
	<4CC687CB.6080306@enterprisedb.com>
	<1289434809.22581.99.camel@jdavis-ux.asterdata.local>

On 11.11.2010 02:20, Jeff Davis wrote:
> There is a problem with this patch. ReadRecord() not only modifies
> global variables, it also modifies the location pointed to by "record",
> which is later used to set "wasShutdown". How about if we only set
> "wasShutdown" if there is no backup_label (because the checkpoint for
> pg_start_backup() will never be a shutdown checkpoint anyway)?

Oh, good catch.

> Trivial patch attached.

Hmm, you're assuming that the checkpoint specified in the backup label 
is never a shutdown checkpoint. I guess that's true, but I'd rather do 
this (patch attached).

(StartupXLOG is quite a mess...)

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

Attachments:

recovery-bug-3.patch (text/x-diff, 937B) download diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 786d0c6..c018d3b 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5846,6 +5846,7 @@ StartupXLOG(void) if (record != NULL) { memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint)); + wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN); ereport(DEBUG1, (errmsg("checkpoint record is at %X/%X", checkPointLoc.xlogid, checkPointLoc.xrecoff))); @@ -5914,10 +5915,10 @@ StartupXLOG(void) (errmsg("could not locate a valid checkpoint record"))); } memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint)); + wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN); } LastRec = RecPtr = checkPointLoc; - wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN); ereport(DEBUG1, (errmsg("redo record is at %X/%X; shutdown %s",

view thread (20+ messages)  latest in thread

Message-ID: <4CDC17C4.4060502@enterprisedb.com>
Permalink:  ../4CDC17C4.4060502@enterprisedb.com/
Also on:    postgresql.org/message-id/4CDC17C4.4060502@enterprisedb.com

 ·  · 

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-bugs@postgresql.org
  Cc: heikki.linnakangas@enterprisedb.com, pgsql@j-davis.com
  Subject: Re: Recovery bug
  In-Reply-To: <4CDC17C4.4060502@enterprisedb.com>
  References: <1287183483.30681.54.camel@jdavis-ux.asterdata.local> <1287355728.8516.383.camel@jdavis> <4CBD6458.4050400@enterprisedb.com> <1287507095.8516.547.camel@jdavis> <1287517214.20345.5.camel@jdavis-ux.asterdata.local> <4CC56DA5.3040908@enterprisedb.com> <1288022672.8516.801.camel@jdavis> <4CC687CB.6080306@enterprisedb.com> <1289434809.22581.99.camel@jdavis-ux.asterdata.local> <4CDC17C4.4060502@enterprisedb.com>

* 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