Re: Confusing comment in xlog.c or am I missing something?

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Confusing comment in xlog.c or am I missing something?
Date: 2013-05-02 06:11:14
Message-ID: CA+HiwqG39yY6ir287J21fFXrc8H-sD2Dbdy40hkMi6X8UZdFEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > /* Check for crossing of xlog segment boundary */
> > if (RecPtr->xrecoff>= XLogFileSize)
> > {
> > (RecPtr->xlogid)++;
> > RecPtr->xrecoff = 0;
> > }
> >
> > Is that xlog "file" boundary or am I missing something?
>
> The WAL space is divided into 4GB "log files", which are not physical
> files but purely logical constructs. The XLogRecPtr.xlogid field
> indicates the logical log file, and xrecoff is the offset within the
> file. Each logical log file is divided into "log segments", which are
> the physical files you see in pg_xlog. See also the comment above the
> definition of XLogRecPtr.
>
> This split was necessary to deal with more than 4 GB of WAL, using only
> 32-bit integers. In 9.3, that's changed, and XLogRecPtr is a 64-bit
> integer. The whole concept of "logical log files" is gone, so it's a lot
> less confusing now.
>
> - Heikki

I see. However, although in 9.3 XLogRecPtr is a 64bit integer, in 9.2
branch, it is
still a struct with xlogid and xrecoff (both uint32) as its members.

In that case, should the comment be "/* Check for crossing of xlog
file boundary */"
instead of /* Check for crossing of xlog segment boundary */, since
( RecPtr->xrecoff >= XLogFileSize )
would mean crossing the xlog "file" (not segment) boundary, right?
Am I still missing something as in 9.2?

Amit Langote

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Confusing-comment-in-xlog-c-or-am-I-missing-something-tp5754010p5754014.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-05-02 06:27:00 Re: Confusing comment in xlog.c or am I missing something?
Previous Message Heikki Linnakangas 2013-05-02 05:54:01 Re: Confusing long option in pg_receivexlog/basebackup/dumpall