268 Commits

Author SHA1 Message Date
0f27db3b8a Allow mysql-ssl option to differ 2023-07-14 15:20:40 +02:00
9b5381dabc Fix help_drv_pgsql.t 2023-07-09 16:57:49 +03:00
39eb421f33 CI: Update help_drv_mysql.t and status badge 2023-05-16 08:11:28 +02:00
604c3c9f2b tests: Fix failing test due to egrep
Use `grep -E` instead of `egrep` as `egrep` now emits a warning.

```
t/opt_report_checkpoints.t: failed
--- t/opt_report_checkpoints.t
+++ t/opt_report_checkpoints.t.err
@@ -8,6 +8,7 @@
   > fi

   $ sysbench ${SBTEST_SCRIPTDIR}/oltp_read_write.lua --db-driver=mysql --mysql-dry-run --time=3 --events=0 --report-checkpoints=1,2 run | egrep '(Checkpoint report|SQL statistics)'
+  egrep: warning: egrep is obsolescent; using grep -E
   [ 1s ] Checkpoint report:
   SQL statistics:
   [ 2s ] Checkpoint report:
```

```
$ echo | egrep 'abc'
egrep: warning: egrep is obsolescent; using grep -E
$ grep --version
grep (GNU grep) 3.8
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
```
2023-05-08 10:39:39 +02:00
1947e5387a Command line flag to set the sslmode for PostgreSQL (Closes: #326)
The flag name and its values match libpq's sslmode connection parameter.
The default value (prefer) will first try an SSL connection; if that
fails, it will try a non-SSL connection.

Libpq documentation: https://www.postgresql.org/docs/14/libpq-connect.html#LIBPQ-CONNECT-SSLMODE
2021-11-18 23:39:39 -08:00
ead2689ac6 SQL API: add multiple result sets API
MySQL may return multiple result sets from a call to a stored
procedure (the CALL statement), or when multiple queries are specified
in a single client request. The application is supposed to process those
multiple result sets one by one with calls to `mysql_next_result()`, or
its prepared statements counterpart, `mysql_stmt_next_result()`.

Additionally, there is the `mysql_more_results()` call which allows the
application to check if more result sets are available and works for
both regular queries and prepared statements API.

One way to handle multiple results in sysbench would be consuming all
result sets silently in the MySQL driver, but that would make it
impossible for scripts to get access to individual result sets returned
by a stored procedure.

Now sysbench exposes those MySQL client API calls to the SQL API, so it
is up to the script authors to handle multiple result sets when either
stored procedures are used in a benchmark script, or multiple queries
are passed to `sql_connection:query()`:

- sql_connection:next_result()
- sql_connection:more_results()
- sql_statement:next_results()

Here is an example how multiple results can be handled in a benchmark
script:

```lua
   local rs = con:query([[CALL p1("foo")]])
   while rs ~= nil do
      -- handle the result set
      rs = con:next_result()
   end
```

Here is a prepared statement example:

```lua
   stmt = con:prepare("CALL p1(?)")
   param = stmt:bind_create(sysbench.sql.type.CHAR, 10)
   stmt:bind_param(param)
   param:set("bar")
   rs = stmt:execute()

   while rs ~= nil do
      rs = stmt:next_result()
   end
```

Fixes GH-304.
2021-03-25 21:20:15 +03:00
cfe594bd42 SQL API: fix prepared statements with FLOAT/DOUBLE type arguments
SQL API failed to prepare correctly SQL statements containing floating
point arguments.
2021-03-25 21:20:15 +03:00
bbee5d5dc5 Prefer python3 to python2 (#379)
Some distributions do not alias /usr/bin/python3 to /usr/bin/python
2020-09-10 17:03:29 +03:00
805825fa81 --rand-type: remove 'special' from available distributions
Remove the legacy 'special' distribution, because it was unscientific
and hard to explain.

Pareto and Zipfian distributions provide more clearly defined
alternatives.
2020-05-05 11:33:09 +03:00
0bd7771533 --rand-type: use 'uniform' by default
By a popular request, change the default --rand-type value from
'special' to 'uniform'.

Fixes GH-329.
2020-05-05 11:32:42 +03:00
636b1f6bf8 build/CI/packaging: fix regression tests to work with MySQL 8.0.19+ 2020-02-10 09:38:39 +03:00
bcd950b714 Merge branch '1.0' 2019-12-08 15:11:02 +03:00
cf310c37c2 regression tests: compatibility fix for PostgreSQL 12 2019-12-08 14:23:21 +03:00
1327e79110 Merge branch '1.0' 2019-10-21 10:02:21 +03:00
4cce5eba75 build/CI/packaging: fix a typo in test_run.sh. 2019-10-21 08:28:18 +03:00
bad7feaa27 build/CI/packaging: use command correctly. 2019-10-21 08:15:52 +03:00
5e48a42e77 build/CI/packaging: use 'command' instead of 'which'. 2019-10-21 07:51:25 +03:00
6f70aed8bf build/CI/packaging: pass an absolute path to cram. 2019-10-20 22:39:19 +03:00
ac430bd7cf build/CI/packaging: use python2, if python is not available.
This is required to fix cram tests on RHEL 8.
2019-10-20 22:33:46 +03:00
18a9f86dc6 regression tests: fix script_oltp_general_mysql.t to work with MySQL 8.0. 2019-01-16 19:16:44 +03:00
9bb1f99169 Merge branch '1.0' 2018-12-22 20:13:15 +03:00
8744b88cad Return a non-zero exit code on event queue overflow in the --rate mode. 2018-12-22 20:11:34 +03:00
ad2b1bf1e7 Merge branch '1.0' 2018-12-16 17:27:36 +03:00
b017a998ef Fix GH-282: Mysql's fetch_row() is broken
Fix both MySQL and PostgreSQL drivers to return an error when
fetch_row() is called after retrieving all rows in the result set.
2018-12-16 17:21:39 +03:00
a245b2f531 OLTP scripts: add --reconnect option.
oltp_*.lua scripts now support the --reconnect=N option. When specified,
sysbench will reconnect after every N events.

Fixes GH-90.
2018-12-11 23:22:56 +03:00
7c366c6043 tests: fix script_oltp_general_mysql.t again. 2018-07-17 00:29:51 +03:00
90b7f067f5 tests: portability fix for script_oltp_general_mysql.t. 2018-07-17 00:19:24 +03:00
0aba8f60da Fix GH-250: mysql_table_options is not supported in oltp tests
OLTP scripts now support --create-table-options, which can be used to
pass extra SQL to CREATE TABLE statements executed on 'prepare'.

Ref. GH-252.
2018-07-17 00:05:48 +03:00
50966c85ce Merge branch '1.0' 2018-06-26 21:35:39 +03:00
d805300846 Fix GH-223: test failure on ppc64
Make sysbench.cmdline.print_test_options() output deterministic by
sorting option names when parsing.
2018-05-11 22:22:33 +03:00
449b70a5b6 Merge branch '1.0' 2018-05-03 19:14:50 +03:00
e633f9c744 Fix GH-229: "--file-fsync-freq=0" seems to prevent fsync() at end of test
Ensure fsync() is called at the end of a fileio benchmark regardless of
--events, --time and --file-fsync-freq values.
2018-05-03 18:41:24 +03:00
9ef42e269f Remove deprecated options.
--tx-rate, --max-requests, --max-time and --num-threads are no longer
supported. --rate, --events, --time and --threads should be used
instead.
2018-04-20 18:20:29 +03:00
3a06fdc87b Merge branch '1.0' 2018-04-12 22:14:44 +03:00
af11fa7bd4 Improve parsing of boolean command line options.
Accept true/1 as synonyms for 'on', and 'false'/0 as synonyms for
'off'. Also reject other values instead of silently converting them to
'off'.
2018-04-12 22:11:16 +03:00
27a5b99b90 Merge branch '1.0' 2018-04-03 13:48:08 +03:00
0d0d214266 Fix GH-220: Testsuite api_sql_mysql.t failed ...
api_sql_mysql.t failed if SBTEST_MYSQL_ARGS included an explicit
specification of '--mysql-socket', in which case ignores --mysql-host
and asssumes 'localhost'.
2018-04-03 13:46:19 +03:00
8445775235 Merge branch '1.0' 2018-04-02 13:09:40 +03:00
86235957bb Fix opt_help.t to pass when the binary is not configured with MySQL support. 2018-04-02 11:42:08 +03:00
92b1426276 Use --db-driver=mysql by default, if the MySQL driver is available.
If the MySQL driver is available and --db-driver option was explicitly
specified, assume MySQL and don't compain about multiple DB drivers
being available.

That was a popular request and is likely what most sysbench users want.
2018-04-02 11:20:55 +03:00
133aa442e1 Merge branch '1.0' 2018-04-01 14:39:10 +03:00
56b473faf6 Fix GH-195: Fix JSON reporter to produce valid JSON
sysbench.report_json() now generates well-formed JSON without comma
after the last array element and with proper opening/closing brackets.
2018-04-01 13:59:00 +03:00
e5c8052027 Make --mysql-ssl behave like --ssl-mode in MySQL client utilities.
The problem with MySQL 5.7+ client libraries was that there was no way
to disable SSL usage from the sysbench command line, because the client
library defaults to MYSQL_OPT_SSL_MODE = SSL_MODE_REQUIRED, even if
--mysql-ssl is not used. So the only way to disable it was disabling SSL
on the server.

Now --mysql-ssl behaves like the --ssl-mode option in MySQL client
utilities. It accepts the following values (with "disabled" being the
default):

disabled, preferred, required, verify_ca, verify_identity.

When sysbench is built With pre-5.6 MySQL client libraries or MariaDB
client libraries, where support for SSL modes is not available,
--mysql-ssl behavior is not affected by this change, i.e. it remains a
boolean variable accepting the on/off values, with "off" being the
default.
2018-03-31 20:32:09 +03:00
b1a0694cc0 Added --mysql-ssl-key, --mysql-ca and --mysql-ssl-cert.
Replace hard-coded values for client SSL path names with driver options,
at the same time making it possible to skip those options even when
--mysql-ssl is used.
2018-03-31 15:28:29 +03:00
2e05f16bf1 Merge branch '1.0' 2018-03-28 13:09:41 +03:00
a4cb8a6c6d Fix a help message typo. 2018-03-28 13:09:24 +03:00
97f1c8cfbf Merge branch '1.0' 2018-03-23 19:14:54 +03:00
7b383cc537 Don't fail when query_row() is called with an empty SELECT. 2018-03-23 19:13:52 +03:00
0eaa7e4697 Merge branch '1.0' 2018-03-22 10:25:14 +03:00
ce5a14b50a Fix PostgreSQL-specific regression tests to work with 10.3.1.
PostgreSQL 10.3.1 changed the dump format of schema objects. We now
remove the schema name to make results compatible across all PostgreSQL
versions.
2018-03-22 10:23:11 +03:00