BUG #3674: Unnecessary checkpoints by WAL Writer

Lists: pgsql-bugs
From: "ITAGAKI Takahiro" <itagaki(dot)takahiro(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3674: Unnecessary checkpoints by WAL Writer
Date: 2007-10-12 14:56:16
Message-ID: 200710121456.l9CEuGTv059859@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3674
Logged by: ITAGAKI Takahiro
Email address: itagaki(dot)takahiro(at)gmail(dot)com
PostgreSQL version: 8.3beta1
Operating system: independent
Description: Unnecessary checkpoints by WAL Writer
Details:

WAL Writer requests unnecessary checkpoints with CHECKPOINT_CAUSE_XLOG.
RedoRecPtr, declared in xlog.c, is initialized at StartupXLOG() but never
updated in WAL Writer because it never calls XLogInsert(). It judges excess
of segments wrongly.

Though bgwriter also does not call XLogInsert(), but it would be OK because
bgwriter updates RedoRecPtr in CreateCheckPoint().


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "ITAGAKI Takahiro" <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3674: Unnecessary checkpoints by WAL Writer
Date: 2007-10-12 17:06:42
Message-ID: 29496.1192208802@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"ITAGAKI Takahiro" <itagaki(dot)takahiro(at)gmail(dot)com> writes:
> WAL Writer requests unnecessary checkpoints with CHECKPOINT_CAUSE_XLOG.
> RedoRecPtr, declared in xlog.c, is initialized at StartupXLOG() but never
> updated in WAL Writer because it never calls XLogInsert(). It judges excess
> of segments wrongly.

Good catch. I think the best fix for this is to make XLogWrite call
GetRedoRecPtr and recheck the condition before actually sending a
signal.

regards, tom lane


From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: ITAGAKI Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3674: Unnecessary checkpoints by WAL Writer
Date: 2007-10-15 20:24:06
Message-ID: 1192479846.5272.15.camel@ebony.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Fri, 2007-10-12 at 13:06 -0400, Tom Lane wrote:
> "ITAGAKI Takahiro" <itagaki(dot)takahiro(at)gmail(dot)com> writes:
> > WAL Writer requests unnecessary checkpoints with CHECKPOINT_CAUSE_XLOG.
> > RedoRecPtr, declared in xlog.c, is initialized at StartupXLOG() but never
> > updated in WAL Writer because it never calls XLogInsert(). It judges excess
> > of segments wrongly.
>
> Good catch. I think the best fix for this is to make XLogWrite call
> GetRedoRecPtr and recheck the condition before actually sending a
> signal.

Yes, very good catch, my bad. Thanks Itagaki.

--
Simon Riggs
2ndQuadrant http://www.2ndQuadrant.com