Re: cleaning up a few CLOG-related things - Mailing list pgsql-hackers

From Robert Haas
Subject Re: cleaning up a few CLOG-related things
Date
Msg-id CA+TgmoZJcLbJTdD3X-oNMrU5BxqRvLch4yYCbS-G2dUsxh0peA@mail.gmail.com
Whole thread Raw
In response to Re: cleaning up a few CLOG-related things  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: cleaning up a few CLOG-related things  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
On Mon, Jan 25, 2021 at 2:11 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> > [patches 0001 - 0003]
>
> Makes sense.

Great. I committed the first one and will proceed with those as well.

> > So, the CLOG page gets created when nextXid advances from the first
> > value on the page to the second value on the page, not when it
> > advances from the last value on the previous page to the first value
> > on the current page.
> Yes. It took me a moment to understand that explanation, though. I'd
> phrase it something like "nextXid is the next XID that will be used, but
> we want to set latest_page_number according to the last XID that's
> already been used. So retreat by one."

OK, updated the patch to use that language for the comment.

> Having a separate FullTransactionIdToLatestPageNumber() function for
> this seems like overkill to me.

I initially thought so too, but it turned out to be pretty useful for
writing debugging cross-checks and things, so I'm inclined to keep it
even though I'm not at present proposing to commit any such debugging
cross-checks. For example I tried making the main redo loop check
whether XactCtl->shared->latest_page_number ==
FullTransactionIdToLatestPageNumber(nextXid) which turned out to be
super-helpful in understanding things.

-- 
Robert Haas
EDB: http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Printing backtrace of postgres processes
Next
From: Jacob Champion
Date:
Subject: Re: Support for NSS as a libpq TLS backend