pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: During online checkpoints, insert XLOG_CHECKPOINT_REDO at redo p
Date: Thu, 19 Oct 2023 18:48:14 +0000
Message-ID: <E1qtY46-001N8i-FR@gemulon.postgresql.org> (raw)

During online checkpoints, insert XLOG_CHECKPOINT_REDO at redo point.

This allows tools that read the WAL sequentially to identify (possible)
redo points when they're reached, rather than only being able to
detect them in retrospect when XLOG_CHECKPOINT_ONLINE is found, possibly
much later in the WAL stream. There are other possible applications as
well; see the discussion links below.

Any redo location that precedes the checkpoint location should now point
to an XLOG_CHECKPOINT_REDO record, so add a cross-check to verify this.

While adjusting the code in CreateCheckPoint() for this patch, I made it
call WALInsertLockAcquireExclusive a bit later than before, since there
appears to be no need for it to be held while checking whether the system
is idle, whether this is an end-of-recovery checkpoint, or what the current
timeline is.

Bump XLOG_PAGE_MAGIC.

Patch by me, based in part on earlier work from Dilip Kumar. Review by
Dilip Kumar, Amit Kapila, Andres Freund, and Michael Paquier.

Discussion: http://postgr.es/m/CA+TgmoYy-Vc6G9QKcAKNksCa29cv__czr+N9X_QCxEfQVpp_8w@mail.gmail.com
Discussion: http://postgr.es/m/20230614194717.jyuw3okxup4cvtbt%40awork3.anarazel.de
Discussion: http://postgr.es/m/CA+hUKG+b2ego8=YNW2Ohe9QmSiReh1-ogrv8V_WZpJTqP3O+2w@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
contrib/pg_walinspect/expected/pg_walinspect.out |  13 +-
contrib/pg_walinspect/sql/pg_walinspect.sql      |  10 +-
src/backend/access/rmgrdesc/xlogdesc.c           |   7 +
src/backend/access/transam/xlog.c                | 193 ++++++++++++++++-------
src/backend/access/transam/xlogrecovery.c        |  11 ++
src/backend/replication/logical/decode.c         |   1 +
src/include/access/xlog_internal.h               |   2 +-
src/include/catalog/pg_control.h                 |   1 +
src/tools/pgindent/typedefs.list                 |   1 +
9 files changed, 178 insertions(+), 61 deletions(-)



Message-ID: <E1qtY46-001N8i-FR@gemulon.postgresql.org>
Permalink:  ../E1qtY46-001N8i-FR@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qtY46-001N8i-FR@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: rhaas@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: During online checkpoints, insert XLOG_CHECKPOINT_REDO at redo p
  In-Reply-To: <E1qtY46-001N8i-FR@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