Re: [PATCH] pgbench: new feature allowing to launch shell commands

From: Dan Colish <dan(at)unencrypted(dot)org>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] pgbench: new feature allowing to launch shell commands
Date: 2009-09-18 15:53:36
Message-ID: 20090918155336.GA14690@funkstrom.spiretech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 18, 2009 at 03:10:14PM +0900, Michael Paquier wrote:
> >
> > You really should be returning a value at the point since the function
> > signature defines a return type. If not the function should be void,
> > which it cannot be in this context since it is used for boolean tests
> > elsewhere. The returns in question are all part of error blocks and
> > should return false.
> >
>
> OK I got your point, I missed the part managing with CState, which is tested
> after doCustom.
> Another version of the patch is attached with this email.
>
> I must be doing something wrong when I am running this script. It is
> > still throwing errors. Would you mind showing me the pgbench command you
> > used to run it?
> >
> > Of course, here it is the list of commands I use:
> pgbench -i dbname (in case your database is called dbname)
> pgbench -c 10 -t 10 -f transaction_file_name.data dbname (customer and
> transaction numbers can also bet set as you want).
>
> Regards,
>
> --
> Michael Paquier
>
> NTT OSSC

OK, thank you for sending me the patch and the relivent commands. You're
still not returning false where you should be, but that wasn't the issue
I am seeing. I believe there is an issue in either the custom script you
posted on the wiki or pgbench itself. Here is the script I am running,
you might recongnize it :)

\set nbranches :scale
\set ntellers 10 * :scale
\set naccounts 100000 * :scale
\setrandom aid 1 :naccounts
\setrandom bid 1 :nbranches
\setrandom tid 1 :ntellers
\setrandom delta -5000 5000
\setrandom txidrand 0 10000
START TRANSACTION;
UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
PREPARE TRANSACTION ':txidrand';
\shell ls -ll >> /tmp/log_data`date '+%Y%m%d'`_`date '+%k%M'`
COMMIT PREPARED ':txidrand';

So I get this output with and with out the shell command in there,
against the unpatched and patched version on pgbench. The commands you
sent will not work with this script since it is using prepared
statements. I am using this command to run the script.

./contrib/pgbench/pgbench -c 10 -j 2 -M prepared -f custom.script test

From which, I get the following output:

starting vacuum...end.
Client 0 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
Client 1 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
Client 2 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
Client 5 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
Client 8 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
Client 6 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
Client 7 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
Client 3 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
Client 4 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
Client 9 aborted in state 15: ERROR: bind message supplies 1 parameters, but prepared statement "P0_15" requires 0
transaction type: Custom query
scaling factor: 1
query mode: prepared
number of clients: 10
number of threads: 2
number of transactions per client: 10
number of transactions actually processed: 0/100
tps = 0.000000 (including connections establishing)
tps = 0.000000 (excluding connections establishing)

Since it occurs on both versions, I'm having some trouble identifying
whether this is a bug in the script or a bug in pgbench. Any help is
appreciated.

--
--Dan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2009-09-18 17:14:34 Draft for organized beta testing
Previous Message Simon Riggs 2009-09-18 15:43:04 Re: Hot Standby 0.2.1