Re: pg_walfile_name uses XLByteToPrevSeg

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_walfile_name uses XLByteToPrevSeg
Date: 2022-02-04 22:50:57
Message-ID: 20220204225057.GA1535307@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 04, 2022 at 09:17:54AM -0500, Robert Haas wrote:
> On Fri, Feb 4, 2022 at 9:05 AM Ashutosh Bapat
> <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>> And it gives some surprising results as well
>> ---
>> #select pg_walfile_name('0/0'::pg_lsn);
>> pg_walfile_name
>> --------------------------
>> 00000001FFFFFFFF000000FF
>> (1 row)
>> ----
>
> Yeah, that seems wrong.

It looks like it's been this way for a while (704ddaa).
pg_walfile_name_offset() has the following comment:

* Note that a location exactly at a segment boundary is taken to be in
* the previous segment. This is usually the right thing, since the
* expected usage is to determine which xlog file(s) are ready to archive.

I see a couple of discussions about this as well [0] [1].

[0] https://www.postgresql.org/message-id/flat/1154384790.3226.21.camel%40localhost.localdomain
[1] https://www.postgresql.org/message-id/flat/15952.1154827205%40sss.pgh.pa.us

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2022-02-04 22:56:45 Re: do only critical work during single-user vacuum?
Previous Message Peter Geoghegan 2022-02-04 22:26:46 Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations