diff --git a/src/test/recovery/t/055_standby_snapshot_export.pl b/src/test/recovery/t/055_standby_snapshot_export.pl index 139190cf231..4cf3e78c766 100644 --- a/src/test/recovery/t/055_standby_snapshot_export.pl +++ b/src/test/recovery/t/055_standby_snapshot_export.pl @@ -122,7 +122,6 @@ $s1->query_safe('COMMIT'); $u->query_safe('COMMIT'); $primary->safe_psql('postgres', q[INSERT INTO victim VALUES (7, repeat('y', 1200))]); -$o->query_safe('COMMIT'); $primary->wait_for_replay_catchup($standby); # Sessions that never touched the exported snapshot must agree with the @@ -151,6 +150,13 @@ $s3->query_safe('BEGIN ISOLATION LEVEL REPEATABLE READ'); my $snap2 = $s3->query_safe('SELECT pg_export_snapshot()'); my $before = $s3->query_safe('SELECT count(*) FROM victim'); +my $file2 = slurp_file($standby->data_dir . "/pg_snapshots/$snap2"); +my ($sof2) = $file2 =~ /^sof:(\d+)$/m; +note("BDT snapshot saved for post-promotion re-export $snap2: sof=$sof2"); + +$o->query_safe('COMMIT'); +$primary->wait_for_replay_catchup($standby); + $standby->promote; $standby->poll_query_until('postgres', 'SELECT NOT pg_is_in_recovery()') or die "standby never finished promotion"; @@ -172,6 +178,16 @@ $s4->query_safe('RELEASE sp'); my $snap3 = $s4->query_safe('SELECT pg_export_snapshot()'); my $file3 = slurp_file($standby->data_dir . "/pg_snapshots/$snap3"); +my ($sof3) = $file3 =~ /^sof:(\d+)$/m; +my ($xmax3) = $file3 =~ /^xmax:(\d+)$/m; +my @subxids3 = $file3 =~ /^sxp:(\d+)$/mg; +my @post_xmax_subxids3 = grep { $_ >= $xmax3 } @subxids3; +note( + "BDT re-exported snapshot $snap3: sof=$sof3; xmax=$xmax3; sxp=[" + . join(', ', @subxids3) + . "]; sxp >= xmax=[" + . join(', ', @post_xmax_subxids3) + . "]"); like($file3, qr/^sxcnt:[1-9]/m, 'a recovery-taken snapshot re-exports its subxip array after a write');