File: reset_connection.result

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 (251 lines) | stat: -rw-r--r-- 6,108 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#
# WL#6797 Method for clearing session state
#
CREATE DATABASE wl6797;
USE wl6797;
CREATE TABLE t1 (a int);

#CASE1: cleanup prepare statements

PREPARE x FROM 'INSERT INTO t1 VALUES (1), (2)';
EXECUTE x;
SELECT * FROM t1 ORDER BY 1;
a
1
2
resetconnection;
EXECUTE x;
ERROR HY000: Unknown prepared statement handler (x) given to EXECUTE

#CASE2: cleanup temporary tables

CREATE TEMPORARY TABLE temp1(a int);
INSERT INTO temp1 VALUES (1),(2),(3),(4);
SELECT * FROM temp1 ORDER BY 1;
a
1
2
3
4
resetconnection;
SELECT * FROM temp1 ORDER BY 1;
ERROR 42S02: Table 'wl6797.temp1' doesn't exist

#CASE3: cleanup user variables

set @a:=1;
SELECT @a;
@a
1
resetconnection;
SELECT @a;
@a
NULL

#CASE4: cleanup session variables

SHOW SESSION VARIABLES like 'autocommit';
Variable_name	Value
autocommit	ON
SHOW SESSION VARIABLES like 'transaction_isolation';
Variable_name	Value
transaction_isolation	REPEATABLE-READ
SHOW SESSION VARIABLES like 'character_set_client';
Variable_name	Value
character_set_client	utf8mb4
SHOW SESSION VARIABLES like 'character_set_connection';
Variable_name	Value
character_set_connection	utf8mb4
SHOW SESSION VARIABLES like 'max_join_size';
Variable_name	Value
max_join_size	18446744073709551615
set autocommit=0;
set transaction_isolation='SERIALIZABLE';
set names 'big5';
set max_join_size=100;
set max_join_size=1000;
SHOW SESSION VARIABLES like 'autocommit';
Variable_name	Value
autocommit	OFF
SHOW SESSION VARIABLES like 'transaction_isolation';
Variable_name	Value
transaction_isolation	SERIALIZABLE
SHOW SESSION VARIABLES like 'character_set_client';
Variable_name	Value
character_set_client	big5
SHOW SESSION VARIABLES like 'character_set_connection';
Variable_name	Value
character_set_connection	big5
SHOW SESSION VARIABLES like 'max_join_size';
Variable_name	Value
max_join_size	1000
set max_join_size=100;
resetconnection;
SHOW SESSION VARIABLES like 'autocommit';
Variable_name	Value
autocommit	ON
SHOW SESSION VARIABLES like 'transaction_isolation';
Variable_name	Value
transaction_isolation	REPEATABLE-READ
SHOW SESSION VARIABLES like 'character_set_client';
Variable_name	Value
character_set_client	utf8mb4
SHOW SESSION VARIABLES like 'character_set_connection';
Variable_name	Value
character_set_connection	utf8mb4
SHOW SESSION VARIABLES like 'max_join_size';
Variable_name	Value
max_join_size	18446744073709551615

#CASE5: cleanup table cache and close open tables

FLUSH TABLES;
FLUSH STATUS;
SHOW STATUS like 'Table_open_cache_hits';
Variable_name	Value
Table_open_cache_hits	0
SHOW STATUS like 'Opened_tables';
Variable_name	Value
Opened_tables	0
CREATE TABLE newt( a int );
INSERT INTO newt VALUES (1),(2);
SELECT * FROM newt ORDER BY 1;
a
1
2
DELETE FROM newt;
DROP TABLE newt;
SHOW STATUS like 'Table_open_cache_hits';
Variable_name	Value
Table_open_cache_hits	>0
SHOW STATUS like 'Opened_tables';
Variable_name	Value
Opened_tables	>0
resetconnection;
SHOW STATUS like 'Table_open_cache_hits';
Variable_name	Value
Table_open_cache_hits	0
SHOW STATUS like 'Opened_tables';
Variable_name	Value
Opened_tables	0

#CASE6: check in debug mode

LOCK TABLE t1 WRITE;
SELECT * FROM t1 ORDER BY 1;
a
1
2
SET GLOBAL DEBUG='d,debug_test_cleanup_connection';
resetconnection;
SET GLOBAL DEBUG='';

Bug #17653288 MYSQL_RESET_CONNECTION DOES NOT RESET LAST_INSERT_ID

CREATE TABLE t2(a int not null auto_increment, key(a));
SHOW SESSION VARIABLES like 'last_insert_id';
Variable_name	Value
last_insert_id	0
INSERT INTO t2 VALUES (NULL);
INSERT INTO t2 VALUES (NULL);
SHOW SESSION VARIABLES like 'last_insert_id';
Variable_name	Value
last_insert_id	2
resetconnection;
SHOW SESSION VARIABLES like 'last_insert_id';
Variable_name	Value
last_insert_id	0
INSERT INTO t2 VALUES (NULL), (NULL);
SHOW SESSION VARIABLES like 'last_insert_id';
Variable_name	Value
last_insert_id	3
resetconnection;
SHOW SESSION VARIABLES like 'last_insert_id';
Variable_name	Value
last_insert_id	0
DROP TABLE t2;
CREATE TABLE t2(a int not null auto_increment, key(a));
SET INSERT_ID=12;
INSERT INTO t2 VALUES (NULL);
SELECT * FROM t2;
a
12
DROP TABLE t2;
CREATE TABLE t2(a int not null auto_increment, key(a));
SET INSERT_ID=12;
resetconnection
INSERT INTO t2 VALUES (NULL);
SELECT * FROM t2;
a
1
DROP TABLE t2;
DROP TABLE IF EXISTS t1;
DROP DATABASE wl6797;

# Bug 17772561 RESET CONNECTION ERROR HANDLING CAN BE MORE INFORMATIVE
# FOR ERROR CASES

create user 'user_wl6797'@'localhost';
grant all privileges on *.* to  'user_wl6797'@'localhost';
ALTER USER user_wl6797@localhost PASSWORD EXPIRE;
mysqltest: At line 1: reset connection failed: You must reset your password using ALTER USER statement before executing this statement.
DROP USER user_wl6797@localhost;

Bug #18329348 RESETCONNECTION DOESN'T CLEAR TIMESTAMP
Bug #18329560 RESETCONNECTION DOESN'T CLEAR RAND SEED
Bug #18328396 RESETCONNECTION DOESN'T CLEAR WARNINGS
Bug #18329452 RESETCONNECTION DOESN'T CLEAR PROFILING

SET TIMESTAMP=200;
SELECT @@TIMESTAMP;
@@TIMESTAMP
200.000000
resetconnection
SELECT @@TIMESTAMP=200;
@@TIMESTAMP=200
0
CREATE DATABASE T18329560;
USE T18329560;
CREATE TABLE T(a DOUBLE);
SET SESSION RAND_SEED1=1;
SET SESSION RAND_SEED2=1;
INSERT INTO T VALUES(rand());
SET SESSION RAND_SEED1=1;
SET SESSION RAND_SEED2=1;
resetconnection
SELECT IF(a=rand(),'1','0') FROM T;
IF(a=rand(),'1','0')
0
DROP TABLE T;
DROP DATABASE T18329560;
SET SESSION SORT_BUFFER_SIZE= 1;
Warnings:
Warning	1292	Truncated incorrect sort_buffer_size value: '1'
SHOW WARNINGS;
Level	Code	Message
Warning	1292	Truncated incorrect sort_buffer_size value: '1'
resetconnection
SHOW WARNINGS;
Level	Code	Message
SET PROFILING=1;
Warnings:
Warning	1287	'@@profiling' is deprecated and will be removed in a future release.
SELECT 1;
1
1
SHOW PROFILES;
Query_ID	Duration	Query
1	#	SHOW WARNINGS
2	#	SELECT 1
Warnings:
Warning	#	'SHOW PROFILES' is deprecated and will be removed in a future release. Please use Performance Schema instead
resetconnection
SELECT 2;
2
2
SHOW PROFILES;
Query_ID	Duration	Query
Warnings:
Warning	#	'SHOW PROFILES' is deprecated and will be removed in a future release. Please use Performance Schema instead

End of tests