Hello, hackers! Recently I've been building postgres with different cflags and cppflags. And suddenly on REL_15_STABLE, REL_16_STABLE and master I faced a failure of a src/test/subscription/t/029_on_error.pl test when CPPFLAGS="-DWAL_DEBUG" and printf "wal_debug = on\n" >> "${TEMP_CONFIG}" (or when both publisher and subscriber or only subscriber are run with wal_debug=on)
So I propose a little fix to the test. Kind regards, Ian Ilyasov. Junior Software Developer at Postgres Professional
From 74cc32fe47def995c7cd85d3685215db383d3630 Mon Sep 17 00:00:00 2001 From: Ian Ilyasov <ianilya...@outlook.com> Date: Tue, 14 May 2024 13:08:02 +0300 Subject: [PATCH] Fix subscription/029_on_error.pl test when wal_debug=on wal_debug=on results in additional log entries. Previously we would look for the first matching line to get LSN to SKIP up to, but, with wal_debug in mind, we better look for the last matching line to make sure we won't get an error like ERROR: skip WAL location (LSN x/y) must be greater than origin LSN x/y+delta --- src/test/subscription/t/029_on_error.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/subscription/t/029_on_error.pl b/src/test/subscription/t/029_on_error.pl index 7a8e424a22e..aedcd9a6213 100644 --- a/src/test/subscription/t/029_on_error.pl +++ b/src/test/subscription/t/029_on_error.pl @@ -28,8 +28,9 @@ sub test_skip_lsn # Get the finish LSN of the error transaction. my $contents = slurp_file($node_subscriber->logfile, $offset); + # We need LSN from the last matching line to avoid getting wrong LSN with wal_debug=on $contents =~ - qr/processing remote data for replication origin \"pg_\d+\" during message type "INSERT" for replication target relation "public.tbl" in transaction \d+, finished at ([[:xdigit:]]+\/[[:xdigit:]]+)/ + qr/(?:.|\n)*processing remote data for replication origin \"pg_\d+\" during message type "INSERT" for replication target relation "public.tbl" in transaction \d+, finished at ([[:xdigit:]]+\/[[:xdigit:]]+)/ or die "could not get error-LSN"; my $lsn = $1; -- 2.34.1