Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ] - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]
Date
Msg-id CAA4eK1+i_sw6A3Y5AYnBmVBZBdYVLetqsg5tZS6at6f0-HNa7g@mail.gmail.com
Whole thread Raw
In response to Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]  (Dilip kumar <dilip.kumar@huawei.com>)
Responses Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]
Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]
List pgsql-hackers
On Tue, Oct 7, 2014 at 11:10 AM, Dilip kumar <dilip.kumar@huawei.com> wrote:
>
> On 26 September 2014 12:24, Amit Kapila Wrote,
>
> >I don't think this can handle cancel requests properly because
>
> >you are just setting it in GetIdleSlot() what if the cancel
>
> >request came during GetQueryResult() after sending sql for
>
> >all connections (probably thats the reason why Jeff is not able
>
> >to cancel the vacuumdb when using parallel option).
>
>  
>
> You are right, I have fixed, it in latest patch, please check latest patch @ (4205E661176A124FAF891E0A6BA9135266363710@szxeml509-mbs.china.huawei.com)
>


***************
*** 358,363 **** handle_sigint(SIGNAL_ARGS)
--- 358,364 ----

  /* Send QueryCancel if we are processing a database query */
  if (cancelConn != NULL)
  {
+ inAbort = true;
  if (PQcancel(cancelConn, errbuf, sizeof(errbuf)))
  fprintf(stderr, _("Cancel request sent\n"));
  else

Do we need to set inAbort flag incase PQcancel is successful?
Basically if PQCancel fails due to any reason, I think behaviour
can be undefined as the executing thread can assume that cancel is
done.

*** 391,396 **** consoleHandler(DWORD dwCtrlType)
--- 392,399 ----
  EnterCriticalSection
(&cancelConnLock);
  if (cancelConn != NULL)
  {
+ inAbort = 
true;

You have set this flag in case of windows handler, however the same
is never used incase of windows, are you expecting any use of this
flag for windows?

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Function array_agg(array)
Next
From: Alvaro Herrera
Date:
Subject: Re: [PATCH] Support for Array ELEMENT Foreign Keys