v1-0002-Replace-assert-with-if-check-in-walsummarizer.patch
text/x-patch
Filename: v1-0002-Replace-assert-with-if-check-in-walsummarizer.patch
Type: text/x-patch
Part: 1
From 594473e38150fcc51b96d9c611b60c16f366d3a2 Mon Sep 17 00:00:00 2001
From: Alena Vinter <dlaaren8@gmail.com>
Date: Sun, 15 Jun 2025 01:29:23 +0700
Subject: [PATCH v1 2/2] Removed assertion in walsummarizer
Fixes an edge case in the walsummarizer process where fetching InsertTLI
during a timeline switch could lead to latest_lsn < read_upto (which
becomes walrcv->flushedUpto in this case), previously triggering an
assertion failure. We now handle this safely by replacing the assertion
with conditional logic.
---
src/backend/postmaster/walsummarizer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/backend/postmaster/walsummarizer.c b/src/backend/postmaster/walsummarizer.c
index 0fec4f1f871..4939df4c415 100644
--- a/src/backend/postmaster/walsummarizer.c
+++ b/src/backend/postmaster/walsummarizer.c
@@ -1551,8 +1551,8 @@ summarizer_read_local_xlog_page(XLogReaderState *state,
if (private_data->tli == latest_tli)
{
/* Still the current timeline, update max LSN. */
- Assert(latest_lsn >= private_data->read_upto);
- private_data->read_upto = latest_lsn;
+ if (latest_lsn >= private_data->read_upto)
+ private_data->read_upto = latest_lsn;
}
else
{
--
2.49.0