Re: PATCH: Unlogged tables re-initialization tests

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: David Steele <david(at)pgmasters(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: PATCH: Unlogged tables re-initialization tests
Date: 2018-03-14 14:13:01
Message-ID: 1f649c51-24e6-5ba7-a6be-34df32d82143@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3/13/18 12:46, Alvaro Herrera wrote:
> Dagfinn Ilmari Mannsåker wrote:
>
>> $SIG{__DIE__} gets called even for exceptions that would be caught by a
>> surrunding eval block, so this should at the very least be:
>>
>> $SIG{__DIE__} = sub { BAIL_OUT(@_) unless $^S };
>>
>> However, that is still wrong, because die() and BAIL_OUT() mean
>> different things: die() aborts the current test script, while BAIL_OUT()
>> aborts the entire 'prove' run, i.e. all subsequent scripts in the same
>> test directory.
>
> Sounds like 'die' is the correct thing, then, and that BAIL_OUT should
> be called sparingly ... for example this one in PostgresNode::start
> seems like an overreaction:
> BAIL_OUT("node \"$name\" is already running") if defined $self->{_pid};

It does sound like BAIL_OUT should be used more sparingly. However, if
you use die, then you don't get a good error message printed, just
something like

t/020_pg_receivewal.pl ... 9/18 # Looks like you planned 18 tests but
ran 12.
# Looks like your test exited with 25 just after 12.
t/020_pg_receivewal.pl ... Dubious, test returned 25 (wstat 6400, 0x1900)
Failed 6/18 subtests

whereas with BAIL_OUT you get

t/020_pg_receivewal.pl ... 9/18 Bailout called. Further testing
stopped: foobar
FAILED--Further testing stopped: foobar

The functional difference is significant however: BAIL_OUT prevents the
030 test file to be called, die does not.

Could use more research into best practices ....

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeevan Chalke 2018-03-14 14:21:16 Re: [HACKERS] Partition-wise aggregation/grouping
Previous Message Pavan Deolasee 2018-03-14 14:12:10 Re: Faster inserts with mostly-monotonically increasing values