Re: Fixing pgbench init overflow

From: Japin Li <japinli(at)hotmail(dot)com>
To: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
Cc: johnhyvr(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fixing pgbench init overflow
Date: 2023-12-23 07:37:33
Message-ID: ME3P282MB3166308B36EF886931E9BF39B69BA@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Sat, 23 Dec 2023 at 15:22, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> wrote:
> <ME3P282MB316684190982F54BDBD4FE90B69BA(at)ME3P282MB3166(dot)AUSP282(dot)PROD(dot)OUTLOOK(dot)COM>
>
>>
>> On Sat, 23 Dec 2023 at 07:18, Chen Hao Hsu <johnhyvr(at)gmail(dot)com> wrote:
>>> Hello,
>>>
>>> pgbench mixes int and int64 to initialize the tables.
>>> When a large enough scale factor is passed, initPopulateTable
>>> overflows leading to it never completing, ie.
>>>
>>> 2147400000 of 2200000000 tuples (97%) of
>>> pgbench_accounts done (elapsed 4038.83 s, remaining 98.93 s)
>>> -2147400000 of 2200000000 tuples (-97%) of
>>> pgbench_accounts done (elapsed 4038.97 s, remaining -8176.86 s)
>>>
>>>
>>> Attached is a patch that fixes this, pgbench -i -s 22000 works now.
>>
>> I think only the following line can fix this.
>>
>> + int64 k;
>>
>> Do not need to modify the type of `n`, right?
>
> You are right. n represents the return value of pg_snprintf, which is
> the byte length of the formatted data, which is int, not int64.
>

Thanks for you confirmation! Please consider the v2 patch to review.

--
Regrads,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.

Attachment Content-Type Size
v2-0001-Fix-pgbench-init-overflow-when-total-number-of-ro.patch text/x-diff 948 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Will Mortensen 2023-12-23 09:47:40 Re: Exposing the lock manager's WaitForLockers() to SQL
Previous Message Tatsuo Ishii 2023-12-23 07:22:07 Re: Fixing pgbench init overflow