Re: xlogfilename

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, DEV_OPS <devops(at)ww-it(dot)cn>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, computer_wg(at)163(dot)com
Subject: Re: xlogfilename
Date: 2017-07-21 12:09:07
Message-ID: 20170721210907.0890db32.nagata@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 21 Jul 2017 10:11:05 +0800
Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:

> On 20 July 2017 at 21:33, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:
>
> > On Thu, 20 Jul 2017 11:02:25 +0200
> > Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
> >
> > > On Thu, Jul 20, 2017 at 10:58 AM, DEV_OPS <devops(at)ww-it(dot)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.
> > <http://www.postgresql.org/mailpref/pgsql-hackers>
> >
>
> You missed the timeline ID, which is the first 8 digits.

Yes, I missed this. Thanks.

>
>
> --
> Craig Ringer http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2017-07-21 12:35:01 Re: [PATCH] A hook for session start
Previous Message Alexey Chernyshov 2017-07-21 12:05:53 [PATCH] Pageinspect - add functions on GIN and GiST indexes from gevel