Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpDj8-0002Qh-On for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Aug 2018 14:21:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fpDj6-0005i4-Uv for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Aug 2018 14:21:44 +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.89) (envelope-from ) id 1fpDj6-0005hx-Iv for pgsql-hackers@lists.postgresql.org; Mon, 13 Aug 2018 14:21:44 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fpDiz-0007UX-7v for pgsql-hackers@postgresql.org; Mon, 13 Aug 2018 14:21:44 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 1E81D21C1CF9; Mon, 13 Aug 2018 17:21:36 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from mail.postgrespro.ru (cyclops.l.postgrespro.ru [192.168.27.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id DDC4721C1CF8; Mon, 13 Aug 2018 17:21:35 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1534170095; bh=BY57j6+q+fUae465NUzuNTsU4THmvDS8+FAQ6HJGY7U=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=mXa8gQtJtcsMcv8wr2GWa3v2QHLrwU4MkgRhLKFB4DcblqVpvFVUrU6w+FWSohpgV ACCaMMubZI7yXGKJKu9FSxlNc/fPhI8kvH6L+Vnl2CXfv6LwIw799rtFqnl1MJsR+P MDWdsmv3Snus9A4NI8vS2a5Gpw1IUJ+IqXdqcwPc= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 13 Aug 2018 17:21:35 +0300 From: Marina Polyakova To: Fabien COELHO Cc: pgsql-hackers@postgresql.org, Alvaro Herrera , Ildus Kurbangaliev , Teodor Sigaev Subject: Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors Organization: Postgres Professional In-Reply-To: References: <20180508193621.dphlgwrd5yz67o2z@alvherre.pgsql> <0569c5309cf536a839e2a3a1433bd113@postgrespro.ru> <976a25a46420c93866ada4051976b1be@postgrespro.ru> <25d7b1f518c218a8c335bdfc6c858ea1@postgrespro.ru> Message-ID: X-Sender: m.polyakova@postgrespro.ru User-Agent: Roundcube Webmail/1.2.4 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12-08-2018 12:14, Fabien COELHO wrote: > HEllo Marina, Hello, Fabien! >> v10-0003-Pgbench-errors-use-the-Variables-structure-for-c.patch >> - a patch for the Variables structure (this is used to reset client >> variables during the repeating of transactions after >> serialization/deadlock failures). > > This patch adds an explicit structure to manage Variables, which is > useful to reset these on pgbench script retries, which is the purpose > of the whole patch series. > > About part 3: > > Patch applies cleanly, On 12-08-2018 12:17, Fabien COELHO wrote: >> About part 3: >> >> Patch applies cleanly, > > I forgot: compiles, global & local "make check" are ok. I'm glad to hear it :-) > * typo in comments: "varaibles" I'm sorry, I'll fix it. > * About enlargeVariables: > > multiple INT_MAX error handling looks strange, especially as this code > can never be triggered because pgbench would be dead long before > having allocated INT_MAX variables. So I would not bother to add such > checks. > ... > I'm not sure that the size_t cast here and there are useful for any > practical values likely to be encountered by pgbench. Looking at the code of the functions, for example, ParseScript and psql_scan_setup, where the integer variable is used for the size of the entire script - ISTM that you are right.. Therefore size_t casts will also be removed. > ISTM that if something is amiss it will fail in pg_realloc anyway. IIUC and physical RAM is not enough, this may depend on the size of the swap. > Also I do not like the ExpBuf stuff, as usual. > The exponential allocation seems overkill. I'd simply add a constant > number of slots, with a simple rule: > > /* reallocated with a margin */ > if (max_vars < needed) max_vars = needed + 8; > > So in the end the function should be much simpler. Ok! -- Marina Polyakova Postgres Professional: http://www.postgrespro.com The Russian Postgres Company