Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQHbo-0003KN-5U for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Jun 2017 18:22:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dQHbn-0005NY-Mz for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Jun 2017 18:22:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dQHbl-0005G7-By for pgsql-hackers@postgresql.org; Wed, 28 Jun 2017 18:22:33 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dQHbh-00033Q-Fy for pgsql-hackers@postgresql.org; Wed, 28 Jun 2017 18:22:32 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 0E96F460EE; Wed, 28 Jun 2017 20:22:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id P7_nPvPB3wob; Wed, 28 Jun 2017 20:22:25 +0200 (CEST) From: Antonin Houska To: Kyotaro HORIGUCHI cc: pgsql-hackers@postgresql.org Subject: Re: asynchronous execution In-reply-to: <20170622.141720.190958545.horiguchi.kyotaro@lab.ntt.co.jp> References: <20170404.192539.29699823.horiguchi.kyotaro@lab.ntt.co.jp> <20170522.131214.20936668.horiguchi.kyotaro@lab.ntt.co.jp> <20170522.142253.40733906.horiguchi.kyotaro@lab.ntt.co.jp> <20170622.141720.190958545.horiguchi.kyotaro@lab.ntt.co.jp> Comments: In-reply-to Kyotaro HORIGUCHI message dated "Thu, 22 Jun 2017 14:17:20 +0900." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 28 Jun 2017 20:22:24 +0200 Message-ID: <392.1498674144@localhost> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Kyotaro HORIGUCHI wrote: > The patch got conflicted. This is a new version just rebased to > the current master. Furtuer amendment will be taken later. Just one idea that I had while reading the code. In ExecAsyncEventLoop you iterate estate->es_pending_async, then move the complete requests to the end and finaly adjust estate->es_num_pending_async= so that the array no longer contains the complete requests. I think the point = is that then you can add new requests to the end of the array. I wonder if a set (Bitmapset) of incomplete requests would make the code mo= re efficient. The set would contain position of each incomplete request in estate->es_num_pending_async (I think it's the myindex field of PendingAsyncRequest). If ExecAsyncEventLoop used this set to retrieve the requests subject to ExecAsyncNotify etc, then the compaction of estate->es_pending_async wouldn't be necessary. ExecAsyncRequest would use the set to look for space for new requests by iterating it and trying to find the first gap (which corresponds to complet= ed request). And finally, item would be removed from the set at the moment the request state is being set to ASYNCREQ_COMPLETE. --=20 Antonin Houska Cybertec Sch=C3=B6nig & Sch=C3=B6nig GmbH Gr=C3=B6hrm=C3=BChlgasse 26 A-2700 Wiener Neustadt Web: http://www.postgresql-support.de, http://www.cybertec.at --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers