Re: BackgroundPsql's set_query_timer_restart() may not work

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BackgroundPsql's set_query_timer_restart() may not work
Date: 2023-11-28 06:28:27
Message-ID: CALj2ACUfthqkmLwnH12u3OjErRGmZe6fEaDh6Riq11AdgHRQaw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 28, 2023 at 6:48 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> Hi,
>
> While adding some TAP tests, I realized that set_query_timer_restart()
> in BackgroundPsql may not work. Specifically, it seems not to work
> unless we pass an argument to the function. Here is the test script I
> used:
>
> If calling set_query_timer_restart() works properly, this test would
> pass since we reset the query timeout before executing the second
> pg_sleep(3). However, this test fail on my environment unless I use
> set_query_timer_restart(1) (i.e. passing something to the function).

Right.

> Currently authentication/t/001_password.pl is the sole user of
> set_query_timer_restart() function. I think we should define a value
> to query_timer_restart in set_query_timer_restart() function even if
> no argument is passed, like the patch attached, or we should change
> the caller to pass 1 to the function.

It is added by commit 664d7575 and I agree that calling the function
without argument doesn't reset the query_timer_restart as intended.

A nitpick on the patch - how about honoring the passed-in parameter
with something like $self->{query_timer_restart} = 1 if !defined
$self->{query_timer_restart}; instead of just setting it to 1 (a value
other than undef) $self->{query_timer_restart} = 1;?

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2023-11-28 06:45:28 Re: [PATCH] pg_convert improvement
Previous Message Ilya Kosmodemiansky 2023-11-28 06:14:38 Re: PostgreSql: Canceled on conflict out to old pivot