From 046f5efe4965ae3f23695ce98b0893475a16adbe Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Mon, 19 Oct 2026 11:56:38 +0900 Subject: [PATCH v1] Test prepared transaction recovery logging --- src/test/recovery/t/009_twophase.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl index aa73d3e106c..aedb4c279dc 100644 --- a/src/test/recovery/t/009_twophase.pl +++ b/src/test/recovery/t/009_twophase.pl @@ -39,6 +39,10 @@ $node_london->append_conf( log_checkpoints = true )); $node_london->start; +$node_london->log_check( + 'No prepared transactions at startup', + 0, + log_unlike => [qr/LOG: recovered \d+ prepared transaction/]); $node_london->backup('london_backup'); # Setup paris node @@ -82,8 +86,9 @@ $cur_primary->psql( SAVEPOINT s1; INSERT INTO t_009_tbl VALUES (4, 'issued to ${cur_primary_name}'); PREPARE TRANSACTION 'xact_009_2';"); -$cur_primary->stop; -$cur_primary->start; +$cur_primary->restart( + log_like => qr/LOG: recovered 2 prepared transactions\r?$/m, + log_unlike => qr/LOG: recovering prepared transaction /); $psql_rc = $cur_primary->psql('postgres', "COMMIT PREPARED 'xact_009_1'"); is($psql_rc, '0', 'Commit prepared transaction after restart'); @@ -223,6 +228,7 @@ $cur_primary->psql( INSERT INTO t_009_tbl VALUES (22, 'issued to ${cur_primary_name}'); PREPARE TRANSACTION 'xact_009_10';"); $cur_primary->stop; +my $log_offset = -s $cur_standby->logfile; $cur_standby->promote; # change roles @@ -235,6 +241,11 @@ $cur_primary_name = $cur_primary->name; $psql_rc = $cur_primary->psql('postgres', "SET synchronous_commit = off; COMMIT PREPARED 'xact_009_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 /]); # restart old primary as new standby $cur_standby->enable_streaming($cur_primary); -- 2.56.0