Closed rameshvs02 closed 6 years ago
ATtaching full error log. api_sql_mysql.t.txt
It looks like a DNS lookup on your machine to a host named 'non-existing' succeeds. Some internet providers choose to resolve all DNS lookups to show a nice "Site doesn't exist" web page if the host cannot be resolved. In which case the test failure is expected, because its goal is specifically to test a connection failure to a non-existing host.
Can you confirm your DNS resolves non-existing
to an IP address?
DNS is not resolving non-existing
to an IP address
[vagrant@bkppgsql ~]$ host non-existing
Host non-existing not found: 3(NXDOMAIN)
[vagrant@bkppgsql ~]$
What happens if you do mysql -h non-existing
?
[vagrant@bkppgsql ~]$ mysql -uroot -hnon-existing
ERROR 2005 (HY000): Unknown MySQL server host 'non-existing' (0)
[vagrant@bkppgsql ~]$ mysql -hnon-existing
ERROR 2005 (HY000): Unknown MySQL server host 'non-existing' (0)
[vagrant@bkppgsql ~]$
This is puzzling. And what happens if you run sysbench --mysql-host=non-existing ...
?
[vagrant@bkppgsql ~]$ sysbench /usr/share/sysbench/oltp_insert.lua --mysql-host=non-existing --mysql-db=test --db-driver=mysql prepare
sysbench 1.0.14 (using bundled LuaJIT 2.1.0-beta2)
FATAL: unable to connect to MySQL server on host 'non-existing', port 3306, aborting...
FATAL: error 2005: Unknown MySQL server host 'non-existing' (0)
FATAL: `sysbench.cmdline.call_command' function failed: /usr/share/sysbench/oltp_common.lua:83: connection creation failed
[vagrant@bkppgsql ~]$
Then I'm out of ideas. Is the test failure still reproducible? This is what the test does essentially:
cat > /tmp/test.lua <<EOF
function event()
local drv = sysbench.sql.driver()
local e,m = pcall(drv.connect, drv)
print(m)
end
EOF
sysbench --events=1 --db-driver=mysql --mysql-host=non-existing /tmp/test.lua run
Yes, it is easy to reproduce.
[vagrant@bkppgsql ~]$ cat > /tmp/test.lua <<EOF
> function event()
> local drv = sysbench.sql.driver()
> local e,m = pcall(drv.connect, drv)
> print(m)
> end
> EOF
[vagrant@bkppgsql ~]$ sysbench --events=1 --db-driver=mysql --mysql-host=non-existing /tmp/test.lua run
sysbench 1.0.14 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Initializing worker threads...
Threads started!
FATAL: unable to connect to MySQL server on host 'non-existing', port 3306, aborting...
FATAL: error 2005: Unknown MySQL server host 'non-existing' (0)
connection creation failed
SQL statistics:
queries performed:
read: 0
write: 0
other: 0
total: 0
transactions: 1 (159.60 per sec.)
queries: 0 (0.00 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 0.0043s
total number of events: 1
Latency (ms):
min: 4.11
avg: 4.11
max: 4.11
95th percentile: 4.10
sum: 4.11
Threads fairness:
events (avg/stddev): 1.0000/0.00
execution time (avg/stddev): 0.0041/0.00
[vagrant@bkppgsql ~]$
This issue is reproducible with 1.0.13 build too.
Wait, the above test shows that the issue is NOT reproducible, i.e. connection to a host named 'non-existing' fails as it should. Whether in your original report it succeeded.
okay, but when we run ./test_run.sh
from testsuite t/api_sql_mysql.t
will fail
~/sysbench-1.0.14/tests ~
t/1st.t: passed
t/api_basic.t: passed
t/api_histogram.t: passed
t/api_legacy_basic.t: passed
t/api_legacy_rand.t: passed
t/api_legacy_sql.t: passed
t/api_rand.t: passed
t/api_reports.t: passed
t/api_sql_mysql.t: failed
--- t/api_sql_mysql.t
+++ t/api_sql_mysql.t.err
@@ -67,9 +67,7 @@
2
--
reconnects = 1
- FATAL: unable to connect to MySQL server on host 'non-existing', port 3306, aborting...
- FATAL: error 2005: Unknown MySQL server host 'non-existing' (0)
- connection creation failed
+ <sql_connection>
--
FATAL: mysql_drv_query() returned error 1048 (Column 'a' cannot be null) for query 'INSERT INTO t VALUES (NULL)'
Got an error descriptor:
t/api_sql_pgsql.t: skipped
t/cmd_cleanup.t: passed
t/cmd_help.t: passed
t/cmdline.t: passed
t/cmd_prepare.t: passed
t/cmd_run.t: passed
t/commands.t: passed
t/drivers.t: passed
t/drv_mysql.t: passed
t/drv_pgsql.t: skipped
t/help_drv_mysql.t: passed
t/help_drv_pgsql.t: skipped
t/opt_help.t: passed
t/opt_histogram.t: passed
t/opt_report_checkpoints.t: passed
t/opt_report_interval.t: passed
t/opt_version.t: passed
t/script_bulk_insert_mysql.t: passed
t/script_bulk_insert_pgsql.t: skipped
t/script_oltp_delete_mysql.t: passed
t/script_oltp_delete_pgsql.t: skipped
t/script_oltp_help.t: passed
t/script_oltp_insert_mysql.t: passed
t/script_oltp_insert_pgsql.t: skipped
t/script_oltp_point_select_mysql.t: passed
t/script_oltp_point_select_pgsql.t: skipped
t/script_oltp_read_write_mysql.t: passed
t/script_oltp_read_write_pgsql.t: skipped
t/script_select_random_mysql.t: passed
t/script_select_random_pgsql.t: skipped
t/test_cpu.t: passed
t/test_fileio.t: passed
t/test_memory.t: passed
t/test_mutex.t: passed
t/tests.t: passed
t/test_threads.t: passed
# Ran 45 tests, 9 skipped, 1 failed.
Two questions:
what is in SBTEST_MYSQL_ARGS
?
are you sure the same sysbench binary is used when you invoke sysbench manual and the one used by test_run.sh
? Could it be that manual tests actually use a globally installed sysbench binary rather than the one in your local source code tree?
Here is there command I use for testsuite run.
pushd $SYSBENCH_SOURCE/tests
export SBTEST_MYSQL_ARGS="--mysql-host=localhost --mysql-user=root --mysql-socket=/tmp/mysql.sock --mysql-db=sbtest"
./test_run.sh
popd
I used globally installed sysbench package for manual testing but the version is same (Installed it from percona testing repo) .
./test_run.sh
should use locally build sysbench binary right?
Bingo, --mysql-socket=/tmp/mysql.sock
in SBTEST_MYSQL_ARGS
is the reason. When --mysql-socket
is specified, sysbench ignores --mysql-host
and assumes localhost.
ack, thanks :)
Works fine without socket
[vagrant@bkppgsql tests]$ export SBTEST_MYSQL_ARGS="--mysql-host=localhost --mysql-user=root --mysql-db=sbtest" [vagrant@bkppgsql tests]$ ./test_run.sh
t/1st.t: passed
t/api_basic.t: passed
t/api_histogram.t: passed
t/api_legacy_basic.t: passed
t/api_legacy_rand.t: passed
t/api_legacy_sql.t: passed
t/api_rand.t: passed
t/api_reports.t: passed
t/api_sql_mysql.t: passed
t/api_sql_pgsql.t: skipped
t/cmd_cleanup.t: passed
t/cmd_help.t: passed
t/cmdline.t: passed
t/cmd_prepare.t: passed
t/cmd_run.t: passed
t/commands.t: passed
t/drivers.t: passed
t/drv_mysql.t: passed
t/drv_pgsql.t: skipped
t/help_drv_mysql.t: passed
t/help_drv_pgsql.t: skipped
t/opt_help.t: passed
t/opt_histogram.t: passed
t/opt_report_checkpoints.t: passed
t/opt_report_interval.t: passed
t/opt_version.t: passed
t/script_bulk_insert_mysql.t: passed
t/script_bulk_insert_pgsql.t: skipped
t/script_oltp_delete_mysql.t: passed
t/script_oltp_delete_pgsql.t: skipped
t/script_oltp_help.t: passed
t/script_oltp_insert_mysql.t: passed
t/script_oltp_insert_pgsql.t: skipped
t/script_oltp_point_select_mysql.t: passed
t/script_oltp_point_select_pgsql.t: skipped
t/script_oltp_read_write_mysql.t: passed
t/script_oltp_read_write_pgsql.t: skipped
t/script_select_random_mysql.t: passed
t/script_select_random_pgsql.t: skipped
t/test_cpu.t: passed
t/test_fileio.t: passed
t/test_memory.t: passed
t/test_mutex.t: passed
t/tests.t: passed
t/test_threads.t: passed
# Ran 45 tests, 9 skipped, 0 failed.
[vagrant@bkppgsql tests]$
Testsuite api_sql_mysql.t failed with Error "FATAL: unable to connect to MySQL server on host 'non-existing', port 3306, aborting..."
Is it expected error?
Error info