Re: The number of character limitation of custom script on pgbench

Lists: pgsql-hackers
From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: The number of character limitation of custom script on pgbench
Date: 2013-11-13 11:18:53
Message-ID: CAD21AoDs-7gyWHqwXvArEjYsToivQdjRVNSpz_pMp0XbLmgPNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

The function of custom script of pgbench allows only BUFSIZ
(i.g.,1024byte) or less as length of a SQL.
I think that when we want to bench mark with long SQL then it will difficult.
At that time even pgbench doesn't return ERROR. It will try to do
query with the broken SQL.
And user can not know why function of custom script is not work fine.
It look as just error of SQL to user.

So I'm thinking following solution.
(1) to increase buffer size
(2) to change to variable buffer size
(3) to return ERROR with information

Thought?

Regards,

-------
Sawada Masahiko


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: The number of character limitation of custom script on pgbench
Date: 2013-11-13 13:23:44
Message-ID: 52837D60.1040604@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 11/13/13, 6:18 AM, Sawada Masahiko wrote:
> Hi all,
>
> The function of custom script of pgbench allows only BUFSIZ
> (i.g.,1024byte) or less as length of a SQL.
> I think that when we want to bench mark with long SQL then it will difficult.
> At that time even pgbench doesn't return ERROR. It will try to do
> query with the broken SQL.
> And user can not know why function of custom script is not work fine.
> It look as just error of SQL to user.
>
> So I'm thinking following solution.
> (1) to increase buffer size
> (2) to change to variable buffer size
> (3) to return ERROR with information

I'd go for #2. But at least an error.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: The number of character limitation of custom script on pgbench
Date: 2013-11-13 13:27:57
Message-ID: 2053.1384349277@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> On 11/13/13, 6:18 AM, Sawada Masahiko wrote:
>> The function of custom script of pgbench allows only BUFSIZ
>> (i.g.,1024byte) or less as length of a SQL.
>> So I'm thinking following solution.
>> (1) to increase buffer size
>> (2) to change to variable buffer size
>> (3) to return ERROR with information

> I'd go for #2. But at least an error.

#2 definitely. I've run into this limitation myself recently, and
so have other people. It's time to fix it.

regards, tom lane


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: The number of character limitation of custom script on pgbench
Date: 2013-11-13 14:15:29
Message-ID: CAD21AoAY7OMsYgMX7YcN4=ap1mFn=kh+ma0+ZXebM2ZyC67bUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Nov 13, 2013 at 10:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> On 11/13/13, 6:18 AM, Sawada Masahiko wrote:
>>> The function of custom script of pgbench allows only BUFSIZ
>>> (i.g.,1024byte) or less as length of a SQL.
>>> So I'm thinking following solution.
>>> (1) to increase buffer size
>>> (2) to change to variable buffer size
>>> (3) to return ERROR with information
>
>> I'd go for #2. But at least an error.
>
> #2 definitely. I've run into this limitation myself recently, and
> so have other people. It's time to fix it.
>

Yes, I also think #2 is good.
I will implement the patch.

Regards,

-------
Sawada Masahiko


From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: The number of character limitation of custom script on pgbench
Date: 2013-11-14 20:06:21
Message-ID: 20131114200621.GA7583@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Sawada Masahiko escribió:

> Yes, I also think #2 is good.
> I will implement the patch.

I remember this was recently discussed in the spanish list. Please see
this email:

http://archives.postgresql.org/message-id/48589.192.168.207.54.1382570043.squirrel@webmail.etecsa.cu

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: The number of character limitation of custom script on pgbench
Date: 2013-11-15 11:47:38
Message-ID: CAD21AoAVr4P++=RXuZoJiHr8FX_3AQKteMjD5d79YKB++JWjdA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Nov 13, 2013 at 10:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> On 11/13/13, 6:18 AM, Sawada Masahiko wrote:
>>> The function of custom script of pgbench allows only BUFSIZ
>>> (i.g.,1024byte) or less as length of a SQL.
>>> So I'm thinking following solution.
>>> (1) to increase buffer size
>>> (2) to change to variable buffer size
>>> (3) to return ERROR with information
>
>> I'd go for #2. But at least an error.
>
> #2 definitely. I've run into this limitation myself recently, and
> so have other people. It's time to fix it.
>

I attached the patch which solves this problem, and have submitted to CF3.
I changed how to get the SQL from custom script file.

Regards,

-------
Sawada Masahiko

Attachment Content-Type Size
fix_limitaion_custom_script_pgbench.patch application/octet-stream 1.5 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: The number of character limitation of custom script on pgbench
Date: 2013-11-16 00:48:06
Message-ID: 32435.1384562886@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> writes:
> I attached the patch which solves this problem, and have submitted to CF3.
> I changed how to get the SQL from custom script file.

This needed a bit of work:

- Use of strncat didn't seem particularly safe, or efficient. I changed
it to explicitly account for space consumption in the result buffer.
- It leaked the buffer space used. While this likely doesn't matter for
foreseeable usage, it seemed worth fixing.
- Didn't do the right thing for a file not ending with a newline.
- Didn't follow project code layout standards.

I've committed the attached revised version.

regards, tom lane

Attachment Content-Type Size
pgbench-line-length-fix-2.patch text/x-diff 2.1 KB