File: mem_cnt_common_debug.inc

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 (155 lines) | stat: -rw-r--r-- 4,334 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# WL#13458 Global and session memory allocation limits.

# Save the initial number of concurrent sessions
--source include/count_sessions.inc

CREATE USER 'user1'@localhost;
GRANT USAGE ON *.* TO 'user1'@localhost;

let $query_check_err_log=
  SELECT PRIO, SUBSYSTEM, DATA FROM performance_schema.error_log
  ORDER BY LOGGED DESC LIMIT 1;

SET GLOBAL global_connection_memory_tracking = ON;


--echo # Check OOM for init_connect.
SET GLOBAL init_connect = 'show variables';

--echo # Global limit.
SET GLOBAL global_connection_memory_limit = 1;

--echo # Connection con1
connect (con1, localhost, user1);
--replace_regex /connection .* to/connection to/
--error ER_NEW_ABORTING_CONNECTION
SELECT 1;
connection default;
--replace_regex /connection .* to/connection to/ /MY-[0-9]+/MY-NNNNNN/
eval $query_check_err_log;
SET GLOBAL global_connection_memory_limit = default;
disconnect con1;

--echo # Connection limit.
SET GLOBAL connection_memory_limit = 1;
--echo # Connection con1
connect (con1, localhost, user1);
--replace_regex /connection .* to/connection to/
--error ER_NEW_ABORTING_CONNECTION
SELECT 1;
connection default;
--replace_regex /connection .* to/connection to/ /MY-[0-9]+/MY-NNNNNN/
eval $query_check_err_log;
SET GLOBAL connection_memory_limit = default;
disconnect con1;

SET GLOBAL init_connect = default;

--echo # Check OOM before idle stage at connection stage.

--echo # Global limit.
SET GLOBAL global_connection_memory_limit = 1;

--echo # Connection con1
connect (con1, localhost, user1);
--replace_regex /Consumed [0-9]+/Consumed SOME/
--error ER_DA_GLOBAL_CONN_LIMIT
SELECT 1;
connection default;
--replace_regex /Consumed [0-9]+/Consumed SOME/
eval $query_check_err_log;
SET GLOBAL global_connection_memory_limit = default;
disconnect con1;

--echo # Connection limit.
SET GLOBAL connection_memory_limit = 1;
--echo # Connection con1
connect (con1, localhost, user1);
--replace_regex /Consumed [0-9]+/Consumed SOME/
--error ER_DA_CONN_LIMIT
SELECT 1;
connection default;
--replace_regex /Consumed [0-9]+/Consumed SOME/
eval $query_check_err_log;
SET GLOBAL connection_memory_limit = default;
disconnect con1;

--echo # Check OOM before idle stage after succesful statement execution.

let $query_check_err_log=
  SELECT PRIO, SUBSYSTEM, DATA FROM performance_schema.error_log
  WHERE DATA LIKE '%memory limit 2 bytes exceeded%'
  ORDER BY LOGGED DESC LIMIT 1;

GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO 'user1'@localhost;

--echo # Global limit.

connect (con3, localhost, user1);
SET SESSION DEBUG="+d,mem_cnt_no_error_on_exec_global";

connection default;
SET GLOBAL global_connection_memory_limit = 2;
connection con3;
--echo # Both statements should be executed without errors.
--disable_result_log
SHOW VARIABLES;
SHOW VARIABLES;
--enable_result_log

connection default;
disconnect con3;
SET GLOBAL global_connection_memory_limit = default;

--echo # Session limit.

SET GLOBAL DEBUG="+d,mem_cnt_no_error_on_exec_session";
SET GLOBAL connection_memory_limit = 10000;
connect (con3, localhost, user1);
--echo # Both statements should be executed without errors.
--disable_result_log
SHOW VARIABLES;
SHOW VARIABLES;
--enable_result_log

connection default;
disconnect con3;
SET GLOBAL DEBUG = default;

SET GLOBAL global_connection_memory_limit = default;
SET GLOBAL connection_memory_limit = default;
SET GLOBAL global_connection_memory_tracking = default;

--echo #
--echo #  Bug#33869004 Range optimizer is not aware of the session memory limit.
--echo #

CREATE TABLE t (
i VARBINARY(255), j VARBINARY(255), k VARBINARY(255),
l VARBINARY(255), m VARBINARY(255), n VARBINARY(255),
PRIMARY KEY(i, j, k, l)
);

SET GLOBAL connection_memory_limit = 10485760;
--echo # Connection con1
connect (con1, localhost, user1);

--replace_regex /Consumed [0-9]+/Consumed SOME/
--error ER_DA_CONN_LIMIT
EXPLAIN SELECT * FROM t FORCE INDEX (PRIMARY) WHERE
i IN ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10") AND
j IN ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10") AND
k IN ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10") AND
l IN ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");

connection default;
disconnect con1;

SET GLOBAL connection_memory_limit = default;
DROP TABLE t;


DROP USER 'user1'@localhost;

# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc