Re: timeouts in PostgresNode::psql

Lists: Postg스포츠 토토 베트맨SQL
From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: timeouts in PostgresNode::psql
Date: 2017-02-24 03:51:39
Message-ID: CAMsr+YGZ=MD2p1AmrgxtPn-Pr+EaRCaUeqw_AV9fQVTmb2gcuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 핫SQL :

Hi all

While writing some tests I noticed that in newer IPC::Run or Perl
versions (haven't dug extensively to find out which), perl appends the
location to the extension, so 'ne' doesn't match the passed exception
string.

Pattern-match the exception string to handle this.

Bugfix, should be applied to 9.6 and master.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-Fix-timeouts-in-PostgresNode-psql.patch text/x-patch 1.1 KB

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: timeouts in PostgresNode::psql
Date: 2017-02-27 02:28:08
Message-ID: CAMsr+YFLjfOodfK2brZjPpp5-6Tin=PazV-DngN7+qqC_UhRPA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Amended patch attached after a few Perl-related comments I got on
private mail. Instead of

$exc_save !~ /^$timeout_exception.*/

I've updated to:

$exc_save !~ /^\Q$timeout_exception\E/

i.e. don't do an unnecessary wildcard match at the end, and disable
metachar interpretation in the substituted range.

Still needs applying to pg9.6 and pg10.

Attachment Content-Type Size
0001-Fix-timeouts-in-PostgresNode-psql.patch text/x-patch 1.1 KB

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: timeouts in PostgresNode::psql
Date: 2017-02-28 06:28:27
Message-ID: CAB7nPqTNEVzCc2KOZFUyYv+NHJ9-KamCy2sLVdpR2+Z=h4HkCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg사설 토토 사이트SQL

On Mon, Feb 27, 2017 at 11:28 AM, Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:
> Amended patch attached after a few Perl-related comments I got on
> private mail.

Out of curiosity, what are they?

> Instead of
>
> $exc_save !~ /^$timeout_exception.*/
>
> I've updated to:
>
> $exc_save !~ /^\Q$timeout_exception\E/
>
> i.e. don't do an unnecessary wildcard match at the end, and disable
> metachar interpretation in the substituted range.
>
> Still needs applying to pg9.6 and pg10.

I did not understand at first what you meant, but after looking at the
commit message of the patch things are clear:
Newer Perl or IPC::Run versions default to appending the filename to string
exceptions, e.g. the exception
psql timed out
is thrown as
psql timed out at /usr/share/perl5/vendor_perl/IPC/Run.pm line 2961.

And that's good to know, I can see as well that the patch is on the CF app:
https://commitfest.postgresql.org/13/
And that it has been marked as ready for committer.
--
Michael


From: ilmari(at)ilmari(dot)org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=)
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: timeouts in PostgresNode::psql
Date: 2017-02-28 09:12:51
Message-ID: d8jo9xm65m4.fsf@dalvik.ping.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:

> On Mon, Feb 27, 2017 at 11:28 AM, Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:
>
>> Still needs applying to pg9.6 and pg10.
>
> I did not understand at first what you meant, but after looking at the
> commit message of the patch things are clear:
> Newer Perl or IPC::Run versions default to appending the filename to string
> exceptions, e.g. the exception
> psql timed out
> is thrown as
> psql timed out at /usr/share/perl5/vendor_perl/IPC/Run.pm line 2961.
>
> And that's good to know, I can see as well that the patch is on the CF app:
> https://commitfest.postgresql.org/13/
> And that it has been marked as ready for committer.

That was me reviewing it, but the email to the list bounced, because the
commitfest app (or the python email.message module, depending on who you
feel like blaming) doesn't handle non-ASCII characters in structured
headers correctly. In my case, it generated the header

From: =?utf-8?q?Dagfinn_Ilmari_Manns=C3=A5ker_=3Cilmari=40ilmari=2Eorg=3E?=\n\n

when it should have been

From: =?utf-8?q?Dagfinn_Ilmari_Manns=C3=A5ker?= <ilmari(at)ilmari(dot)org>

Anyway, my rewview was as follows:

Tested by copying the timeout example from the PostgresNode docs into a
test file and adding an assertion that the variable passed to the
'timed_out' parameter gets set. Without the patch the test script dies
when the timeout occurs, with the patch the test passes.

PostgresNode itself could do with some tests (nothing in the actual
tests seems to use the timeout functionality), but that's for another
patch.

--
"I use RMS as a guide in the same way that a boat captain would use
a lighthouse. It's good to know where it is, but you generally
don't want to find yourself in the same spot." - Tollef Fog Heen


From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: timeouts in PostgresNode::psql
Date: 2017-02-28 12:39:03
Message-ID: 20170228123903.j2726dpeb7vx5ej3@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Paquier wrote:
> On Mon, Feb 27, 2017 at 11:28 AM, Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:

> > Instead of
> >
> > $exc_save !~ /^$timeout_exception.*/
> >
> > I've updated to:
> >
> > $exc_save !~ /^\Q$timeout_exception\E/
> >
> > i.e. don't do an unnecessary wildcard match at the end, and disable
> > metachar interpretation in the substituted range.
> >
> > Still needs applying to pg9.6 and pg10.
>
> I did not understand at first what you meant, but after looking at the
> commit message of the patch things are clear:
> Newer Perl or IPC::Run versions default to appending the filename to string
> exceptions, e.g. the exception
> psql timed out
> is thrown as
> psql timed out at /usr/share/perl5/vendor_perl/IPC/Run.pm line 2961.

Hmm, I think this is really a bugfix that we should backpatch all the
way back to where we introduced PostgresNode.

Lately I've been wondering about backpatching the whole TAP test
infrastructure, all the way back. As we notice bugs, it's really useful
to use newly added tests in all branches; but currently PostgresNode
doesn't work with old branches, particularly since the '-w' switch was
removed from pg_ctl invokations in PostgresNode->start and ->restart
methods -- (the test just fail without any indication of what is going
on).

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: timeouts in PostgresNode::psql
Date: 2017-02-28 15:25:56
Message-ID: 28e2fbf9-9e49-b2c2-b686-192236bb217c@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 02/28/2017 07:39 AM, Alvaro Herrera wrote:
> Lately I've been wondering about backpatching the whole TAP test
> infrastructure, all the way back. As we notice bugs, it's really useful
> to use newly added tests in all branches; but currently PostgresNode
> doesn't work with old branches, particularly since the '-w' switch was
> removed from pg_ctl invokations in PostgresNode->start and ->restart
> methods -- (the test just fail without any indication of what is going
> on).
>

+1

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: timeouts in PostgresNode::psql
Date: 2017-03-01 09:16:56
Message-ID: CAMsr+YGX0NEiviy1FyPUiQd0FiDXBJSg_mwi4Y+oEDAPfXAhvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg스포츠 토토 베트맨SQL

On 28 February 2017 at 20:39, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:

> Lately I've been wondering about backpatching the whole TAP test
> infrastructure, all the way back. As we notice bugs, it's really useful
> to use newly added tests in all branches; but currently PostgresNode
> doesn't work with old branches, particularly since the '-w' switch was
> removed from pg_ctl invokations in PostgresNode->start and ->restart
> methods -- (the test just fail without any indication of what is going
> on).

Yeah. I actually did prepare a backpatch of PostgresNode to 9.5 (with
room to go back further), and it's pretty simple if you don't care
about breaking all existing TAP tests ;)

The irritating bit is that the various TAP stuff introduced earlier
for src/bin and so on uses its own node management plus some helpers
in TestLib. Those helpers went away when we introduced PostgresNode
and they aren't easily emulated because the tests make assumptions
about the directory structure that don't fit well with PostgresNode's
way of doing things.

It's fixable, it just wasn't worth the hassle for what I needed given
that I saw the backport as having minimal chance of getting into core.

I've pushed what I did to
https://github.com/2ndQuadrant/postgres/tree/dev/backport-96-tap-to-95
in case anyone finds it useful.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: timeouts in PostgresNode::psql
Date: 2017-03-01 19:19:36
Message-ID: f6d151c9-f081-5ecb-10b1-e92f3d1b1a08@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg젠 토토SQL :

On 2/26/17 21:28, Craig Ringer wrote:
> Amended patch attached after a few Perl-related comments I got on
> private mail. Instead of
>
> $exc_save !~ /^$timeout_exception.*/
>
> I've updated to:
>
> $exc_save !~ /^\Q$timeout_exception\E/
>
> i.e. don't do an unnecessary wildcard match at the end, and disable
> metachar interpretation in the substituted range.
>
> Still needs applying to pg9.6 and pg10.

committed to master and 9.6

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


From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: timeouts in PostgresNode::psql
Date: 2017-03-01 23:31:36
Message-ID: CAMsr+YEqaNK8D33qSOGdS+UzV_5qh=n+DNNZfxX4NzxASRh1nQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 토토 꽁 머니 페치

On 2 March 2017 at 03:19, Peter Eisentraut
<peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> On 2/26/17 21:28, Craig Ringer wrote:
>> Amended patch attached after a few Perl-related comments I got on
>> private mail. Instead of
>>
>> $exc_save !~ /^$timeout_exception.*/
>>
>> I've updated to:
>>
>> $exc_save !~ /^\Q$timeout_exception\E/
>>
>> i.e. don't do an unnecessary wildcard match at the end, and disable
>> metachar interpretation in the substituted range.
>>
>> Still needs applying to pg9.6 and pg10.
>
> committed to master and 9.6

Thanks.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services