summaryrefslogtreecommitdiff
path: root/src/include/access/xlog_internal.h
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2024-07-18 12:09:48 -0400
committerRobert Haas <rhaas@postgresql.org>2024-07-18 12:09:48 -0400
commit402b586d0a9caae9412d25fcf1b91dae45375833 (patch)
tree2c0ebdf24bdf1beefa3c98e5c5d2a9e7965e9eda /src/include/access/xlog_internal.h
parenta0a5869a8598cdeae1d2f2d632038d26dcc69d19 (diff)
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
Diffstat (limited to 'src/include/access/xlog_internal.h')
-rw-r--r--src/include/access/xlog_internal.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h
index 5161b72f281..c6a91fb4560 100644
--- a/src/include/access/xlog_internal.h
+++ b/src/include/access/xlog_internal.h
@@ -31,7 +31,7 @@
/*
* Each page of XLOG file has a header like this:
*/
-#define XLOG_PAGE_MAGIC 0xD115 /* can be used as WAL version indicator */
+#define XLOG_PAGE_MAGIC 0xD116 /* can be used as WAL version indicator */
typedef struct XLogPageHeaderData
{
@@ -302,6 +302,7 @@ typedef struct xl_end_of_recovery
TimestampTz end_time;
TimeLineID ThisTimeLineID; /* new TLI */
TimeLineID PrevTimeLineID; /* previous TLI we forked off from */
+ int wal_level;
} xl_end_of_recovery;
/*