When the --rate option was used together with the --time option, a bogus
"Terminating the event generator thread failed" error was thrown at the
end of the test.
Worker threads used sleep() in the bounded rate mode to avoid CPU
hogging when polling on the event queue. The problem was that sleep()
calls increased time spent by events in the queue, which is counted
towards event latency to avoid the coordinated omission problem. The
lower the rate, the bigger impact on latency was observed.
The fix is replacing sleep()s with a condition variable which is now
used to put worker into an idle wait when the queue is empty. The event
generation thread now uses pthread_cond_signal() after each generated
event to wake up an idle worker thread. Which somewhat increases
sysbench CPU consumption, especially for high rates.
Get rid of TLS variables in sb_memory.c, because their implementation
varies across platforms and their usage is an overkill for this
benchmark. Instead just use preallocated arrays with per-thread buffers/counters.
The --rand-type described in man pages don't really work for
sysbench memory tests. So enable this powerful feature.
Tested with
sysbench memory --memory-access-mode=rnd --rand-type=pareto run
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
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.
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.
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.
Fix oltp_common.lua to re-prepare prepared statements after
reconnecting, i.e. if a connection to the server has been lost and one
of the following MySQL errors is in the --mysql-ignore-errors list:
- 2013 (CR_SERVER_LOST)
- 2055 (CR_SERVER_LOST_EXTENDED)
- 2006 (CR_SERVER_GONE_ERROR)
- 2011 (CR_TCP_CONNECTION)