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 1fnJQ7-0004NE-8P for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Aug 2018 08:02:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fnJQ4-0007Ib-Go for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Aug 2018 08:02:12 +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 1fnJQ4-0007IS-6Q for pgsql-hackers@lists.postgresql.org; Wed, 08 Aug 2018 08:02:12 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fnJPv-0001HM-WB for pgsql-hackers@postgresql.org; Wed, 08 Aug 2018 08:02:11 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 5AE3621C210F; Wed, 8 Aug 2018 11:02:02 +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 2435721C210D; Wed, 8 Aug 2018 11:02:02 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1533715322; bh=b1ikNZlg6OnBT+MGSuI0+lDNj/uvbxEmDSNrfs3sCD0=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=ZfvBhYYgISp/MJOEAi7maQk1tdH+231evVLdnpTyQiUmpC2LaeYS9o3Nw0kY9tJsI ldaCSXSYE9SoRT6w6POdsgh0zUGGGwURKd7ZdPTKUYRyjDX/xDE8TwZwN5cmmgpJoO cSKI4paLxlntUvl1GFOkc1yVbPt4TuZ0XLSXh4v4= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 08 Aug 2018 11:02:01 +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: <58a619e0ba711cda355d152241430d4f@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 07-08-2018 19:21, Fabien COELHO wrote: > Hello Marina, Hello, Fabien! >> v10-0001-Pgbench-errors-use-the-RandomState-structure-for.patch >> - a patch for the RandomState structure (this is used to reset a >> client's random seed during the repeating of transactions after >> serialization/deadlock failures). > > About this v10 part 1: > > Patch applies cleanly, compile, global & local make check both ok. > > The random state is cleanly separated so that it will be easy to reset > it on client error handling ISTM that the pgbench side is > deterministic with > the separation of the seeds for different uses. > > Code is clean, comments are clear. :-) > I'm wondering what is the rational for the "xseed" field name? In > particular, what does the "x" stands for? I called it "...seed" instead of "data" because perhaps the "data" is too general a name for use here (but I'm not entirely sure what Alvaro Herrera meant in [1], see my answer in [2]). I called it "xseed" to combine it with the arguments of the functions _dorand48 / pg_erand48 / pg_jrand48 in the file erand48.c. IIUC they use a linear congruential generator and perhaps "xseed" means the sequence with the name X of pseudorandom values of size 48 bits (X_0, X_1, ... X_n) where X_0 is the seed / the start value. [1] https://www.postgresql.org/message-id/20180711180417.3ytmmwmonsr5lra7@alvherre.pgsql > LGTM, though I'd rename the random_state struct members so that it > wouldn't look as confusing. Maybe that's just me. [2] https://www.postgresql.org/message-id/cb2cde10e4e7a10a38b48e9cae8fbd28%40postgrespro.ru -- Marina Polyakova Postgres Professional: http://www.postgrespro.com The Russian Postgres Company