Re: pgbench randomness initialization - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: pgbench randomness initialization
Date
Msg-id alpine.DEB.2.20.1803040921300.12500@lancre
Whole thread Raw
In response to Re: pgbench randomness initialization  (Chapman Flack <chap@anastigmatix.net>)
Responses Re: Re: pgbench randomness initialization  (Chapman Flack <chap@anastigmatix.net>)
List pgsql-hackers
Hello Chapman,

Here is v9.

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

Done.

> 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.

-- 
Fabien.
Attachment

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: [PATCH] Verify Checksums during Basebackups
Next
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] Re: [COMMITTERS] pgsql: Remove pgbench "progress" testpending solution of its timing is (fwd)