| From: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> | 
|---|---|
| To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> | 
| Cc: | 'miyake_kouta' <miyake_kouta(at)oss(dot)nttdata(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: [PATCH] pgbench: improve \sleep meta command | 
| Date: | 2021-03-16 16:49:51 | 
| Message-ID: | 5ea3bda5-0930-e6e9-614d-262734126e00@oss.nttdata.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 2021/03/09 0:54, Fujii Masao wrote:
> 
> 
> On 2021/03/08 23:10, Alvaro Herrera wrote:
>> On 2021-Mar-08, kuroda(dot)hayato(at)fujitsu(dot)com wrote:
>>
>>> Dear Fujii-san, Miyake-san
>>>
>>>> Isn't it better to accept even negative sleep time like currently pgbench does?
>>>> Otherwise we always need to check the variable is a positive integer
>>>> (for example, using \if command) when using it as the sleep time in \sleep
>>>> command. That seems inconvenient.
>>>
>>> Both of them are acceptable for me.
>>> But we should write down how it works when the negative value is input if we adopt.
>>
>> Not sleeping at all seems a good reaction (same as for zero, I guess.)
> 
> +1. BTW, IIUC currently \sleep works in that way.
Attached is the updated version of the patch.
Currently a variable whose value is a negative number is allowed to be
specified as a sleep time as follows. In this case \sleep command doesn't
sleep. The patch doesn't change this behavior at all.
     \set hoge -1
     \sleep :hoge s
Currently a variable whose value is a double is allowed to be specified as
a sleep time as follows. In this case the integer value that atoi() converts
the double number into is used as a sleep time. The patch also doesn't
change this behavior at all because I've not found any strong reason to
ban that usage.
     \set hoge 10 / 4.0
     \sleep :hoge s
Regards,
-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
| Attachment | Content-Type | Size | 
|---|---|---|
| v03_pgbench_sleep.patch | text/plain | 2.0 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Avinash Kumar | 2021-03-16 16:50:10 | Re: Postgres crashes at memcopy() after upgrade to PG 13. | 
| Previous Message | Peter Geoghegan | 2021-03-16 16:44:08 | Re: Postgres crashes at memcopy() after upgrade to PG 13. |