Skip site navigation (1) Skip section navigation (2)

Re: pg_subtrans keeps bloating up in the standby

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, "Kolb, Harald (NSN - DE/Munich)" <harald(dot)kolb(at)nsn(dot)com>
Subject: Re: pg_subtrans keeps bloating up in the standby
Date: 2010-08-30 07:39:55
Message-ID: 1283153995.1800.1540.camel@ebony (view raw or flat)
Thread:
Lists: pgsql-hackers
On Mon, 2010-08-30 at 09:59 +0300, Heikki Linnakangas wrote:
> On 27/08/10 20:17, Fujii Masao wrote:
> > Yes. StartupXLOG calls that before bgwriter is invoked. That is, we can
> > ensure that StartupSUBTRANS has always been done before bgwriter
> > performs a restartpoint.
> 
> Hmm, the comment in CreateCheckpoint() isn't totally accurate either:
> 
> >  * Truncate pg_subtrans if possible.  We can throw away all data before
> >  * the oldest XMIN of any running transaction.	No future transaction will
> >  * attempt to reference any pg_subtrans entry older than that (see Asserts
> >  * in subtrans.c).	During recovery, though, we mustn't do this because
> >  * StartupSUBTRANS hasn't been called yet.

Yep.

> because in Hot Standby mode, StartSUBTRANS has been called already. We 
> could truncate pg_subtrans there too when hot standby is enabled. But 
> this is only about the startup checkpoint at the end of recovery, so I'm 
> inclined to not change that, not right now just before release anyway, 
> just in case we're missing something...
> 
> However, is it safe to use GetOldestXMin() during recovery? Or to put it 
> other way, is GetOldestXMin() functioning correctly during hot standby? 
> It only scans through the ProcArray, but not the known-assigned xids 
> array. That seems like an oversight that needs to be fixed.

Yes, thats correct. Otherwise the patch is fine.

I'm working on this now and will commit something shortly.

-- 
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Development, 24x7 Support, Training and Services


In response to

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2010-08-30 08:19:05
Subject: Re: upcoming wraps
Previous:From: Heikki LinnakangasDate: 2010-08-30 06:59:36
Subject: Re: pg_subtrans keeps bloating up in the standby

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group