Skip to content

Commit 61a880d

Browse files
committed
Merge branch 'merge-perfschema-5.6' into 10.0
2 parents b3f4cf7 + 51ed64a commit 61a880d

File tree

4 files changed

+323
-0
lines changed

4 files changed

+323
-0
lines changed

mysql-test/suite/perfschema/r/sizing_low.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ Performance_schema_table_instances_lost 0
6767
Performance_schema_thread_classes_lost 0
6868
Performance_schema_thread_instances_lost 0
6969
Performance_schema_users_lost 0
70+
CALL mtr.add_suppression("innodb_open_files should not be greater than the open_files_limit.");
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
2+
#
3+
# TEST 1: Normal tables prefixed with "#sql" and "sql".
4+
#
5+
USE test;
6+
CREATE TABLE `#sql_1` (a int, b text);
7+
INSERT INTO `#sql_1` VALUES(1,'one');
8+
9+
CREATE TABLE `sql_1` (a int, b text);
10+
INSERT INTO `sql_1` VALUES(1,'one');
11+
12+
# Verify that the tables are treated as normal tables .
13+
14+
SELECT object_type, object_schema, object_name
15+
FROM performance_schema.objects_summary_global_by_type
16+
WHERE object_schema="test";
17+
object_type object_schema object_name
18+
TABLE test #sql_1
19+
TABLE test sql_1
20+
21+
# Drop the tables, verify that the table objects are removed.
22+
23+
DROP TABLE `#sql_1`;
24+
DROP TABLE `sql_1`;
25+
26+
SELECT object_type, object_schema, object_name
27+
FROM performance_schema.objects_summary_global_by_type
28+
WHERE object_schema="test";
29+
object_type object_schema object_name
30+
31+
#
32+
# TEST 2: Temporary tables, no special prefix.
33+
#
34+
CREATE TEMPORARY TABLE sql_temp2_myisam (a int, b text) ENGINE=MYISAM;
35+
INSERT INTO sql_temp2_myisam VALUES(1,'one');
36+
37+
CREATE TEMPORARY TABLE sql_temp2_innodb (a int, b text) ENGINE=INNODB;
38+
INSERT INTO sql_temp2_innodb VALUES(1,'one');
39+
40+
# Confirm that the temporary tables are ignored.
41+
42+
SELECT object_type, object_schema, object_name
43+
FROM performance_schema.objects_summary_global_by_type
44+
WHERE object_schema="test";
45+
object_type object_schema object_name
46+
47+
# Drop the tables, verify that the table objects are not created.
48+
49+
DROP TABLE sql_temp2_myisam;
50+
DROP TABLE sql_temp2_innodb;
51+
52+
SELECT object_type, object_schema, object_name
53+
FROM performance_schema.objects_summary_global_by_type
54+
WHERE object_schema="test";
55+
object_type object_schema object_name
56+
57+
#
58+
# TEST 3: Temporary tables with the "#sql" prefix.
59+
#
60+
CREATE TEMPORARY TABLE `#sql_temp3_myisam` (a int, b text) ENGINE=MYISAM;
61+
CHECK TABLE `#sql_temp3_myisam`;
62+
Table Op Msg_type Msg_text
63+
test.#sql_temp3_myisam check status OK
64+
INSERT INTO `#sql_temp3_myisam` VALUES(1,'one');
65+
66+
CREATE TEMPORARY TABLE `#sql_temp3_innodb` (a int, b text) ENGINE=INNODB;
67+
CHECK TABLE `#sql_temp3_innodb`;
68+
Table Op Msg_type Msg_text
69+
test.#sql_temp3_innodb check status OK
70+
INSERT INTO `#sql_temp3_innodb` VALUES(1,'one');
71+
72+
# Confirm that the temporary tables are ignored.
73+
74+
SELECT object_type, object_schema, object_name
75+
FROM performance_schema.objects_summary_global_by_type
76+
WHERE object_schema="test";
77+
object_type object_schema object_name
78+
79+
# Drop the temporary tables.
80+
81+
DROP TABLE `#sql_temp3_myisam`;
82+
DROP TABLE `#sql_temp3_innodb`;
83+
84+
# Confirm that the temporary tables are still ignored.
85+
86+
SELECT object_type, object_schema, object_name
87+
FROM performance_schema.objects_summary_global_by_type
88+
WHERE object_schema="test";
89+
object_type object_schema object_name
90+
91+
#
92+
# TEST 4: Special case: MyISAM temporary tables are recreated as non-temporary
93+
# when they are truncated.
94+
#
95+
CREATE TEMPORARY TABLE `sql_temp4_myisam` (a int, b text) ENGINE=MYISAM;
96+
INSERT INTO `sql_temp4_myisam` VALUES(1,'one');
97+
98+
CREATE TEMPORARY TABLE `#sql_temp4_myisam` (a int, b text) ENGINE=MYISAM;
99+
INSERT INTO `#sql_temp4_myisam` VALUES(1,'one');
100+
101+
# Confirm that the MyISAM temporary tables are ignored.
102+
103+
SELECT object_type, object_schema, object_name
104+
FROM performance_schema.objects_summary_global_by_type
105+
WHERE object_schema="test";
106+
object_type object_schema object_name
107+
108+
# Truncate the MyISAM temporary tables, forcing them to be recreated as non-temporary.
109+
110+
TRUNCATE TABLE `sql_temp4_myisam`;
111+
TRUNCATE TABLE `#sql_temp4_myisam`;
112+
113+
# Confirm that the recreated MyISAM tables are still regarded as temporary and ignored.
114+
115+
SELECT object_type, object_schema, object_name
116+
FROM performance_schema.objects_summary_global_by_type
117+
WHERE object_schema="test";
118+
object_type object_schema object_name
119+
120+
# Drop the recreated MyISAM tables;
121+
122+
DROP TABLE `sql_temp4_myisam`;
123+
DROP TABLE `#sql_temp4_myisam`;
124+
125+
# Confirm that the recreated temporary tables are still ignored.
126+
127+
SELECT object_type, object_schema, object_name
128+
FROM performance_schema.objects_summary_global_by_type
129+
WHERE object_schema="test";
130+
object_type object_schema object_name
131+
132+
#
133+
# TEST 5: Generate temporary tables with ALTER MyISAM table.
134+
#
135+
USE test;
136+
CREATE TABLE t1 (a int) ENGINE=MYISAM;
137+
INSERT INTO t1 VALUES (1), (2), (3);
138+
ALTER TABLE t1 ADD COLUMN (b int);
139+
140+
# Confirm that the recreated temporary tables are still ignored.
141+
142+
SELECT object_type, object_schema, object_name
143+
FROM performance_schema.objects_summary_global_by_type
144+
WHERE object_schema="test";
145+
object_type object_schema object_name
146+
147+
# Drop the MyISAM table
148+
149+
DROP TABLE t1;
150+
151+
# Confirm that no tables remain;
152+
153+
SELECT object_type, object_schema, object_name
154+
FROM performance_schema.objects_summary_global_by_type
155+
WHERE object_schema="test";
156+
object_type object_schema object_name

mysql-test/suite/perfschema/t/sizing_low.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77

88
--source ../include/sizing_auto.inc
99

10+
CALL mtr.add_suppression("innodb_open_files should not be greater than the open_files_limit.");
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
#
2+
# Performance Schema
3+
#
4+
# Verify that the Performance Schema correctly identifies normal and temporary
5+
# tables with non-standard names.
6+
7+
# The server uses the table name prefix "#sql" for temporary and intermediate
8+
# tables, however user-defined tables having the "#sql" prefix are also permitted.
9+
# Independent of the table name, temporary or intermediate tables always have the
10+
# "#sql" prefix in the filename. (For non-temporary tables starting with "#",
11+
# the "#" is encoded to @0023 in the filename.)
12+
#
13+
# Given the ambiguity with temporary table names, the Performance Schema identifies
14+
# temporary tables tables either by the table category or by the filename.
15+
#
16+
--source include/have_perfschema.inc
17+
--source include/have_innodb.inc
18+
--source include/not_embedded.inc
19+
20+
--echo
21+
--echo #
22+
--echo # TEST 1: Normal tables prefixed with "#sql" and "sql".
23+
--echo #
24+
USE test;
25+
CREATE TABLE `#sql_1` (a int, b text);
26+
# INSERT forces path through get_table_share()
27+
INSERT INTO `#sql_1` VALUES(1,'one');
28+
--echo
29+
CREATE TABLE `sql_1` (a int, b text);
30+
INSERT INTO `sql_1` VALUES(1,'one');
31+
--echo
32+
--echo # Verify that the tables are treated as normal tables .
33+
--echo
34+
SELECT object_type, object_schema, object_name
35+
FROM performance_schema.objects_summary_global_by_type
36+
WHERE object_schema="test";
37+
--echo
38+
--echo # Drop the tables, verify that the table objects are removed.
39+
--echo
40+
DROP TABLE `#sql_1`;
41+
DROP TABLE `sql_1`;
42+
--echo
43+
SELECT object_type, object_schema, object_name
44+
FROM performance_schema.objects_summary_global_by_type
45+
WHERE object_schema="test";
46+
47+
--echo
48+
--echo #
49+
--echo # TEST 2: Temporary tables, no special prefix.
50+
--echo #
51+
CREATE TEMPORARY TABLE sql_temp2_myisam (a int, b text) ENGINE=MYISAM;
52+
INSERT INTO sql_temp2_myisam VALUES(1,'one');
53+
--echo
54+
CREATE TEMPORARY TABLE sql_temp2_innodb (a int, b text) ENGINE=INNODB;
55+
INSERT INTO sql_temp2_innodb VALUES(1,'one');
56+
--echo
57+
--echo # Confirm that the temporary tables are ignored.
58+
--echo
59+
SELECT object_type, object_schema, object_name
60+
FROM performance_schema.objects_summary_global_by_type
61+
WHERE object_schema="test";
62+
--echo
63+
--echo # Drop the tables, verify that the table objects are not created.
64+
--echo
65+
DROP TABLE sql_temp2_myisam;
66+
DROP TABLE sql_temp2_innodb;
67+
--echo
68+
SELECT object_type, object_schema, object_name
69+
FROM performance_schema.objects_summary_global_by_type
70+
WHERE object_schema="test";
71+
72+
--echo
73+
--echo #
74+
--echo # TEST 3: Temporary tables with the "#sql" prefix.
75+
--echo #
76+
CREATE TEMPORARY TABLE `#sql_temp3_myisam` (a int, b text) ENGINE=MYISAM;
77+
CHECK TABLE `#sql_temp3_myisam`;
78+
INSERT INTO `#sql_temp3_myisam` VALUES(1,'one');
79+
--echo
80+
CREATE TEMPORARY TABLE `#sql_temp3_innodb` (a int, b text) ENGINE=INNODB;
81+
CHECK TABLE `#sql_temp3_innodb`;
82+
INSERT INTO `#sql_temp3_innodb` VALUES(1,'one');
83+
--echo
84+
--echo # Confirm that the temporary tables are ignored.
85+
--echo
86+
SELECT object_type, object_schema, object_name
87+
FROM performance_schema.objects_summary_global_by_type
88+
WHERE object_schema="test";
89+
--echo
90+
--echo # Drop the temporary tables.
91+
--echo
92+
DROP TABLE `#sql_temp3_myisam`;
93+
DROP TABLE `#sql_temp3_innodb`;
94+
--echo
95+
--echo # Confirm that the temporary tables are still ignored.
96+
--echo
97+
SELECT object_type, object_schema, object_name
98+
FROM performance_schema.objects_summary_global_by_type
99+
WHERE object_schema="test";
100+
101+
--echo
102+
--echo #
103+
--echo # TEST 4: Special case: MyISAM temporary tables are recreated as non-temporary
104+
--echo # when they are truncated.
105+
--echo #
106+
CREATE TEMPORARY TABLE `sql_temp4_myisam` (a int, b text) ENGINE=MYISAM;
107+
INSERT INTO `sql_temp4_myisam` VALUES(1,'one');
108+
--echo
109+
CREATE TEMPORARY TABLE `#sql_temp4_myisam` (a int, b text) ENGINE=MYISAM;
110+
INSERT INTO `#sql_temp4_myisam` VALUES(1,'one');
111+
--echo
112+
--echo # Confirm that the MyISAM temporary tables are ignored.
113+
--echo
114+
SELECT object_type, object_schema, object_name
115+
FROM performance_schema.objects_summary_global_by_type
116+
WHERE object_schema="test";
117+
--echo
118+
--echo # Truncate the MyISAM temporary tables, forcing them to be recreated as non-temporary.
119+
--echo
120+
TRUNCATE TABLE `sql_temp4_myisam`;
121+
TRUNCATE TABLE `#sql_temp4_myisam`;
122+
--echo
123+
--echo # Confirm that the recreated MyISAM tables are still regarded as temporary and ignored.
124+
--echo
125+
SELECT object_type, object_schema, object_name
126+
FROM performance_schema.objects_summary_global_by_type
127+
WHERE object_schema="test";
128+
--echo
129+
--echo # Drop the recreated MyISAM tables;
130+
--echo
131+
DROP TABLE `sql_temp4_myisam`;
132+
DROP TABLE `#sql_temp4_myisam`;
133+
--echo
134+
--echo # Confirm that the recreated temporary tables are still ignored.
135+
--echo
136+
SELECT object_type, object_schema, object_name
137+
FROM performance_schema.objects_summary_global_by_type
138+
WHERE object_schema="test";
139+
140+
--echo
141+
--echo #
142+
--echo # TEST 5: Generate temporary tables with ALTER MyISAM table.
143+
--echo #
144+
USE test;
145+
CREATE TABLE t1 (a int) ENGINE=MYISAM;
146+
INSERT INTO t1 VALUES (1), (2), (3);
147+
# Force a path throug mysql_alter_table() and ha_create_table().
148+
ALTER TABLE t1 ADD COLUMN (b int);
149+
--echo
150+
--echo # Confirm that the recreated temporary tables are still ignored.
151+
--echo
152+
SELECT object_type, object_schema, object_name
153+
FROM performance_schema.objects_summary_global_by_type
154+
WHERE object_schema="test";
155+
--echo
156+
--echo # Drop the MyISAM table
157+
--echo
158+
DROP TABLE t1;
159+
160+
--echo
161+
--echo # Confirm that no tables remain;
162+
--echo
163+
SELECT object_type, object_schema, object_name
164+
FROM performance_schema.objects_summary_global_by_type
165+
WHERE object_schema="test";

0 commit comments

Comments
 (0)