pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Do not summarize WAL if generated with wal_level=minimal.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Do not summarize WAL if generated with wal_level=minimal.
@ 2024-07-18 16:16  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Haas @ 2024-07-18 16:16 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Do not summarize WAL if generated with wal_level=minimal.

To do this, we must include the wal_level in the first WAL record
covered by each summary file; so add wal_level to struct Checkpoint
and the payload of XLOG_CHECKPOINT_REDO and XLOG_END_OF_RECOVERY.

This, in turn, requires bumping XLOG_PAGE_MAGIC and, since the
Checkpoint is also stored in the control file, also
PG_CONTROL_VERSION. It's not great to do that so late in the release
cycle, but the alternative seems to ship v17 without robust
protections against this scenario, which could result in corrupted
incremental backups.

A side effect of this patch is that, when a server with
wal_level=replica is started with summarize_wal=on for the first time,
summarization will no longer begin with the oldest WAL that still
exists in pg_wal, but rather from the first checkpoint after that.
This change should be harmless, because a WAL summary for a partial
checkpoint cycle can never make an incremental backup possible when
it would otherwise not have been.

Report by Fujii Masao. Patch by me. Review and/or testing by Jakub
Wartak and Fujii Masao.

Discussion: http://postgr.es/m/6e30082e-041b-4e31-9633-95a66de76f5d@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/402b586d0a9caae9412d25fcf1b91dae45375833

Modified Files
--------------
doc/src/sgml/config.sgml                           |  16 +-
doc/src/sgml/func.sgml                             |  11 ++
src/backend/access/rmgrdesc/xlogdesc.c             |  47 +++--
src/backend/access/transam/xlog.c                  |   8 +-
src/backend/postmaster/walsummarizer.c             | 197 +++++++++++++++------
src/bin/pg_combinebackup/meson.build               |   1 +
.../pg_combinebackup/t/007_wal_level_minimal.pl    |  73 ++++++++
src/include/access/xlog_internal.h                 |   3 +-
src/include/catalog/pg_control.h                   |   3 +-
9 files changed, 278 insertions(+), 81 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Do not summarize WAL if generated with wal_level=minimal.
@ 2024-07-18 16:25  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Haas @ 2024-07-18 16:25 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Do not summarize WAL if generated with wal_level=minimal.

To do this, we must include the wal_level in the first WAL record
covered by each summary file; so add wal_level to struct Checkpoint
and the payload of XLOG_CHECKPOINT_REDO and XLOG_END_OF_RECOVERY.

This, in turn, requires bumping XLOG_PAGE_MAGIC and, since the
Checkpoint is also stored in the control file, also
PG_CONTROL_VERSION. It's not great to do that so late in the release
cycle, but the alternative seems to ship v17 without robust
protections against this scenario, which could result in corrupted
incremental backups.

A side effect of this patch is that, when a server with
wal_level=replica is started with summarize_wal=on for the first time,
summarization will no longer begin with the oldest WAL that still
exists in pg_wal, but rather from the first checkpoint after that.
This change should be harmless, because a WAL summary for a partial
checkpoint cycle can never make an incremental backup possible when
it would otherwise not have been.

Report by Fujii Masao. Patch by me. Review and/or testing by Jakub
Wartak and Fujii Masao.

Discussion: http://postgr.es/m/6e30082e-041b-4e31-9633-95a66de76f5d@oss.nttdata.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2b5819e2b4d6c69676c61ee799fd9590be2308ce

Modified Files
--------------
doc/src/sgml/config.sgml                           |  16 +-
doc/src/sgml/func.sgml                             |  11 ++
src/backend/access/rmgrdesc/xlogdesc.c             |  47 +++--
src/backend/access/transam/xlog.c                  |   8 +-
src/backend/postmaster/walsummarizer.c             | 197 +++++++++++++++------
src/bin/pg_combinebackup/meson.build               |   1 +
.../pg_combinebackup/t/007_wal_level_minimal.pl    |  73 ++++++++
src/include/access/xlog_internal.h                 |   3 +-
src/include/catalog/pg_control.h                   |   3 +-
9 files changed, 278 insertions(+), 81 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-07-18 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-18 16:16 pgsql: Do not summarize WAL if generated with wal_level=minimal. Robert Haas <rhaas@postgresql.org>
2024-07-18 16:25 pgsql: Do not summarize WAL if generated with wal_level=minimal. Robert Haas <rhaas@postgresql.org>

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