File: pool_of_threads.test

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (107 lines) | stat: -rw-r--r-- 2,874 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Tests will be skipped for the view protocol because the view protocol creates 
# an additional util connection
-- source include/no_view_protocol.inc

# Start with thread_handling=pool-of-threads
# and run a number of tests

-- source include/have_pool_of_threads.inc
-- source include/default_optimizer_switch.inc

# Slow test, don't run during staging part
-- source include/not_staging.inc
-- source include/long_test.inc

SET optimizer_switch='outer_join_with_cache=off';
-- source include/common-tests.inc
SET optimizer_switch=default;

# 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
# on normal port fails due to --thread-pool-max-threads=2.
# We can afford using a really long sleep, because we won't wait
# till it ends, we'll interrupt it as soon as we don't need it anymore

connection default;
--let $con1_id= `SELECT CONNECTION_ID()`

send SELECT sleep(50);
--sleep  1 

connect(con2,localhost,root,,);
--let $con2_id= `SELECT CONNECTION_ID()`

send SELECT sleep(50);
--sleep  0.5

--disable_abort_on_error
--disable_result_log
--disable_query_log
connect(con3,localhost,root,,,,,connect_timeout=2);
--enable_query_log
--enable_result_log
--enable_abort_on_error
let $error = $mysql_errno;
if (!$error)
{
  --echo # -- Error: managed to establish more than --thread_pool_max_threads connections
}
if ($error)
{
  --echo # -- Success: more than --thread_pool_max_threads normal connections not possible
}

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

# Here, sleep just for slightly longer than 5 sec to trigger MDEV-4566
# (abort in interruptible wait connection check).
send SELECT sleep(5.5);


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,,connect_timeout=2);
--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 extracon2;
--replace_result $con1_id <default_connection_ID>
eval KILL QUERY $con1_id;
--replace_result $con2_id <con2_connection_ID>
eval KILL QUERY $con2_id;

connection default;
--error ER_QUERY_INTERRUPTED
--reap
connection con2;
--error ER_QUERY_INTERRUPTED
--reap

connection extracon;
--reap

# Check if compression works OK
connect (comp_con,localhost,root,,,,,COMPRESS);
SELECT 1;
disconnect comp_con;