Re: strange parallel query behavior after OOM crashes - Mailing list pgsql-hackers

From Neha Khatri
Subject Re: strange parallel query behavior after OOM crashes
Date
Msg-id CAFO0U+8P+5i0rRBya2n-qPLWMoJaaKMYV-PRbPZKGUbWUfMKgA@mail.gmail.com
Whole thread Raw
In response to Re: strange parallel query behavior after OOM crashes  (Kuntal Ghosh <kuntalghosh.2007@gmail.com>)
Responses Re: strange parallel query behavior after OOM crashes  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Wed, Apr 5, 2017 at 5:34 PM, Kuntal Ghosh <kuntalghosh.2007@gmail.com> wrote:
On Tue, Apr 4, 2017 at 12:16 PM, Neha Khatri <nehakhatri5@gmail.com> wrote:

> I feel there should be an assert if
>     (BackgroundWorkerData->parallel_register_count -
> BackgroundWorkerData->parallel_terminate_count) > max_parallel_workers)
>
Backend 1 > SET max_parallel_worker = 8;
Backend 1 > Execute a long running parallel query q1 with number of
parallel worker spawned is say, 4.
Backend 2> SET max_parallel_worker = 3;
Backend 2 > Execute a long running parallel query q2 with number of
parallel worker spawned > 0.

The above assert statement will bring down the server unnecessarily
while executing q2.

Right, with multiple backends trying to fiddle with max_parallel_workers, that might bring the server down with the said assert:
    Assert(parallel_register_count - parallel_terminate_count <= max_parallel_workers)

The problem here seem to be the change in the max_parallel_workers value while the parallel workers are still under execution. So this poses two questions:

1. From usecase point of view, why could there be a need to tweak the max_parallel_workers exactly at the time when the parallel workers are at play.
2. Could there be a restriction on tweaking of max_parallel_workers while the parallel workers are at play? At least do not allow setting the max_parallel_workers less than the current # of active parallel workers.

Regards,
Neha


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: pgbench - allow to store select results intovariables
Next
From: Tom Lane
Date:
Subject: Re: pgbench - allow to store select results into variables