Commit Graph

861 Commits

Author SHA1 Message Date
06d4f99cb6 Rename the 'sysbench' subdirectory to 'src'. 2017-01-27 09:39:28 +03:00
aa5af68938 Move legacy API to sysbench.compat.lua. 2017-01-26 23:57:54 +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
2c5638ff9e Remove TODO. 2017-01-26 04:33:57 +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
d8e2144ea9 Fix typo in a help string. 2017-01-25 17:16:14 +03:00
a4218987cb Fix help_drv_*.t tests broken by the command line syntax change. 2017-01-25 16:23:38 +03:00
48375407fa Grammar fixes. 2017-01-25 11:04:56 +03:00
96a1ed4049 Adjust cmdline.t to pass on slower machines. 2017-01-25 01:49:51 +03:00
4cf5884ac9 Use cache-aligned allocation for thread_stats. 2017-01-25 01:04:04 +03:00
45e219d038 Change the command line syntax: remove the --test option. 2017-01-25 00:02:59 +03:00
d2b494ac2d Revert .travis.yml changes. 2017-01-23 23:24:03 +03:00
dec61a10e0 Exclude excessive OS combinations from Travis build matrix. 2017-01-23 23:16:25 +03:00
5852c405ff Fix api_sql_mysql.t. 2017-01-23 23:16:12 +03:00
55e8129e26 Add more Linux distributions to the build matrix. 2017-01-23 23:09:15 +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
e53815173d Simplify ugly require/dofile constructs in OLTP scripts. 2017-01-23 20:58:51 +03:00
90737c5833 Do not crash if db_prepare fails with an error. 2017-01-23 20:56:52 +03:00
ec43211135 Replace lua_pushstring() with lua_pushliteral() where possible. 2017-01-23 17:48:09 +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
4e7d6d87ca Move tx_rate check from thread_run() to sb_event_stop().
This is required for tx_rate to also work with Lua scripts.
2017-01-22 11:17:44 +03:00
b179d21849 Change max_requests and max_time_ns in sb_globals_t to uint64_t. 2017-01-22 11:11:18 +03:00
45830f9cd0 Optimizations and cleanups around sb_next_event(). 2017-01-22 10:45:08 +03:00
21a28231ad Convert main loop functions to FFI.
Convert functions used in the main thread_run loop to use FFI rather
than the traditional Lua calling interface: sysbench.more_events(),
sysbench.event_start() and sysbench. event_stop().
2017-01-22 09:26:53 +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
5df558c509 In sysbench.sql.lua, report the caller on error, not the check_type() itself. 2017-01-18 19:34:38 +03:00
89d20cc552 Free connection's result set when closing it. 2017-01-18 19:34:16 +03:00
6d38f95b32 Fix a comment typo. 2017-01-18 19:33:45 +03:00
a68ec7512b Fix 'make distcheck'. 2017-01-18 16:56:07 +03:00
0b8bd15242 s/SysBench/sysbench/g 2017-01-18 15:24:50 +03:00
1582a04b72 Move sysbench.rand.* functions to sysbench.rand.lua. 2017-01-18 15:19:19 +03:00
e6849052fe Fix check for event() function in the previous commit. 2017-01-18 13:32:32 +03:00
1168d07ae7 Fixes #103: fail with an error when oltp_common.lua is called directly. 2017-01-18 13:25:42 +03:00
aa7fbce225 Add a comment to oltp_common.lua.
Based on #103, add a comment to oltp_common.lua to explain that it
should not be called directly, but is meant to be included by other OLTP
scripts.
2017-01-18 13:16:40 +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
1afeecf61d Revert unrelated changes from the previous commit. 2017-01-17 12:24:08 +03:00