Thread

Commits

  1. pgbench: Fix overflow in table populating when rows >= 2^31-1

  2. pgbench: Use COPY for client-side data generation

  1. Fixing pgbench init overflow

    John H <johnhyvr@gmail.com> — 2023-12-22T23:18:16Z

    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.
    
    -- 
    John Hsu - Amazon Web Services
    
  2. Re: Fixing pgbench init overflow

    Japin Li <japinli@hotmail.com> — 2023-12-23T05:23:44Z

    On Sat, 23 Dec 2023 at 07:18, Chen Hao Hsu <johnhyvr@gmail.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?
    
    --
    Regrads,
    Japin Li
    ChengDu WenWu Information Technology Co., Ltd.
    
    
    
    
  3. Re: Fixing pgbench init overflow

    Tatsuo Ishii <ishii@sraoss.co.jp> — 2023-12-23T07:22:07Z

     <ME3P282MB316684190982F54BDBD4FE90B69BA@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM>
    
    > 
    > On Sat, 23 Dec 2023 at 07:18, Chen Hao Hsu <johnhyvr@gmail.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.
    
    Best reagards,
    --
    Tatsuo Ishii
    SRA OSS LLC
    English: http://www.sraoss.co.jp/index_en/
    Japanese:http://www.sraoss.co.jp
    
    
    
    
  4. Re: Fixing pgbench init overflow

    Japin Li <japinli@hotmail.com> — 2023-12-23T07:37:33Z

    On Sat, 23 Dec 2023 at 15:22, Tatsuo Ishii <ishii@sraoss.co.jp> wrote:
    >  <ME3P282MB316684190982F54BDBD4FE90B69BA@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM>
    >
    >>
    >> On Sat, 23 Dec 2023 at 07:18, Chen Hao Hsu <johnhyvr@gmail.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.
    
    
  5. Re: Fixing pgbench init overflow

    Michael Paquier <michael@paquier.xyz> — 2023-12-24T01:41:34Z

    On Sat, Dec 23, 2023 at 03:37:33PM +0800, Japin Li wrote:
    > Thanks for you confirmation! Please consider the v2 patch to review.
    
    This oversight is from me via commit e35cc3b3f2d0.  I'll take care of
    it.  Thanks for the report!
    --
    Michael