[pgpool-hackers: 2] Fix error on the lsn math

Tatsuo Ishii ishii at postgresql.org
Mon Nov 28 07:56:52 JST 2011


Guillaume,

About your commit in the subject.

Before it used 0xff000000 and changed by me according to the
suggestion:

From: Anton Yuzhaninov
To: pgpool-hackers at pgfoundry.org
Date: Wed, 04 May 2011 19:56:54 +0400

> I have two questions/suggestions about replication lag check for
> straming replication in pgpool-II.
> 
> 1. In text_to_lsn() there is formula
> 
> lsn = xlogid * 16 * 1024 * 1024 * 255 + xrecoff;
> 
> 16 * 1024 * 1024 * 255 = 4278190080 = 0xff000000
> 
> where this magic numbers come from?
> 
> I think multiplier should be
> 0xffffffff - XLogSegSize.
> 
> In PostgreeSQL source this constant used in
> src/include/access/xlog_internal.h
> 
> #define XLogSegsPerFile (((uint32) 0xffffffff) / XLogSegSize)
> 
> But in comment noted, that one segment at the end of each log file is
> wasted
> 
> Each xlogid corresponds to (XLogSegsPerFile - 1) * XLogSegSize =
> 0xffffffff - XLogSegSize bytes

I confirmed in the source code and decided to change "16 * 1024 * 1024
* 255 = 4278190080 = 0xff000000" to 0xffffffff. Now you changed it
to original constant. Do you have any point against his argument?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp


More information about the pgpool-hackers mailing list