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

Re: Miscalculation in IsCheckpointOnSchedule()

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Miscalculation in IsCheckpointOnSchedule()
Date: 2007-11-14 12:08:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Heikki Linnakangas wrote:
> Tom Lane wrote:
>> ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> writes:
>>> -         ((double) (int32) (recptr.xrecoff - 
>>> ckpt_start_recptr.xrecoff)) / XLogSegSize) /
>>> +         ((double) recptr.xrecoff - (double) 
>>> ckpt_start_recptr.xrecoff) / XLogSegSize) /
>> Surely this makes matters worse, not better.  What happens near a segment
>> boundary crossing?
> Hmm. There seems to be another little bug in there. XLogSegsPerFile is 
> defined as 0xffffffff/XLogSegSize, which is 255 with default settings. 
> It should be 256. That leads to negative elapsed_xlogs estimates at xlog 
> file boundaries. XLogCheckpointNeeded suffers from it too; the number of 
> segments consumed since last checkpoint is off by one per each xlogid, 
> so we trigger the checkpoint a little bit too late.

I'll take that back. We intentionally don't use the last possible 
segment of each xlog file, to avoid overflows. Sorry for the noise.

   Heikki Linnakangas

In response to

pgsql-patches by date

Next:From: Zdenek KotalaDate: 2007-11-14 14:14:45
Subject: Re: Fix pg_dump dependency on postgres.h
Previous:From: Heikki LinnakangasDate: 2007-11-14 11:47:08
Subject: Re: Miscalculation in IsCheckpointOnSchedule()

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