Re: strange parallel query behavior after OOM crashes

From: Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: strange parallel query behavior after OOM crashes
Date: 2017-04-03 10:08:56
Message-ID: CAGz5QCJ1MEKYzGnOJxWHK039ToKQVnj=BrT7BiQiAzH-jTgZrA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 31, 2017 at 6:50 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Thu, Mar 30, 2017 at 4:35 PM, Kuntal Ghosh
> <kuntalghosh(dot)2007(at)gmail(dot)com> wrote:
>> 2. the server restarts automatically, initialize
>> BackgroundWorkerData->parallel_register_count and
>> BackgroundWorkerData->parallel_terminate_count in the shared memory.
>> After that, it calls ForgetBackgroundWorker and it increments
>> parallel_terminate_count.
>
> Hmm. So this seems like the root of the problem. Presumably those
> things need to be reset AFTER forgetting any background workers from
> before the crash.
>
IMHO, the fix would be not to increase the terminated parallel worker
count whenever ForgetBackgroundWorker is called due to a bgworker
crash. I've attached a patch for the same. PFA.

--
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
0001-Fix-parallel-worker-counts-after-a-crash.patch binary/octet-stream 1.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-04-03 10:28:36 Re: Partitioning vs ON CONFLICT
Previous Message Daniel Gustafsson 2017-04-03 09:58:05 Refactoring identifier checks to consistently use strcmp