pool_of_threads.test 2.25 KB
Newer Older
1 2 3 4
# Start with thread_handling=pool-of-threads
# and run a number of tests

-- source include/have_pool_of_threads.inc
5 6
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
7 8
# Slow test, don't run during staging part
-- source include/not_staging.inc
9
-- source include/long_test.inc
10
-- source include/common-tests.inc
11
SET optimizer_switch=@save_optimizer_switch;
12 13 14 15 16 17

# Test that we cannot have more simultaneous connections than
# --thread-pool-size on the standard port, but _can_ have additional
# connections on the extra port.

# First set two connections running, and check that extra connection
18
# on normal port fails due to--thread-pool-max_threads=2
19
connection default;
20 21 22 23

# Sleep for slightly longer than 5 sec to trigger MDEV-4566 
# (abort in interruptible wait connection check)
send SELECT sleep(5.5); 
Vladislav Vaintroub's avatar
Vladislav Vaintroub committed
24
--sleep  1 
25 26 27 28

connect(con2,localhost,root,,);
connection con2;
send SELECT sleep(5);
Vladislav Vaintroub's avatar
Vladislav Vaintroub committed
29
--sleep  0.5
30 31 32 33 34 35 36 37 38 39 40

--disable_abort_on_error
--disable_result_log
--disable_query_log
connect(con3,localhost,root,,);
--enable_query_log
--enable_result_log
--enable_abort_on_error
let $error = $mysql_errno;
if (!$error)
{
41
  --echo # -- Error: managed to establish more than --thread_pool_max_threads connections
42 43 44
}
if ($error)
{
45
  --echo # -- Success: more than --thread_pool_max_threads normal connections not possible
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
}

connection default;
--reap
connection con2;
--reap

# Now try again, but this time use the extra port to successfully connect.

connection default;
send SELECT sleep(5);

connection con2;
send SELECT sleep(5);
--sleep 1

connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
connection extracon;
SELECT 'Connection on extra port ok';

connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
connection extracon2;
SELECT 'Connection on extra port 2 ok';

--disable_abort_on_error
--disable_result_log
--disable_query_log
connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
--enable_query_log
--enable_result_log
--enable_abort_on_error
let $error = $mysql_errno;
if (!$error)
{
  --echo # -- Error: managed to establish more than --extra-max-connections + 1 connections
}
if ($error)
{
  --echo # -- Success: more than --extra-max-connections + 1 normal connections not possible
}

connection default;
--reap
connection con2;
--reap