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

From Dilip kumar
Subject Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]
Date
Msg-id 4205E661176A124FAF891E0A6BA9135266368E82@szxeml509-mbs.china.huawei.com
Whole thread
In response to Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]
List pgsql-hackers

On 25 October 2014 17:52, Amit Kapila Wrote,

>***************

>*** 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;

>+

 

In “handle_sigint” function if we are going to cancel the query that time I am setting the flag inAbort (even when it is success), so that in “select_loop” function

If select(maxFd + 1, workerset, NULL, NULL, &tv); come out, we can know whether it came out because of cancel query and handle it accordingly.

 

                i = select(maxFd + 1, workerset, NULL, NULL, NULL);

 

                                if (in_abort())  //loop break because of cancel query, so return fail…

                                {

                                                return -1;

                                }

 

                                if (i < 0 && errno == EINTR)

                                                continue;

 

Regards,

Dilip Kumar

 

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Better support of exported snapshots with pg_dump
Next
From: Amit Kapila
Date:
Subject: Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]