Re: Stabilize and shorten test_checksums/013_rewind test

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Subject: Re: Stabilize and shorten test_checksums/013_rewind test
Date: 2026-09-18 12:51:04
Message-ID: ED578DEE-5699-4077-BE7F-5AE84312359D@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 18 Sep 2026, at 12:26, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-09-18 12:54:51 Re: Logical replication can lose an update after concurrent index invalidation
Previous Message Alvaro Herrera 2026-09-18 12:28:55 Re: Race conditions in logical decoding