From: Heikki Linnakangas Date: Sun, 22 Mar 2026 12:23:54 +0000 (+0200) Subject: Don't reset 'latest_page_number' when replaying multixid truncation X-Git-Tag: REL_19_BETA1~729 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=516310ed4dba89bd300242df0d56b4782f33ed4d;p=thirdparty%2Fpostgresql.git Don't reset 'latest_page_number' when replaying multixid truncation 'latest_page_number' is set to the correct value, according to nextOffset, early at system startup. Contrary to the comment, it hence should be set up correctly by the time we get to WAL replay. This was committed to back-branches earlier already (commit 817f74600d), to fix a bug in a backwards-compatibility codepath. We don't have that bug on 'master', but the change nevertheless makes sense on 'master' too. Reviewed-by: Andrey Borodin Reviewed-by: Kirill Reshke Discussion: https://www.postgresql.org/message-id/20260214090150.GC2297@p46.dedyn.io;lightning.p46.dedyn.io Discussion: https://www.postgresql.org/message-id/e1787b17-dc93-4621-a5a1-c713d1ac6a1b@iki.fi --- diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index 57d2ab4ce31..9f8d542c098 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -2957,7 +2957,6 @@ multixact_redo(XLogReaderState *record) else if (info == XLOG_MULTIXACT_TRUNCATE_ID) { xl_multixact_truncate xlrec; - int64 pageno; memcpy(&xlrec, XLogRecGetData(record), SizeOfMultiXactTruncate); @@ -2980,15 +2979,6 @@ multixact_redo(XLogReaderState *record) SetMultiXactIdLimit(xlrec.oldestMulti, xlrec.oldestMultiDB); PerformMembersTruncation(xlrec.oldestOffset); - - /* - * During XLOG replay, latest_page_number isn't necessarily set up - * yet; insert a suitable value to bypass the sanity test in - * SimpleLruTruncate. - */ - pageno = MultiXactIdToOffsetPage(xlrec.oldestMulti); - pg_atomic_write_u64(&MultiXactOffsetCtl->shared->latest_page_number, - pageno); PerformOffsetsTruncation(xlrec.oldestMulti); LWLockRelease(MultiXactTruncationLock);