Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVh33-0007O0-QO for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jul 2017 16:33:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dVh33-0005Zp-DB for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jul 2017 16:33:05 +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 1dVh32-0005Yb-BD for pgsql-hackers@postgresql.org; Thu, 13 Jul 2017 16:33:04 +0000 Received: from jiboia.ensmp.fr ([194.214.158.138] helo=cc-tupan-roaming-a.ensmp.fr) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVh2z-00082B-1z for pgsql-hackers@postgresql.org; Thu, 13 Jul 2017 16:33:03 +0000 Received: from cri.ensmp.fr (AGrenoble-653-1-26-96.w90-52.abo.wanadoo.fr [90.52.64.96]) (authenticated bits=0) by cc-tupan-roaming-a.ensmp.fr (8.15.2/8.15.2/JMMC-22/Oct/2013) with ESMTPSA id v6DGWrSj003706 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 13 Jul 2017 18:32:54 +0200 Date: Thu, 13 Jul 2017 18:32:53 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@lancre To: Marina Polyakova cc: PostgreSQL Developers , Kevin Grittner , Andres Freund , Alvaro Herrera , Thomas Munro , Robert Haas Subject: Re: WIP Patch: Pgbench Serialization and deadlock errors In-Reply-To: <6ce8613f061001105654673506348c13@postgrespro.ru> Message-ID: References: <72a0d590d6ba06f242d75c2e641820ec@postgrespro.ru> <6b4a7fb36c9956595a89a08e5368a9c5@postgrespro.ru> <01df6ca86c78e2c80b4e4d021c99d53a@postgrespro.ru> <6ce8613f061001105654673506348c13@postgrespro.ru> 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-a.ensmp.fr with ID 5967A0B5.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: 5967A0B5.000 from AGrenoble-653-1-26-96.w90-52.abo.wanadoo.fr/AGrenoble-653-1-26-96.w90-52.abo.wanadoo.fr/90.52.64.96/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, > [...] I didn't make rollbacks to savepoints after the failure because > they cannot help for serialization failures at all: after rollback to > savepoint a new attempt will be always unsuccessful. Not necessarily? It depends on where the locks triggering the issue are set, if they are all set after the savepoint it could work on a second attempt. >> "SimpleStats attempts": I disagree with using this floating poiunt >> oriented structures to count integers. I would suggest "int64 tries" >> instead, which should be enough for the purpose. > > I'm not sure that it is enough. Firstly it may be several transactions in > script so to count the average attempts number you should know the total > number of runned transactions. Secondly I think that stddev for attempts > number can be quite interesting and often it is not close to zero. I would prefer to have a real motivation to add this complexity in the report and in the code. Without that, a simple int seems better for now. It can be improved later if the need really arises. >> Some variables, such as "int attempt_number", should be in the client >> structure, not in the client? Generally, try to use block variables if >> possible to keep the state clearly disjoints. If there could be NO new >> variable at the doCustom level that would be great, because that would >> ensure that there is no machine state mixup hidden in these variables. > > Do you mean the code cleanup for doCustom function? Because if I do so there > will be two code styles for state blocks and their variables in this > function.. I think that any variable shared between state is a recipee for bugs if it is not reset properly, so they should be avoided. Maybe there are already too many of them, then too bad, not a reason to add more. The status before the automaton was a nightmare. >> I wondering whether the RETRY & FAILURE states could/should be merged: > > I divided these states because if there's a failed transaction block you > should end it before retrying. Hmmm. Maybe I'm wrong. I'll think about it. >> I would suggest a more compact one-line report about failures: >> >> "number of failures: 12 (0.001%, deadlock: 7, serialization: 5)" > > I think, there may be a misunderstanding. Because script can contain several > transactions and get both failures. I do not understand. Both failures number are on the compact line I suggested. -- Fabien. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers