268 Commits

Author SHA1 Message Date
591c588fa7 Implement custom report hooks. Add CSV and JSON reporters as examples. 2017-01-29 23:46:43 +03:00
04b4f756d9 Refactor stats reporting to make custom reports possible. 2017-01-29 19:32:14 +03:00
12e56538f3 Parallel 'prepare' and 'prewarm' (MySQL-only) commands for OLTP benchmarks. 2017-01-28 17:55:29 +03:00
49aa0b4322 Fixes #78: better error hints for missing help command
Now if the help command is specified for a script, sysbench first check
if the script impelements a custom help command, and calls it. If no
custom command is defined, it checks whether the script declares any
command line options, in which case it prints their description. If
neither the help() function nor an option declaration is available,
sysbench prints an error message.
2017-01-28 16:20:29 +03:00
49016568ba Implement custom commands + parallel custom commands. 2017-01-28 15:45:16 +03:00
fa3d2a80d2 Silence spurious error messages on 'make install'. 2017-01-27 11:51:05 +03:00
06d4f99cb6 Rename the 'sysbench' subdirectory to 'src'. 2017-01-27 09:39:28 +03:00
a3b4c0610e Add option declarations to OLTP tests.
All bundled OLTP tests now declare their supported options. Which means:

- unknown options are not be silently accepted, but throw an
  error (fixes #15)
- 'sysbench /any OLTP script/ help' now prints a list of supported
  options, their descriptions, types and default values just as built-in
  tests do (fixes #79)
2017-01-26 14:35:01 +03:00
9d73ed0865 Allow Lua scripts to declare supported options.
Lua scripts can now declare their supported options, in which case
sysbench validates command line arguments and display usage
information.

This is a prerequisite for fixing #15 and #79.
2017-01-26 04:23:55 +03:00
2cda228c7e Command line options refactoring:
- add support for 'validator' functions
- add support to define command line options after test
initialization. It is a prerequisite for option definitions in Lua
scripts
- various code cleanups
2017-01-25 19:09:44 +03:00
a4218987cb Fix help_drv_*.t tests broken by the command line syntax change. 2017-01-25 16:23:38 +03:00
96a1ed4049 Adjust cmdline.t to pass on slower machines. 2017-01-25 01:49:51 +03:00
45e219d038 Change the command line syntax: remove the --test option. 2017-01-25 00:02:59 +03:00
5852c405ff Fix api_sql_mysql.t. 2017-01-23 23:16:12 +03:00
deb4994144 Fix prepared statements for PostgreSQL driver.
libpq requires zero-terminated strings for text arguments.
2017-01-23 22:51:58 +03:00
0e49aa1edb Set LUA_PATH in test_run.sh to point to Lua scripts directory. 2017-01-23 21:03:56 +03:00
d89df214f7 Export sysbench.version and sysbench.version_string to Lua. 2017-01-23 14:11:41 +03:00
cf6e8645fd Travis CI portability fixes for api_sql_pgsql.t. 2017-01-23 10:42:48 +03:00
48ea461dd3 Re-enable api_sql_pgsql.t. 2017-01-23 10:12:39 +03:00
29c0299aef Convert OLTP scripts to prepared statements. 2017-01-23 03:32:27 +03:00
7ddab2dcff Fix api_sql_mysql.t to work with older MySQL versions. 2017-01-21 17:19:59 +03:00
cdabf72b7b Implement customer error hooks.
If a Lua script defines the sysbench.hooks.sql_error_ignorable function,
sysbench calls it whenever an SQL error occurs and passes information
about connection, failed query, SQL error number, state and message as
arguments. If the function returns true, the error is ignored and the
entire event is restarted. Otherwise sysbench aborts scripts execution.
2017-01-21 16:58:38 +03:00
609f7c4db3 Pass SQL state to Lua in case of errors.
Since PostgreSQL doesn't have SQL error codes, get SQL state in case of
an error for both MySQL and PostgrSQL, and make it available to Lua.
2017-01-20 10:54:01 +03:00
dbb7bbfcd1 Implement error propagation.
SQL query errors can now be propagated to Lua scripts. This is a
prerequisite for custom error hooks.
2017-01-20 02:43:08 +03:00
d767dba581 Move the unused --myisam-max-rows option from drv_mysql.c to legacy API. 2017-01-18 21:52:32 +03:00
2f865a0053 Use pgsql_common.sh in PostgreSQL-specific regression tests. 2017-01-18 12:13:49 +03:00
9dc835aa48 Disable api_sql_pgsql.t for now. Prepared statements need more work for PostgreSQL. 2017-01-18 00:55:07 +03:00
12184eef13 Fix test_run.sh to work with named tests. 2017-01-18 00:32:31 +03:00
a1d7c7b483 Fix 'make distcheck'. 2017-01-18 00:10:21 +03:00
5e7d79b49f Fixes #13: Export db_fetch_row
Add support for result set retrieving for MySQL and PostgreSQL drivers
and export it to the new Lua SQL API.
2017-01-17 22:58:18 +03:00
50f2c49c93 Improve script_bulk_insert_*.t tests stability. 2017-01-17 12:49:31 +03:00
5cab979e7d Test multiple connections per thread.
Multiple connections per thread were made possible as a part of the SQL
API refactoring. The feature is a pre-requisite for fixing issue #73.

This commit just adds a regression test.
2017-01-17 01:12:31 +03:00
950d848fcd Fix oltp_insert.lua, add a regression test. 2017-01-17 00:39:44 +03:00
a6cebd3a57 Rewrite OLTP benchmarks with the new SQL API + cleanups. 2017-01-17 00:17:17 +03:00
ee22b36298 Rewrite bulk_insert.lua to the new SQL API + regression tests. 2017-01-16 17:54:07 +03:00
8925dfdc79 Re-write select_random*.lua benchmarks to the new SQL API. 2017-01-16 16:01:35 +03:00
378c49b275 Fix legacy OLTP regression tests. 2017-01-15 16:53:00 +03:00
84fed669cc Move oltp_point_select.lua from sysbench/tests/db/ to sysbench/lua/.
Move oltp_point_select.lua to the sysbench/lua/ directory. Add basic
regression tests.
2017-01-15 16:45:38 +03:00
ebc2cb5420 Export prepared statements API to Lua.
Fix function name in an error message.

Fix prepared statements for string parameters.
2017-01-15 14:46:23 +03:00
1d434809ec SQL API refactoring, cut #1. 2017-01-14 01:29:57 +03:00
de3003c2c5 Fixes #96: sb_rand_uniq(1, oltp_table_size) generate duplicate value
Use ideas and code from https://github.com/preshing/RandomSequence to
generate a sequence of unique 32-bit numbers. Make the code thread-safe
as the corresponding Lua function in sysbench might be used in a
concurrent context.
2017-01-06 19:28:48 +03:00
58e4e6e65c Fix legacy API tests. 2017-01-06 15:10:29 +03:00
9e5507db1c Merge branch '1.0' 2017-01-06 09:42:00 +03:00
99b0f4e260 Merge branch '0.5' into 1.0 2017-01-06 09:40:52 +03:00
ffc2782153 Fix portability by masking table options in api_sql.t. 2017-01-05 23:16:53 +03:00
2a523826dc Use MySQL connection arguments in API tests. 2017-01-05 23:10:34 +03:00
5e94314e69 Specify DB driver explicitly in API tests. 2017-01-05 23:03:49 +03:00
e25e4d4864 Lua API regression tests. 2017-01-05 23:00:13 +03:00
3c89312c6d Fix cmd_help.t. 2017-01-04 18:31:26 +03:00
1b91649457 Move all pseudo-random numbers related code to sb_rand.c 2017-01-02 22:25:23 +03:00