Re: test: avoid redundant standby catchup in 049_wait_for_lsn

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Jobin Augustine <jobin(dot)augustine(at)percona(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: test: avoid redundant standby catchup in 049_wait_for_lsn
Date: 2026-12-04 00:55:54
Message-ID: CABPTF7VQoMtZ1XOxC6OcCHbAs0NC-Xy3YZA0fZNheHWJeszHAw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alexander,
>
>
> I've checked the path. The documentation changes look good to me.
> The calculations using page header sizes in tap tests look a bit
> awkward to me, especially given those sizes aren't directly available.
> I propose the following changes in v2.
>
> * In sections 1, 3 and 7b-7d, the standby mode checks take the target
> from pg_current_wal_flush_lsn() instead of
> pg_current_wal_insert_lsn(). The commit is flushed by then, and the
> flush LSN never points into a page header, so WAIT doesn't remap the
> target and the checks stay exact.
> * For primary_flush (sections 3 and 7e), the flush LSN would already
> be reached, so the target is the return value of
> pg_logical_emit_message(false, ..., false). That is the end of a
> record that isn't flushed yet, so WAIT really has to wait, and a
> record end never points into a page header.
> * In section 11, if a frozen replay or flush position lands on a page
> start, the test writes more WAL and freezes again. This replaces the
> "+41" step, so current + 1 is always a real fencepost.
> * Section 11d takes the target from pg_current_wal_flush_lsn(), as in
> v1, with the comment moved next to that query.
> * The wait_target_lsn() helper is removed, so the test doesn't need to
> know page header sizes. Section 11e remains the only test of targets
> past a page header.

The patch seems good to me and the patched 049 passes well. Just a
small comment: can we merge the two safe_psql calls in the Section 11
retry loop into one to save round-trip?

--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Fujii Masao 2026-12-04 00:37:47 Re: postgres_fdw can crash on malformed remote results