1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Fix cache-dependent test failures in logical decoding.

The regression test added in commit 1230be12f failed with
CLOBBER_CACHE_ALWAYS builds as it depends on cache behavior. This test
failure occurred only on v13 because the original data loss problem
was fixed differently in v13 compared to v14 and later versions,
resulting in different expected-output files.

This commit adds an extra expected-output file to cover both regular
and CLOBBER_CACHE_ALWAYS build cases.

Oversight in 1230be12f.

Per buildfarm member trilobite.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/dbf561f7-465e-4086-adfa-733b9b9a34b3@gmail.com
This commit is contained in:
Masahiko Sawada
2025-06-24 07:07:40 -07:00
parent 0a277da651
commit 87819f766f
2 changed files with 51 additions and 0 deletions

View File

@ -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)

View File

@ -1,6 +1,10 @@
# Test that catalog cache invalidation messages are distributed to ongoing # Test that catalog cache invalidation messages are distributed to ongoing
# transactions, ensuring they can access the updated catalog content after # transactions, ensuring they can access the updated catalog content after
# processing these messages. # processing these messages.
#
# This file contains a cache-behavior-dependent test case. Its result is
# different between regular and CLOBBER_CACHE_ALWAYS builds, so we must have
# two expected-output files to cover both cases.
setup setup
{ {
SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'pgoutput'); 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 # Expect to get no change because both s1's and s3's transactions
# use the snapshot from before adding the table tbl1 to the # use the snapshot from before adding the table tbl1 to the
# publication by "s2_alter_pub_add_tbl". # 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 tbl1
# 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" 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"