Re: pgbench randomness initialization

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench randomness initialization
Date: 2018-03-05 12:01:39
Message-ID: alpine.DEB.2.20.1803040921300.12500@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello Chapman,

Here is v9.

> It needs s/explicitely/explicitly/ in the docs.


> The parsing of the seed involves matters of taste, I guess: if it were a
> signed int, then sscanf's built-in %i would do everything those three
> explicit hex/octal/decimal branches do, but there's no unsigned version
> of %i. Then there's strtoul(..., base=0), which accepts the same choice
> of bases, but there's no unsigned-int-width version of that. Maybe it
> would still look cleaner to use strtoul and just check that the result
> fits in unsigned int? As I began, it comes down to taste ... this code
> does work.

I must admit that I'm not too happy with the result as well, so I dropped
the octal/hexadecimal parsing.

> I am not sure about the "idem for :random_seed" part: Does this mean that a value
> could be given with -Drandom_seed on the command line, and become the value
> of :random_seed, possibly different from the value given to --random-seed?
> Is that intended? (Perhaps it is; I'm merely asking.)

The "idem" is about setting the variable but not overwritting it if it
already exists. The intention is that :random_seed is the random seed,
unless the user set it to something else in which case it is the user's
value. I've improved the variable description in the doc to point out that
the value may be overwritten with -D.


Attachment Content-Type Size
pgbench-seed-9.patch text/plain 12.2 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2018-03-05 12:08:44 Re: [HACKERS] Re: [COMMITTERS] pgsql: Remove pgbench "progress" test pending solution of its timing is (fwd)
Previous Message Stephen Frost 2018-03-05 11:53:28 Re: [PATCH] Verify Checksums during Basebackups