Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9420D633547 for ; Fri, 2 Oct 2009 04:44:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 56370-04 for ; Fri, 2 Oct 2009 07:43:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og103.obsmtp.com (exprod7og103.obsmtp.com [64.18.2.159]) by mail.postgresql.org (Postfix) with SMTP id 3D335633251 for ; Fri, 2 Oct 2009 04:44:01 -0300 (ADT) Received: from source ([209.85.219.219]) by exprod7ob103.postini.com ([64.18.6.12]) with SMTP ID DSNKSsWvP9T9cxhiyc2NDqZRkYoeK0A7ga5p@postini.com; Fri, 02 Oct 2009 00:44:01 PDT Received: by ewy19 with SMTP id 19so783656ewy.4 for ; Fri, 02 Oct 2009 00:43:59 -0700 (PDT) Received: by 10.211.131.36 with SMTP id i36mr9077592ebn.33.1254469439174; Fri, 02 Oct 2009 00:43:59 -0700 (PDT) Received: from ?192.168.1.117? ([88.195.103.165]) by mx.google.com with ESMTPS id 10sm1523700eyz.34.2009.10.02.00.43.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 02 Oct 2009 00:43:58 -0700 (PDT) Message-ID: <4AC5AF36.3020900@enterprisedb.com> Date: Fri, 02 Oct 2009 10:43:50 +0300 From: Heikki Linnakangas Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 To: Simon Riggs CC: pgsql-hackers Subject: Re: Hot Standby on git References: <1253958559.4449.833.camel@ebony.2ndQuadrant> <4AC2FBB9.7060304@enterprisedb.com> <1254408330.17864.233.camel@ebony.2ndQuadrant> <4AC4CF18.50309@enterprisedb.com> <1254413624.17864.243.camel@ebony.2ndQuadrant> <4AC5A60F.5050503@enterprisedb.com> <1254468966.17864.301.camel@ebony.2ndQuadrant> In-Reply-To: <1254468966.17864.301.camel@ebony.2ndQuadrant> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.445 tagged_above=-10 required=5 tests=AWL=0.154, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200910/140 X-Sequence-Number: 146952 Simon Riggs wrote: > On Fri, 2009-10-02 at 10:04 +0300, Heikki Linnakangas wrote: >> Simon Riggs wrote: >>> @@ -7061,6 +7061,15 @@ ShutdownXLOG(int code, Datum arg) >>> else >>> { >>> /* >>> + * Take a snapshot of running transactions and write this to WAL. >>> + * This allows us to reconstruct the state of running transactions >>> + * during archive recovery, if required. We do this even if we are >>> + * not archiving, to allow a cold physical backup of the server to >>> + * be useful as a read only standby. >>> + */ >>> + GetRunningTransactionData(); >>> + >>> + /* >>> * If archiving is enabled, rotate the last XLOG file so that all the >>> * remaining records are archived (postmaster wakes up the archiver >>> * process one more time at the end of shutdown). The checkpoint >>> >> I don't think this will do any good where it's placed. The checkpoint >> that follows will have its redo-pointer beyond the running-xacts record, >> so WAL replay will never see it. > > Perhaps we need two entries then to cover multiple use cases? > > The placement of this was specifically chosen so that it is the last > entry before the log switch, so that the runningxact record would be > archived. > > Yes, we also need one after the shutdown checkpoint to cover the case > where the whole data directory is copied after shutdown. The comments > matched the latter case but the position addressed the first case, so it > looks like I was confused as to which case I was addressing. > > Have updated code to do both. See what you think. Thanks. It seems dangerous to write a WAL record after the shutdown checkpoint. It will be overwritten by subsequent startup, which is a recipe for trouble. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com