v2-0002-Initialize-XLogLogicalInfo-after-StartupXLOG-in-s.patch

application/octet-stream

Filename: v2-0002-Initialize-XLogLogicalInfo-after-StartupXLOG-in-s.patch
Type: application/octet-stream
Part: 1
Message: Re: Fix race condition in XLogLogicalInfo and ProcSignal initialization.

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v2-0002
Subject: Initialize XLogLogicalInfo after StartupXLOG in standalone mode
File+
src/backend/utils/init/postinit.c 3 3
From 4ba0774bf48f079d50801edc4d0eb20cd3067cb2 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Thu, 30 Apr 2026 10:41:09 +0800
Subject: [PATCH v2 2/2] Initialize XLogLogicalInfo after StartupXLOG in
 standalone mode

Move InitializeProcessXLogLogicalInfo() to after the standalone
StartupXLOG() block in InitPostgres().

This keeps the initialization after ProcSignalInit() for normal
backends, while ensuring standalone backends initialize the local cache
only after StartupXLOG() has restored logical decoding state from the
checkpoint.
---
 src/backend/utils/init/postinit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index f87ad8c56dc..ed2e218bdac 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -777,9 +777,6 @@ InitPostgres(const char *in_dbname, Oid dboid,
 	 */
 	InitLocalDataChecksumState();
 
-	/* Initialize logical info WAL logging state */
-	InitializeProcessXLogLogicalInfo();
-
 	/*
 	 * Also set up timeout handlers needed for backend operation.  We need
 	 * these in every case except bootstrap.
@@ -827,6 +824,9 @@ InitPostgres(const char *in_dbname, Oid dboid,
 		before_shmem_exit(ShutdownXLOG, 0);
 	}
 
+	/* Initialize logical info WAL logging state */
+	InitializeProcessXLogLogicalInfo();
+
 	/*
 	 * Initialize the relation cache and the system catalog caches.  Note that
 	 * no catalog access happens here; we only set up the hashtable structure.
-- 
2.50.1 (Apple Git-155)