Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aJm7x-0000t1-JW for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jan 2016 17:56:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aJm7w-0002nB-PK for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jan 2016 17:56:04 +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) (envelope-from ) id 1aJm7u-0002iu-Hf for pgsql-hackers@postgresql.org; Thu, 14 Jan 2016 17:56:02 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aJm7o-0002e7-1Q for pgsql-hackers@postgresql.org; Thu, 14 Jan 2016 17:56:02 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id B5772860003; Thu, 14 Jan 2016 18:55:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-5.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p54BEB543.dip0.t-ipconnect.de [84.190.181.67]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 3D2F1860002; Thu, 14 Jan 2016 18:55:52 +0100 (CET) Received: by anarazel.de (Postfix, from userid 1000) id BDF88102B26; Thu, 14 Jan 2016 18:55:51 +0100 (CET) Date: Thu, 14 Jan 2016 18:55:51 +0100 From: Andres Freund To: Robert Haas Cc: Tom Lane , =?utf-8?B?0JLQsNGB0LjQu9GM0LXQsiDQlNC80LjRgtGA0LjQuQ==?= , "pgsql-hackers@postgresql.org" Subject: Re: Performance degradation in commit ac1d794 Message-ID: <20160114175551.GM10941@awork2.anarazel.de> References: <20151225211326.z4umuafvv27nczya@alap3.anarazel.de> <24833.1451078993@sss.pgh.pa.us> <20151226112248.uv3qxmroe4va7wke@alap3.anarazel.de> <20160114143931.GG10941@awork2.anarazel.de> <20160114155617.GI10941@awork2.anarazel.de> <20160114170604.GJ10941@awork2.anarazel.de> <20160114171421.GK10941@awork2.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160114171421.GK10941@awork2.anarazel.de> X-Pg-Spam-Score: -4.2 (----) 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 On 2016-01-14 18:14:21 +0100, Andres Freund wrote: > On 2016-01-14 12:07:23 -0500, Robert Haas wrote: > > > Do we want to provide a backward compatible API for all this? I'm fine > > > either way. > > > > How would that work? > > I'm thinking of something like; > > int WaitOnLatchSet(LatchEventSet *set, int wakeEvents, long timeout); > > int > WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,long timeout) > { > LatchEventSet set; > > LatchEventSetInit(&set, latch); > > if (sock != PGINVALID_SOCKET) > LatchEventSetAddSock(&set, sock); > > return WaitOnLatchSet(set, wakeEvents, timeout); > } > > I think we'll need to continue having wakeEvents and timeout parameters > for WaitOnLatchSet, we quite frequently want to wait socket > readability/writability, not wait on the socket, or have/not have > timeouts. Hm. If we really want to support multiple sockets at some point the above WaitOnLatchSet signature isn't going to fly, because it won't support figuring out which fd the event this triggered on. So it seems we'd need to return something like struct LatchEvent { enum LatchEventType {WL_LATCH_EVENT;WL_TIMEOUT;WL_SOCKET_EVENT; WL_POSTMASTER_EVENT;...} event_type; int mask; pgsocket event_sock; }; that'd also allow to extend this to return multiple events if we want that at some point. Alternatively we could add a pgsocket* argument, but that doesn't really seem much better. Not super happy about the above proposal. Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers