pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve truncation of pg_serial/, removing "apparent wraparound"
Date: Tue, 17 Oct 2023 05:37:19 +0000
Message-ID: <E1qsclb-000xFC-AZ@gemulon.postgresql.org> (raw)

Improve truncation of pg_serial/, removing "apparent wraparound" LOGs

It is possible that the tail XID of pg_serial/ gets ahead of its head
XID, which would cause the truncation of pg_serial/ done during
checkpoints to show up as a "wraparound" LOG in SimpleLruTruncate(),
which is confusing.  This also wastes a bit of disk space until the head
page is reclaimed again.

CheckPointPredicate() is changed so as the cutoff page for the
truncation is switched to the head page if the tail XID has advanced
beyond the head XID, rather than the tail page.  This prevents the
confusing LOG message about a wraparound while allowing some truncation
to be done to cut in disk space.

This could be considered as a bug fix, but the original behavior is
harmless as well, resulting only in disk space temporarily wasted, so
no backpatch is done.

Author: Sami Imseih
Reviewed-by: Heikki Linnakangas, Michael Paquier
Discussion: https://postgr.es/m/755E19CA-D02C-4A4C-80D3-74F775410C48@amazon.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d6b0c2bcb1b604e919b15a32c1aeb981bfae4d51

Modified Files
--------------
src/backend/storage/lmgr/predicate.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)



Message-ID: <E1qsclb-000xFC-AZ@gemulon.postgresql.org>
Permalink:  ../E1qsclb-000xFC-AZ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qsclb-000xFC-AZ@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Improve truncation of pg_serial/, removing "apparent wraparound"
  In-Reply-To: <E1qsclb-000xFC-AZ@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox