v1-0001-Fix-invalidation-distribution-test-failure-in-log.patch

application/octet-stream

Filename: v1-0001-Fix-invalidation-distribution-test-failure-in-log.patch
Type: application/octet-stream
Part: 0
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 v1-0001
Subject: Fix invalidation distribution test failure in logical decoding.
File+
contrib/test_decoding/expected/invalidation_distribution_1.out 41 0
contrib/test_decoding/specs/invalidation_distribution.spec 10 0
From ca4e957e34a685fa30e430dcc0d25a926ca4b849 Mon Sep 17 00:00:00 2001
From: Masahiko Sawada <sawada.mshk@gmail.com>
Date: Mon, 23 Jun 2025 18:18:57 -0700
Subject: [PATCH v1] Fix invalidation distribution test failure in logical
 decoding.

Author:
Reviewed-by:
Discussion: https://postgr.es/m/
Backpatch-through:
---
 .../expected/invalidation_distribution_1.out  | 41 +++++++++++++++++++
 .../specs/invalidation_distribution.spec      | 10 +++++
 2 files changed, 51 insertions(+)
 create mode 100644 contrib/test_decoding/expected/invalidation_distribution_1.out

diff --git a/contrib/test_decoding/expected/invalidation_distribution_1.out b/contrib/test_decoding/expected/invalidation_distribution_1.out
new file mode 100644
index 00000000000..e5a19becb68
--- /dev/null
+++ b/contrib/test_decoding/expected/invalidation_distribution_1.out
@@ -0,0 +1,41 @@
+Parsed test spec with 3 sessions
+
+starting permutation: s1_insert_tbl1 s1_begin s1_insert_tbl1 s2_alter_pub_add_tbl s1_commit s1_insert_tbl1 s2_get_binary_changes
+step s1_insert_tbl1: INSERT INTO tbl1 (val1, val2) VALUES (1, 1);
+step s1_begin: BEGIN;
+step s1_insert_tbl1: INSERT INTO tbl1 (val1, val2) VALUES (1, 1);
+step s2_alter_pub_add_tbl: ALTER PUBLICATION pub ADD TABLE tbl1;
+step s1_commit: COMMIT;
+step s1_insert_tbl1: INSERT INTO tbl1 (val1, val2) VALUES (1, 1);
+step s2_get_binary_changes: SELECT count(data) FROM pg_logical_slot_get_binary_changes('isolation_slot', NULL, NULL, 'proto_version', '1', 'publication_names', 'pub') WHERE get_byte(data, 0) = 73;
+count
+-----
+    1
+(1 row)
+
+?column?
+--------
+stop    
+(1 row)
+
+
+starting permutation: s1_begin s1_insert_tbl1 s3_begin s3_insert_tbl1 s2_alter_pub_add_tbl s1_insert_tbl1 s1_commit s3_commit s2_get_binary_changes
+step s1_begin: BEGIN;
+step s1_insert_tbl1: INSERT INTO tbl1 (val1, val2) VALUES (1, 1);
+step s3_begin: BEGIN;
+step s3_insert_tbl1: INSERT INTO tbl1 (val1, val2) VALUES (2, 2);
+step s2_alter_pub_add_tbl: ALTER PUBLICATION pub ADD TABLE tbl1;
+step s1_insert_tbl1: INSERT INTO tbl1 (val1, val2) VALUES (1, 1);
+step s1_commit: COMMIT;
+step s3_commit: COMMIT;
+step s2_get_binary_changes: SELECT count(data) FROM pg_logical_slot_get_binary_changes('isolation_slot', NULL, NULL, 'proto_version', '1', 'publication_names', 'pub') WHERE get_byte(data, 0) = 73;
+count
+-----
+    1
+(1 row)
+
+?column?
+--------
+stop    
+(1 row)
+
diff --git a/contrib/test_decoding/specs/invalidation_distribution.spec b/contrib/test_decoding/specs/invalidation_distribution.spec
index c5977b8c483..24be7a13fbc 100644
--- a/contrib/test_decoding/specs/invalidation_distribution.spec
+++ b/contrib/test_decoding/specs/invalidation_distribution.spec
@@ -1,6 +1,10 @@
 # Test that catalog cache invalidation messages are distributed to ongoing
 # transactions, ensuring they can access the updated catalog content after
 # processing these messages.
+#
+# This file contains cache-behavior-dependent test case. Their reults are
+# different between regular and CLOBBER_CACHE_ALWAYS builds, so we must have
+# two expected-output files to cvoer both cases.
 setup
 {
     SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'pgoutput');
@@ -40,4 +44,10 @@ permutation "s1_insert_tbl1" "s1_begin" "s1_insert_tbl1" "s2_alter_pub_add_tbl"
 # Expect to get no change because both s1's and s3's transactions
 # use the snapshot from before adding the table tbl1 to the
 # publication by "s2_alter_pub_add_tbl".
+#
+# Note that with CLOBBER_CACHE_ALWAYS, we expect to get one insert
+# change with LOGICAL_REP_MSG_INSERT = "I' from the second
+# "s1_insert_tbl1" executed after adding the table tbl1 to the
+# publication in "s2_alter_pub_add_tbl" as the cache for table tbl
+# is forcibly flushed due to CLOBBER_CACHE_ALWAYS.
 permutation "s1_begin" "s1_insert_tbl1" "s3_begin" "s3_insert_tbl1" "s2_alter_pub_add_tbl" "s1_insert_tbl1" "s1_commit" "s3_commit" "s2_get_binary_changes"
-- 
2.43.5