From 53972f4a250c9a8c0a89bc199ffe1e8f612e374d Mon Sep 17 00:00:00 2001
From: Ian Ilyasov <ianilyasov@outlook.com>
Date: Wed, 22 May 2024 17:10:42 +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 CONTEXT line
after the ERROR 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/subscription/t/029_on_error.pl b/src/test/subscription/t/029_on_error.pl
index 5c29e5cc32..d0df627b3b 100644
--- a/src/test/subscription/t/029_on_error.pl
+++ b/src/test/subscription/t/029_on_error.pl
@@ -29,7 +29,7 @@ sub test_skip_lsn
 	# Get the finish LSN of the error transaction.
 	my $contents = slurp_file($node_subscriber->logfile, $offset);
 	$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/ERROR:  duplicate key.*\n.*DETAIL:.*\n.*CONTEXT:.* finished at ([[:xdigit:]]+\/[[:xdigit:]]+)/m
 	  or die "could not get error-LSN";
 	my $lsn = $1;
 
-- 
2.34.1

