Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahJ0Z-0002C8-Hv for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Mar 2016 15:41:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ahJ0Z-0001JU-4T for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Mar 2016 15:41:43 +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 1ahJ0X-0001IX-JG for pgsql-hackers@postgresql.org; Sat, 19 Mar 2016 15:41:41 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1ahJ0R-0001t5-Bs for pgsql-hackers@postgresql.org; Sat, 19 Mar 2016 15:41:40 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [181.226.147.139]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 2394C400966; Sat, 19 Mar 2016 08:41:22 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 8AEBE5C4; Sat, 19 Mar 2016 12:41:19 -0300 (CLT) Date: Sat, 19 Mar 2016 12:41:19 -0300 From: Alvaro Herrera To: Fabien COELHO Cc: Michael Paquier , "pgsql-hackers@postgresql.org" Subject: Re: pgbench stats per script & other stuff Message-ID: <20160319154119.GA244910@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.1 (-) 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 I pushed your 25, with some additional minor tweaks. I hope I didn't break anything; please test. Fabien COELHO wrote: > >I don't "prefer" memory leaks -- I prefer interfaces that make sense. > > C is not designed to return two things, and if it is what is needed it looks > awkward whatever is done. The static variable trick is dirty, but it is the > minimal fuss solution, IMO. So we are only trading awkward code against > awkward code. That's true. > I have very little time available, so I'm trying to minimize the effort. > I've tried "argue my point with committers", but it has proven very > ineffective. I've switched to "do whatever is asked if it still works", but > it is not very effective either. I understand. Sometimes arguing is better, if you can convince the other person, but sometimes the other person disagrees with you or they are just not listening. I don't have any useful advice on what to do, but frequently resigning to do a stupid thing because somebody suggested it leads to bad decisions. > >In fact, with ParsedScript I don't think we need to give a name to the > >anon struct used for builtin scripts. > > It is useful that it has a name so that find_builtin can return it. So it is. I have kept it, but I used the name BuiltinScript rather than script_t. > Version v25 results a script which is then passed as an argument, so it > avoid the dynamic allocation & later free. Maybe it is better. I had to cut > short the error handling if a file does not exists, though, and it passes a > struct by value. Passing structs by value should work fine, and I don't care much about the case that a file doesn't exist. > >No need for N_BUILTIN; we can use lengthof(builtin_script) instead. > > Indeed. "lengthof" does not seem to be standard... ok, it is a macro in some > header file. I really wanted to avoid an ugly sizeof divide hack, but as it > is hidden elsewhere this is fine. Right. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers