File: innodb_open_file_hang.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (80 lines) | stat: -rw-r--r-- 2,568 bytes parent folder | download
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
# Bug#3254121: MANY THREADS IN OS_EVENT, SYSTEM SLOWDOWN/HANG
# This test verifies that the server does not slowdown/hang
# while loading a tablespace while a large number of other
# connections have opened more temporary tablespaces than
# the variable inodb_open_files.

SELECT @@innodb_thread_concurrency, @@innodb_open_files;
# MTR limits number of connections to 128 only.
--let $tables_count=50
--let $count_mtr=110
--let $count_exec=500
--let $num_table=0

# All the tablespaces except the undo tablespaces and system tablespaces are
# added to a LRU list of size innodb_open_files. When this list if full
# and a new file needs to be added to it, the oldest file is removed and closed
# to make room for a new file.
# The temporary tables used to be not added in the LRU list which could cause
# server to hang with big number of connections.

--echo # Create more tables than open file limit (which is 40) to fill up the
--echo # LRU list.
while($num_table < $tables_count){
  --eval CREATE TABLE g$num_table(id INT PRIMARY KEY) ENGINE=INNODB
  --inc $num_table
}

--echo # Open $count_mtr connections and create a temporary table
--echo # for each connection.
--let $conn_count=0
while($conn_count < $count_mtr){
  --connect (con$conn_count, localhost, root,,)
  CREATE TEMPORARY TABLE t1(id INT PRIMARY KEY) ENGINE=INNODB;
  INSERT INTO t1 VALUES (1);
  --inc $conn_count
}

--echo # Insert rows in tables using multiple connections.
--let $conn_count=0
while($conn_count < $count_mtr){
  --connection con$conn_count
  --send_eval INSERT INTO g0 VALUE ($conn_count)
  --inc $conn_count
}

--echo # Wait for the connections to finish inserting rows.
--let $conn_count=0
while($conn_count < $count_mtr){
  --connection con$conn_count
  --reap
  --inc $conn_count
}

--echo # Cleanup.
--echo # Disconnect the connections.
--connection default
--let $conn_count=0
while($conn_count<$count_mtr){
  --disconnect con$conn_count
  --inc $conn_count
}

CREATE TABLE connections_done(id INT PRIMARY KEY);

--let $conn_count=0
while($conn_count < $count_exec){
  --exec_in_background $MYSQL -e "USE test; CREATE TEMPORARY TABLE t1(id INT PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES (1); SELECT SLEEP(5); INSERT INTO connections_done VALUES ($conn_count);"
  --inc $conn_count
}

--let $wait_condition=SELECT COUNT(*)=$count_exec from connections_done
--source include/wait_condition_or_abort.inc

--echo # Drop all the tables
DROP TABLE connections_done;
--let $num_table=0
while($num_table < $tables_count){
  --eval DROP TABLE g$num_table
  --inc $num_table
}