Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4cTr-0008Kj-69 for pgsql-hackers@arkaria.postgresql.org; Sat, 17 Jul 2021 05:03:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m4cTq-00038p-5X for pgsql-hackers@arkaria.postgresql.org; Sat, 17 Jul 2021 05:03:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4cTp-00038h-UB for pgsql-hackers@lists.postgresql.org; Sat, 17 Jul 2021 05:03:13 +0000 Received: from sfr-1.cri.mines-paristech.fr ([77.158.180.225] helo=smtp.cri.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4cTl-00023d-ID for pgsql-hackers@postgresql.org; Sat, 17 Jul 2021 05:03:12 +0000 Received: from pseudo (6.86.7.84.rev.sfr.net [84.7.86.6]) by smtp.cri.ensmp.fr (Postfix) with ESMTPSA id C1400C01AF; Sat, 17 Jul 2021 07:05:09 +0200 (CEST) Date: Sat, 17 Jul 2021 07:03:01 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@pseudo To: Yugo NAGATA cc: pgsql-hackers@postgresql.org Subject: Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error In-Reply-To: <20210716153013.fc53b1c780b06fccc07a7f0d@sraoss.co.jp> Message-ID: References: <20210716153013.fc53b1c780b06fccc07a7f0d@sraoss.co.jp> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Yugo-san, > [...] One way to avoid these errors is to send Parse messages before > pipeline mode starts. I attached a patch to fix to prepare commands at > starting of a script instead of at the first execution of the command. > What do you think? ISTM that moving prepare out of command execution is a good idea, so I'm in favor of this approach: the code is simpler and cleaner. ISTM that a minor impact is that the preparation is not counted in the command performance statistics. I do not think that it is a problem, even if it would change detailed results under -C -r -M prepared. Patch applies & compiles cleanly, global & local make check ok. However the issue is not tested. I think that the patch should add a tap test case for the problem being addressed. I'd suggest to move the statement preparation call in the CSTATE_CHOOSE_SCRIPT case. In comments: not yet -> needed. -- Fabien.