Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dy3fd-0004sO-GJ for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Sep 2017 22:22:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dy3fc-0000BQ-Rd for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Sep 2017 22:22:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dy3fb-0000AQ-Sz for pgsql-hackers@postgresql.org; Fri, 29 Sep 2017 22:22:08 +0000 Received: from boipeva.ensmp.fr ([194.214.158.136] helo=cc-tupan-roaming-b.ensmp.fr) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dy3fY-0001Kc-Gk for pgsql-hackers@postgresql.org; Fri, 29 Sep 2017 22:22:06 +0000 Received: from cri.ensmp.fr (13.237.219.88.rev.sfr.net [88.219.237.13]) (authenticated bits=0) by cc-tupan-roaming-b.ensmp.fr (8.15.2/8.15.2/JMMC-22/Oct/2013) with ESMTPSA id v8TMLnIr024012 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 30 Sep 2017 00:21:50 +0200 Date: Sat, 30 Sep 2017 00:21:49 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@lancre To: Robert Haas cc: Jeff Janes , Heikki Linnakangas , Tom Lane , Michael Paquier , PostgreSQL Developers Subject: Re: pgbench - minor fix for meta command only scripts In-Reply-To: Message-ID: References: <6016.1468357163@sss.pgh.pa.us> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Miltered: at cc-tupan-roaming-b.ensmp.fr with ID 59CEC77D.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Auth: USER-ID fabien.coelho X-j-chkmail-Enveloppe: 59CEC77D.000 from 13.237.219.88.rev.sfr.net/13.237.219.88.rev.sfr.net/88.219.237.13/cri.ensmp.fr/ 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 Hello Robert, >> ISTM that this bug exists since rate was introduced, so shame on me and >> back-patching should be needed. > > I took a look at this and found that the proposed patch applies > cleanly all the way back to 9.5, but the regression is reported to > have begun with a commit that starts in v10. I haven't probed into > this in any depth, but are we sure that > 12788ae49e1933f463bc59a6efe46c4a01701b76 is in fact where this problem > originated? Yes. I just rechecked that the problem occurs at 12788ae but not at the preceding da6c4f6ca8. Now the situation before the restructuring is that it worked but given the spaghetti code it was very hard to guess why, not to fix issues when not... My late at night fuzzy interpretation is as follows: The issue is in the code above the fix I submitted which checks what has to be selected. In the previous version ISTM that the condition was laxed, so it filled the input_mask even if the client was not waiting for anything, so it was calling select later which was really just implementing the timeout. With the updated version the input mask and maxsock is only set if there is really something to wait, and if not then it fall through and is active instead of doing a simple sleep/timeout. So I would say that the previous version worked because of a side effect which may or may not have been intentional at the time, and was revealed by checking the condition better. Basically I'd say that the restructuring patch fixed a defect which triggered the bug. Programming is fun:-) -- Fabien. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers