Re: Parallel query hangs after a smart shutdown is issued

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Arseny Sher <a(dot)sher(at)postgrespro(dot)ru>
Subject: Re: Parallel query hangs after a smart shutdown is issued
Date: 2020-08-14 14:32:15
Message-ID: 574068.1597415535@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> On Fri, Aug 14, 2020 at 4:45 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> After some more rethinking and testing, here's a v5 that feels
>> fairly final to me. I realized that the logic in canAcceptConnections
>> was kind of backwards: it's better to check the main pmState restrictions
>> first and then the smart-shutdown restrictions afterwards.

> LGTM. I tested this a bit today and it did what I expected for
> parallel queries and vacuum, on primary and standby.

Thanks for reviewing! I'll do the back-patching and push this today.

>> I'm assuming we want to back-patch this as far as 9.6, where parallel
>> query began to be a thing.

> Yeah. I mean, it's more radical than what I thought we'd be doing for
> this, but you could get into real trouble by running in smart shutdown
> mode without the autovac infrastructure alive.

Right. 99.99% of the time, that early shutdown doesn't really cause
any problems, which is how we've gotten away with it this long. But if
someone did leave session(s) running for a long time after issuing the
SIGTERM, the results could be bad --- and there's no obvious benefit
to the early shutdowns anyway.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-08-14 14:40:50 Re: Inconsistent behavior of smart shutdown handling for queries with and without parallel workers
Previous Message Dmitry Dolgov 2020-08-14 13:56:32 Re: Autonomous database is coming to Postgres?