Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ea2hr-0006bg-UL for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jan 2018 17:01:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ea2hr-00078M-Ag for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jan 2018 17:01:27 +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_2) (envelope-from ) id 1ea2hq-00078C-Q9 for pgsql-hackers@lists.postgresql.org; Fri, 12 Jan 2018 17:01:27 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ea2hm-0008Mj-Gn for pgsql-hackers@postgresql.org; Fri, 12 Jan 2018 17:01:25 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id A9FFF21C1C41; Fri, 12 Jan 2018 20:01:19 +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 57D2D21C1C3F; Fri, 12 Jan 2018 20:01:19 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1515776479; bh=e+VP9xkuepL6rDq/lTCElYmix6nfnQEBDxehR5gUXIo=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=J6nz5yEj6hqmqSMMzhiQlHAXrdsdzDrCCsDRmvYPlcfUU2rJBCFa173xw128MderG huuEn4KkYVcbM51EgKpaqe1Yz7Ga3n4lGAet/9c09EGX3vWZS1AnADwu9F3TuNAuNy hQ4TnCFRr12CKt09txKSnCqch5Sq5pWjeR8RLIFo= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 12 Jan 2018 20:01:19 +0300 From: Marina Polyakova To: Fabien COELHO Cc: PostgreSQL Developers , Kevin Grittner , Andres Freund , Alvaro Herrera , Thomas Munro , Robert Haas Subject: Re: WIP Patch: Pgbench Serialization and deadlock errors Organization: Postgres Professional In-Reply-To: References: <894ac29c18f12a4fd6f8c97c9123a152@postgrespro.ru> <372a8e9e65a8c6692e2b58b1f86e81c5@postgrespro.ru> Message-ID: <2794acb0ec4c1cf94fa60c182723490c@postgrespro.ru> 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-01-2018 18:13, Fabien COELHO wrote: > Hello Marina, Hello, Fabien! >>> If you want 2 transactions, then you have to put them in two scripts, >>> which looks fine with me. Different transactions are expected to be >>> independent, otherwise they should be merged into one transaction. >> >> Therefore if the script consists of several single statements (= >> several transactions), you cannot retry them. For example, the script >> looked like this: >> >> UPDATE xy1 SET x = 1 WHERE y = 1; >> UPDATE xy2 SET x = 2 WHERE y = 2; >> UPDATE xy3 SET x = 3 WHERE y = 3; >> >> If this restriction is ok for you, I'll simplify the code :) > > Yes, that is what I'm suggesting. If you want to restart them, you can > put them in 3 scripts. Okay, in the next patch I'll simplify the code. >>> Under these restrictions, ISTM that a retry is something like: >>> ... >> >> If we successfully complete a failed transaction block and process its >> end command in CSTATE_END_COMMAND, we may want to make a retry. So do >> you think that in this case it is ok to go to CSTATE_ABORTED at the >> end of CSTATE_END_COMMAND?.. > > Dunno. > > I'm fine with having END_COMMAND skipping to START_TX if it can be > done easily and cleanly, esp without code duplication. If I understand you correctly, I'm not sure that we should skip the statistics collector for the command that completes a failed transaction block.. + maybe for this command we will have only such statistics. > ISTM that ABORTED & FINISHED are currently exactly the same. That would > put a particular use to aborted. Also, there are many points where the > code may go to "aborted" state, so reusing it could help avoid > duplicating stuff on each abort decision. Thanks, I agree with you. >>> Once this works, maybe it could go a step further by restarting at >>> savepoints. I'd put restrictions there to ease detecting a savepoint >>> so that it cannot occur in a compound command for instance. This >>> would >>> probably require a new state. Fine. >> >> We discussed the savepoints earlier in [1]: > > Yep. I'm trying to suggest an incremental path with simple but yet > quite useful things first. This question ("if there's a failure what savepoint we should rollback to and start the execution again? ...") mostly concerns the basic idea of how to maintain the savepoints in this feature, rather than the exact architecture of the code, so we can discuss this now :) -- Marina Polyakova Postgres Professional: http://www.postgrespro.com The Russian Postgres Company