Re: Improve error reporting in 027_stream_regress test

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Nazir Bilal Yavuz <byavuz81@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-07-19T06:05:56Z
Lists: pgsql-hackers
On Fri, Jul 18, 2025 at 11:57:07AM +0300, Nazir Bilal Yavuz wrote:
> I added that as 0001. I used a shifting method for the 'tail'
> direction to not use too much memory. I found that there is
> 'File::ReadBackwards' in Perl but you need to install it, so I didn't
> use it.

Some old buildfarm may complain when it comes to that, like some of
Tom's stuff (?).

> 0001: 'Add trim_file() helper to Utils.pm' -> Which effectively does
> nothing, just adds a function to be used for a subsequent patch. This
> function accepts 'line_count' as an argument but
> 'PG_TEST_FILE_TRIM_LINES' environment variable overrides it. Should I
> document 'PG_TEST_FILE_TRIM_LINES' somewhere?

Documentation is required in regress.sgml, yes.

> 0002: 'Improve error reporting in 027_stream_regress test' -> Uses
> trim_file() function to improve error reporting by including the head
> and tail of regression.diffs directly in the failure message.

The structure is strange, it seems to me that we should target things
so as we have only one PG_TEST_FILE_TRIM_LINES defined in the tree,
not two with one local to 027.

> 0003: 'Check primary and standby are alive after regression tests in
> 027_stream_regress' -> Add test for checking status of primary and
> standby after the regression tests in 027_stream_regress. Also, it
> makes error reporting happen only if regression tests are failed and
> both primary and standby are alive.

This one looks acceptable to me, so applied to begin with something,
splitting things into two pieces for clarity with some tweaks.  I have
changed things to use system_log() at the end, with fat-commas to link
the long options and their arguments.
--
Michael

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Improve error reporting of recovery test 027_stream_regress

  2. Add PostgreSQL::Test::Cluster::read_head_tail() helper to PostgreSQL/Utils.pm

  3. Handle timeout in PostgreSQL::Test::Cluster::is_alive()

  4. Check status of nodes after regression test run in 027_stream_regress

  5. Add PostgreSQL::Test::Cluster::is_alive()