Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1abbjl-0001lr-I5 for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Mar 2016 22:28:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1abbjl-0005La-4c for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Mar 2016 22:28:49 +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) (envelope-from ) id 1abbiQ-0003rD-25 for pgsql-hackers@postgresql.org; Thu, 03 Mar 2016 22:27:26 +0000 Received: from out.smtp-auth.no-ip.com ([8.23.224.60]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1abbiL-0006qn-QF for pgsql-hackers@postgresql.org; Thu, 03 Mar 2016 22:27:23 +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 [186.37.18.101]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id F3ABB401513; Thu, 3 Mar 2016 14:27:00 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 8565874B; Thu, 3 Mar 2016 19:26:40 -0300 (CLT) Date: Thu, 3 Mar 2016 19:26:40 -0300 From: Alvaro Herrera To: Fabien COELHO Cc: Michael Paquier , "pgsql-hackers@postgresql.org" Subject: Re: pgbench stats per script & other stuff Message-ID: <20160303222640.GA667644@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 looked at 19.d and I think the design has gotten pretty convoluted. I think we could simplify with the following changes: struct script_t gets a new member, of type Command **, which is initially null. function process_builtin receives the complete script_t (not individual memebers of it) constructs the Command ** array and puts it in script_t's new member; return value is the same script_t struct it got (except it's now augmented with the Command **array). function process_file constructs a new script_t from the string list, creates its Command **array just like process_builtin and returns the constructed struct. function addScript receives script_t instead of individual members of it, and does the appropriate thing. Alternatively, we could have a different struct that's defined to carry only the Command ** array (not the command string array) and is returned by both process_builtin and process_file. Perhaps we could also put the script weight in there. With this arrangement we don't need to typedef script_t at all and we can just keep it as an anonymous struct as today. This is what I tried to describe earlier, but obviously I wasn't clear enough. Thanks, -- Á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