Re: pgsql: Add function to pump IPC process until string match

From: Andres Freund <andres(at)anarazel(dot)de>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: pgsql: Add function to pump IPC process until string match
Date: 2022-03-30 16:09:16
Message-ID: 20220330160916.vpsxtjss25yfyq3p@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Hi,

On 2022-03-30 09:10:17 +0200, Daniel Gustafsson wrote:
> > On 30 Mar 2022, at 00:58, Andres Freund <andres(at)anarazel(dot)de> wrote:
> > On 2022-02-23 13:32:03 +0000, Daniel Gustafsson wrote:
>
> >> Add function to pump IPC process until string match
> >>
> >> Refactor the recovery tests to not carry a local duplicated copy of
> >> the pump_until function which pumps a process until a defined string
> >> is seen on a stream. This reduces duplication, and is in preparation
> >> for another patch which will also use this functionality.
> >
> > I'm a bit disappointed by the moved function not having the diagnostic output
> > that at least the version in 013_crash_restart.pl had. How is one supposed to
> > figure out what caused a timeout with the new central version?
>
> Thats my bad then. Since we don't really have diag output in any module I was
> going off that "precedent" when moving this over.

We have a few places that manually output diagnostic stuff by printing with #
etc.

> > Given that timeouts are the only way tests using pump_until() fail, that's not
> > great.
>
> They can also fail on the pumped process crashing/exiting before the timeout
> without emitting the expected output.

Fair.

> Would adding back something like the (right now untested) below be what you're
> after? Looking at the perldoc I didn't see any other debugging aids we can
> emit other than the stream and type of error.

I found showing the regex from before useful. Often there's many
pump_until()'s, and the regex makes it easier to figure out what errored
out. And it shows quoting problem. Since it only happens when there was a
failure, it's not like it'll bloat the log unduly.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2022-03-30 16:23:11 Re: pgsql: Add 'basebackup_to_shell' contrib module.
Previous Message Peter Eisentraut 2022-03-30 15:54:17 pgsql: Change some internal error messages to elogs