Re: asynchronous execution

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: ah(at)cybertec(dot)at
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: asynchronous execution
Date: 2017-07-25 09:11:25
Message-ID: 20170725.181125.53006939.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

8bf58c0d9bd33686 badly conflicts with this patch, so I'll rebase
this and added a patch to refactor the function that Anotonin
pointed. This would be merged into 0002 patch.

At Tue, 18 Jul 2017 16:24:52 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote in <20170718(dot)162452(dot)221576658(dot)horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
> I'll put an upper limit to the number of waiters processed at
> once. Then add a comment like that.
>
> > Actually the reason I thought of simplification was that I noticed small
> > inefficiency in the way you do the compaction. In particular, I think it's not
> > always necessary to swap the tail and head entries. Would something like this
> > make sense?
>
> I'm not sure, but I suppose that it is rare that all of the first
> many elements in the array are not COMPLETE. In most cases the
> first element gets a response first.
...
> Yeah, but maybe the "head" is still confusing even if reversed
> because it is still not a head of something. It might be less
> confusing by rewriting it in more verbose-but-straightforwad way.
>
>
> | int npending = 0;
> |
> | /* Skip over not-completed items at the beginning */
> | while (npending < estate->es_num_pending_async &&
> | estate->es_pending_async[npending] != ASYNCREQ_COMPLETE)
> | npending++;
> |
> | /* Scan over the rest for not-completed items */
> | for (i = npending + 1 ; i < estate->es_num_pending_async; ++i)
> | {
> | PendingAsyncRequest *tmp;
> | PendingAsyncRequest *curr = estate->es_pending_async[i];
> |
> | if (curr->state == ASYNCREQ_COMPLETE)
> | continue;
> |
> | /* Move the not-completed item to the tail of the first chunk */
> | tmp = estate->es_pending_async[i];
> | estate->es_pending_async[nepending] = tmp;
> | estate->es_pending_async[i] = tmp;
> | ++npending;
> | }

The last patch does something like this (with apparent bugs
fixed)

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Allow-wait-event-set-to-be-registered-to-resource-ow.patch text/x-patch 9.4 KB
0002-Asynchronous-execution-framework.patch text/x-patch 46.9 KB
0003-Make-postgres_fdw-async-capable.patch text/x-patch 51.7 KB
0004-Apply-unlikely-to-suggest-synchronous-route-of-ExecA.patch text/x-patch 1.3 KB
0005-Refactor-ExecAsyncEventLoop.patch text/x-patch 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rajkumar Raghuwanshi 2017-07-25 09:32:39 Re: UPDATE of partition key
Previous Message Oleg Bartunov 2017-07-25 08:33:59 Re: [PATCH] Pageinspect - add functions on GIN and GiST indexes from gevel