Re: [HACKERS] xlogfilename - Mailing list pgsql-hackers

From Yugo Nagata
Subject Re: [HACKERS] xlogfilename
Date
Msg-id 20170720223312.eb2a04d5.nagata@sraoss.co.jp
Whole thread Raw
In response to Re: [HACKERS] xlogfilename  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: [HACKERS] xlogfilename
List pgsql-hackers
On Thu, 20 Jul 2017 11:02:25 +0200
Michael Paquier <michael.paquier@gmail.com> wrote:

> On Thu, Jul 20, 2017 at 10:58 AM, DEV_OPS <devops@ww-it.cn> wrote:
> > I think you may reference to function: pg_xlogfile_name   in
> > src/backend/access/transam/xlogfuncs.c,  it use XLogFileName  defined in
> > src/include/access/xlog_internal.h
> >
> > #define XLogFileName(fname, tli, logSegNo)  \
> >     snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli,       \
> >              (uint32) ((logSegNo) / XLogSegmentsPerXLogId), \
> >              (uint32) ((logSegNo) % XLogSegmentsPerXLogId))
> >
> >
> > hope it's helpful for you
> 
> The first 8 characters are the timeline number in hexadecimal format.
> The next 8 characters indicate a segment number, which gets
> incremented every 256 segments in hexa format. The last 8 characters
> indicate the current segment number in hexa format.

As far as I understand, XLOG is a logical big file of 256 * 16 MB,
and this is split to multiple physical files of 16MB which are called
WAL segments. The second 8 characters indicate the id of the logical
xlog file, and the last 8 characters indicate the sequencial number of
the segment in this xlog.

Regards,

> -- 
> Michael
> 
> 
> -- 
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers


-- 
Yugo Nagata <nagata@sraoss.co.jp>



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: [HACKERS] autovacuum can't keep up, bloat just continues to rise
Next
From: Yugo Nagata
Date:
Subject: [HACKERS] Incorrect comment of XLByteToSeg() and XLByteToPrevSeg()