Re: Transaction timeout

From: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Japin Li <japinli(at)hotmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Junwang Zhao <zhjwpku(at)gmail(dot)com>, 邱宇航 <iamqyh(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Andrew Borodin <amborodin86(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Transaction timeout
Date: 2024-03-11 10:52:57
Message-ID: 51D27E3F-B6E7-464B-B36D-6FC1D8E0B118@yandex-team.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 7 Mar 2024, at 00:55, Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> On Wed, Mar 6, 2024 at 10:22 AM Andrey M. Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>>> On 25 Feb 2024, at 21:50, Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>>>
>>> Thank you for the patches. I've pushed the 0001 patch to avoid
>>> further failures on buildfarm. Let 0004 wait till injections points
>>> by Mechael are committed.
>>
>> Thanks!
>>
>> All prerequisites are committed. I propose something in a line with this patch.
>
> Thank you. I took a look at the patch. Should we also check the
> relevant message after the timeout is fired? We could check it in
> psql stderr or log for that.

PFA version which checks log output.
But I could not come up with a proper use of BackgroundPsql->query_until() to check outputs. And there are multiple possible errors.

We can copy test from src/bin/psql/t/001_basic.pl:

# test behavior and output on server crash
my ($ret, $out, $err) = $node->psql('postgres',
"SELECT 'before' AS running;\n"
. "SELECT pg_terminate_backend(pg_backend_pid());\n"
. "SELECT 'AFTER' AS not_running;\n");

is($ret, 2, 'server crash: psql exit code');
like($out, qr/before/, 'server crash: output before crash');
ok($out !~ qr/AFTER/, 'server crash: no output after crash');
is( $err,
'psql:<stdin>:2: FATAL: terminating connection due to administrator command
psql:<stdin>:2: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
psql:<stdin>:2: error: connection to server was lost',
'server crash: error message’);

But I do not see much value in this.
What do you think?

Best regards, Andrey Borodin.

Attachment Content-Type Size
v3-0001-Add-timeouts-TAP-tests.patch application/octet-stream 8.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-03-11 11:06:18 Re: Regardign RecentFlushPtr in WalSndWaitForWal()
Previous Message shveta malik 2024-03-11 10:48:35 Re: Add comment to specify timeout unit in ConditionVariableTimedSleep()