Skip to content

Commit 19a829a

Browse files
committed
Continue my quest to make 002_blocks.pl pass reliably.
The latest buildfarm failures show that after the insert, we don't actually wait long enough for WAL summarization to catch up, apparently because the on disk state gets updated before the in-memory state, and so by checking the on disk state to see whether we're caught up and then the in-memory state to see where exactly how far we've progressed, we can, if unlucky, derive an older value of summarized_lsn, messing up the rest of the test. Attempt to fix this by using pg_available_wal_summaries() everywhere in the test and pg_get_wal_summarizer_state() nowhere. Per buildfarm.
1 parent 21912e3 commit 19a829a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/bin/pg_walsummary/t/002_blocks.pl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@
4646
EOM
4747
ok($result, "WAL summarization caught up after insert");
4848

49-
# Get a list of what summaries we now have.
50-
my $progress = $node1->safe_psql('postgres', <<EOM);
51-
SELECT summarized_tli, summarized_lsn FROM pg_get_wal_summarizer_state()
49+
# Find the highest LSN that is summarized on disk.
50+
my $summarized_lsn = $node1->safe_psql('postgres', <<EOM);
51+
SELECT MAX(end_lsn) AS summarized_lsn FROM pg_available_wal_summaries()
5252
EOM
53-
my ($summarized_tli, $summarized_lsn) = split(/\|/, $progress);
54-
note("after insert, summarized TLI $summarized_tli through $summarized_lsn");
53+
note("after insert, summarized through $summarized_lsn");
5554
note_wal_summary_dir("after insert", $node1);
5655

5756
# Update a row in the first block of the table and trigger a checkpoint.
@@ -65,15 +64,15 @@
6564
$result = $node1->poll_query_until('postgres', <<EOM);
6665
SELECT EXISTS (
6766
SELECT * from pg_available_wal_summaries()
68-
WHERE tli = $summarized_tli AND end_lsn > '$summarized_lsn'
67+
WHERE end_lsn > '$summarized_lsn'
6968
)
7069
EOM
7170
ok($result, "got new WAL summary after update");
7271

7372
# Figure out the exact details for the new summary file.
7473
my $details = $node1->safe_psql('postgres', <<EOM);
7574
SELECT tli, start_lsn, end_lsn from pg_available_wal_summaries()
76-
WHERE tli = $summarized_tli AND end_lsn > '$summarized_lsn'
75+
WHERE end_lsn > '$summarized_lsn'
7776
EOM
7877
my @lines = split(/\n/, $details);
7978
is(0+@lines, 1, "got exactly one new WAL summary");

0 commit comments

Comments
 (0)