From ca34a18af0be913aee4bcd81d3ae04705205e165 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Fri, 30 Oct 2026 09:28:52 +0900 Subject: [PATCH v1] Fix twophase recovery log matching with verbose logs Commit c11eb5de01b added checks for prepared transaction recovery messages in 009_twophase.pl that assumed no SQLSTATE appeared after the log severity. With log_error_verbosity=verbose, the SQLSTATE is included, causing the positive checks to fail and preventing the negative checks from detecting unwanted LOG messages. Allow an optional SQLSTATE in all five checks. Per buildfarm member prion, which uses log_error_verbosity = verbose. Reported-by: Tom Lane Discussion: https://postgr.es/m/2256937.1793317544@sss.pgh.pa.us --- src/test/recovery/t/009_twophase.pl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl index aedb4c279dc..c8c491a735f 100644 --- a/src/test/recovery/t/009_twophase.pl +++ b/src/test/recovery/t/009_twophase.pl @@ -42,7 +42,8 @@ $node_london->start; $node_london->log_check( 'No prepared transactions at startup', 0, - log_unlike => [qr/LOG: recovered \d+ prepared transaction/]); + log_unlike => + [qr/LOG: (?:[A-Z0-9]{5}: )?recovered \d+ prepared transaction/]); $node_london->backup('london_backup'); # Setup paris node @@ -87,8 +88,10 @@ $cur_primary->psql( INSERT INTO t_009_tbl VALUES (4, 'issued to ${cur_primary_name}'); PREPARE TRANSACTION 'xact_009_2';"); $cur_primary->restart( - log_like => qr/LOG: recovered 2 prepared transactions\r?$/m, - log_unlike => qr/LOG: recovering prepared transaction /); + log_like => + qr/LOG: (?:[A-Z0-9]{5}: )?recovered 2 prepared transactions\r?$/m, + log_unlike => + qr/LOG: (?:[A-Z0-9]{5}: )?recovering prepared transaction /); $psql_rc = $cur_primary->psql('postgres', "COMMIT PREPARED 'xact_009_1'"); is($psql_rc, '0', 'Commit prepared transaction after restart'); @@ -244,8 +247,10 @@ is($psql_rc, '0', "Restore of prepared transaction on promoted standby"); $cur_primary->log_check( 'Prepared transaction recovery logging after promotion', $log_offset, - log_like => [qr/LOG: recovered 1 prepared transaction\r?$/m], - log_unlike => [qr/LOG: recovering prepared transaction /]); + log_like => + [qr/LOG: (?:[A-Z0-9]{5}: )?recovered 1 prepared transaction\r?$/m], + log_unlike => + [qr/LOG: (?:[A-Z0-9]{5}: )?recovering prepared transaction /]); # restart old primary as new standby $cur_standby->enable_streaming($cur_primary); -- 2.56.0