Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 4855A1337B4A for ; Thu, 11 Nov 2010 12:20:38 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 88534-08 for ; Thu, 11 Nov 2010 16:20:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og121.obsmtp.com (exprod7og121.obsmtp.com [64.18.2.20]) by mail.postgresql.org (Postfix) with SMTP id 31A761337B34 for ; Thu, 11 Nov 2010 12:20:30 -0400 (AST) Received: from source ([209.85.215.177]) by exprod7ob121.postini.com ([64.18.6.12]) with SMTP ID DSNKTNwXycJKKJggZGKqZhslXYaRUkwWiawo@postini.com; Thu, 11 Nov 2010 08:20:30 PST Received: by mail-ey0-f177.google.com with SMTP id 9so1173955eyd.36 for ; Thu, 11 Nov 2010 08:20:25 -0800 (PST) Received: by 10.213.108.196 with SMTP id g4mr1079477ebp.31.1289492424935; Thu, 11 Nov 2010 08:20:24 -0800 (PST) Received: from [192.168.1.183] (dsl-hkibrasgw2-ff7ac300-240.dhcp.inet.fi [88.195.122.240]) by mx.google.com with ESMTPS id q58sm2088538eeh.9.2010.11.11.08.20.20 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 11 Nov 2010 08:20:20 -0800 (PST) Message-ID: <4CDC17C4.4060502@enterprisedb.com> Date: Thu, 11 Nov 2010 18:20:20 +0200 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.1.12) Gecko/20100913 Icedove/3.0.7 MIME-Version: 1.0 To: Jeff Davis CC: pgsql-bugs@postgresql.org Subject: Re: Recovery bug 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> In-Reply-To: <1289434809.22581.99.camel@jdavis-ux.asterdata.local> Content-Type: multipart/mixed; boundary="------------040102040901050603000507" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.2 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201011/74 X-Sequence-Number: 28654 This is a multi-part message in MIME format. --------------040102040901050603000507 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------040102040901050603000507 Content-Type: text/x-diff; name="recovery-bug-3.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="recovery-bug-3.patch" 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", --------------040102040901050603000507--