Fabien COELHO wrote:
> a) add -b option for cumulating builtins and rework internal script
> management so that builtin and external scripts are managed the
> same way.
I tweaked this a bit. I found a bug in threadRun: it was reading the
commands first, and setting st->use_file later. This led to the wrong
commands being read.
Some other less interesting changes:
* made chooseScript have the logic to react to single existing script;
no need to inject ternary operators in each caller to check for that
condition.
* Added a debug line every time a script is chosen,
+ if (debug)
+ fprintf(stderr, "client %d executing script \"%s\"\n", st->id,
+ sql_script[st->use_file].name);
(I'd have liked to have chooseScript itself do it, but it doesn't
have the script name handy. Maybe this indicates that the data
structures are slightly wrong.)
* Added a separate routine to list available scripts; originally that
was duplicated in "-b list" and when -b got an invalid script name.
* In usage(), I split out the options to select a script instead of
mixing them within "Benchmarking options"; also changed wording of
parenthical comment, no longer carrying the full list of scripts (a
choice which also omitted "-b list" itself):
+ "\nOptions to select what to run:\n"
+ " -b, --builtin=NAME add buitin script (use \"-b list\" to display\n"
+ " available scripts)\n"
+ " -f, --file=FILENAME add transaction script from FILENAME\n"
+ " -N, --skip-some-updates skip updates of pgbench_tellers and pgbench_branches\n"
+ " (same as \"-b simple-update\")\n"
+ " -S, --select-only perform SELECT-only transactions\n"
+ " (same as \"-b select-only\")\n"
I couldn't find a better heading to use there, so that'll have to do
unless someone has a better idea.
Some other trivial changes. Patch attached. I plan to push this as
soon as I'm able.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services