From 4b377025db31174f8f2a43123f0b2c4205b240ed Mon Sep 17 00:00:00 2001 From: Zhijie Hou Date: Sat, 31 Oct 2026 16:28:45 +0800 Subject: [PATCH] Top-up for v6-0001: Test streamed subtransaction rollback with logical messages. Verify in 001_basic.pl that a transactional logical message emitted in a streamed subtransaction that later rolls back to a savepoint is not applied under both streaming = on and streaming = parallel. --- src/test/modules/test_logicalmsg_hooks/t/001_basic.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/modules/test_logicalmsg_hooks/t/001_basic.pl b/src/test/modules/test_logicalmsg_hooks/t/001_basic.pl index a9ff6171ad6..59d38769c03 100644 --- a/src/test/modules/test_logicalmsg_hooks/t/001_basic.pl +++ b/src/test/modules/test_logicalmsg_hooks/t/001_basic.pl @@ -124,7 +124,10 @@ foreach my $mode ('on', 'parallel') $pub->safe_psql( 'postgres', qq{ BEGIN; +SAVEPOINT sp; +SELECT pg_logical_emit_message(true, 'streaming_subxact_aborted_$mode', 'not delivered'); INSERT INTO test SELECT generate_series(1000, 6000); +ROLLBACK TO SAVEPOINT sp; SELECT pg_logical_emit_message(true, 'streaming_$mode', 'streamed message'); COMMIT; }); @@ -136,6 +139,10 @@ COMMIT; q{SELECT stream_txns > 0 FROM pg_stat_replication_slots WHERE slot_name = 'sub'} ) or die "transaction was not streamed"; + is(logged_count("streaming_subxact_aborted_$mode"), + 0, + "message of an aborted streamed subtransaction is not applied (streaming = $mode)" + ); is(logged_count("streaming_$mode"), 1, "message in a streamed transaction is applied (streaming = $mode)"); -- 2.54.0 (Apple Git-157)