Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]

From: Dilip kumar <dilip(dot)kumar(at)huawei(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Jan Lentfer <Jan(dot)Lentfer(at)web(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Euler Taveira <euler(at)timbira(dot)com(dot)br>
Subject: Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]
Date: 2014-10-28 03:33:50
Message-ID: 4205E661176A124FAF891E0A6BA9135266368E82@szxeml509-mbs.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-10-28 03:48:27 Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]
Previous Message Michael Paquier 2014-10-28 02:15:43 Re: Better support of exported snapshots with pg_dump