Re: Stabilize and shorten test_checksums/013_rewind test - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Stabilize and shorten test_checksums/013_rewind test
Date
Msg-id ED578DEE-5699-4077-BE7F-5AE84312359D@yesql.se
Whole thread
In response to Stabilize and shorten test_checksums/013_rewind test  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
Responses Re: Stabilize and shorten test_checksums/013_rewind test
List pgsql-hackers
> On 18 Sep 2026, at 12:26, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:

> I encountered two problems with the test_checksums/013_rewind test:
> ...
> I spent some time fixing these problems with the help of an LLM.

Thanks!

> Problem #1:
> 
> We wait for the primary's insert LSN in three places, but the primary
> might be idle and not have sent it yet:

Makes sense.

-$node_a->wait_for_catchup($node_b, 'replay', $node_a->lsn('insert'));
+# Backup completion has flushed the required WAL.
+$node_a->wait_for_catchup($node_b, 'replay', $node_a->lsn('flush'));

In these cases, couldn't we just wait for the replay LSN, ie the default for
wait_for_catchup?

> Problem #2
> 
> ($stdout, $stderr) = run_command(
> [
> 'pg_waldump',
> '-p' => $node_a->data_dir . '/pg_wal',
> '-t' => 1,
> '-s' => $shutdown_ckpt,
> '-n' => 1,
> ]);
> like($stdout, qr/CHECKPOINT_SHUTDOWN/,
> 'last common checkpoint is a shutdown checkpoint');
> 
> We don't specifiy which WAL file that pg_waldump() will use, then
> pg_waldump select first WAL data available in the directory. Then, it
> might select a WAL file whose header is not initialized yet (a
> preallocated WAL file).

Nice find, this patch seems quite straightforward.

--
Daniel Gustafsson




pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Race conditions in logical decoding
Next
From: Amit Kapila
Date:
Subject: Re: Logical replication can lose an update after concurrent index invalidation