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-29T01:46:16Z
Lists: pgsql-hackers
On Mon, Jul 28, 2025 at 03:34:06PM +0300, Nazir Bilal Yavuz wrote:
> I wanted to show what is in my mind, v4 is attached. Summary is:
> 
> - 0001 introduces the read_file_ends() function, which reads lines
> from either the beginning or end of a given file. It includes a
> force_line_count argument that, when set to true, ensures that the
> specified number of lines is read from the file regardless of whether
> the PG_TEST_FILE_READ_LINES environment variable is set.

Hmm.  I am really wondering if 'head' and 'tail' should just be
shortcuts of some regexp patterns based on ^ and $, and that we could
allow the subroutine to use a regexp for the pattern matching.  I'll
look at that in details, but it may take me a couple of days before
getting down to it.

> - 0002 is the actual patch that improves error reporting in the
> 027_stream_regress test by using the read_file_ends() function. It
> adds a regression_log_helper() function, which reads the
> PG_TEST_FILE_READ_LINES environment variable and then calls
> read_file_ends() with force_line_count set to true. This approach
> avoids any potential race condition where the environment variable
> might be modified after being read in the regression_log_helper() and
> before used in the read_file_ends().

Why do you think the environment variable could be changed mid-flight
in the context of a single test run?
--
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()