v12-0002-Make-MAX_DISTR_INVAL_MSG_PER_TXN-lower-in-case-o.patch

application/octet-stream

Filename: v12-0002-Make-MAX_DISTR_INVAL_MSG_PER_TXN-lower-in-case-o.patch
Type: application/octet-stream
Part: 1
Message: RE: Logical replication 'invalid memory alloc request size 1585837200' after upgrading to 17.5

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 v12-0002
Subject: Make MAX_DISTR_INVAL_MSG_PER_TXN lower in case of debug build
File+
src/backend/replication/logical/reorderbuffer.c 7 0
From 8467e16ade6e609b8e6900d936e80f21bb9688fc Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Fri, 6 Jun 2025 14:50:23 +0900
Subject: [PATCH v12 2/2] Make MAX_DISTR_INVAL_MSG_PER_TXN lower in case of
 debug build

---
 src/backend/replication/logical/reorderbuffer.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index c4299c76fb1..7720ae1125c 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -121,9 +121,16 @@
  * messages reach this threshold, the transaction is marked as
  * RBTXN_DISTR_INVAL_OVERFLOWED to invalidate the complete cache as we have lost
  * some inval messages and hence don't know what needs to be invalidated.
+ *
+ * In a debugging build, use a small threshold so that we get some test
+ * coverage of both code paths.
  */
+#ifdef USE_ASSERT_CHECKING
+#define MAX_DISTR_INVAL_MSG_PER_TXN 3
+#else
 #define MAX_DISTR_INVAL_MSG_PER_TXN \
 	((8 * 1024 * 1024) / sizeof(SharedInvalidationMessage))
+#endif
 
 /* entry for a hash table we use to map from xid to our transaction state */
 typedef struct ReorderBufferTXNByIdEnt
-- 
2.47.1