pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Simon Riggs <simon@2ndQuadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Hot Standby on git
Date: Fri, 02 Oct 2009 10:43:50 +0300
Message-ID: <4AC5AF36.3020900@enterprisedb.com> (raw)
In-Reply-To: <1254468966.17864.301.camel@ebony.2ndQuadrant>
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>

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



view thread (48+ messages)  latest in thread

Message-ID: <4AC5AF36.3020900@enterprisedb.com>
Permalink:  ../4AC5AF36.3020900@enterprisedb.com/
Also on:    postgresql.org/message-id/4AC5AF36.3020900@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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: heikki.linnakangas@enterprisedb.com, simon@2ndQuadrant.com
  Subject: Re: Hot Standby on git
  In-Reply-To: <4AC5AF36.3020900@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