Debian Codegraph @

mysql-test/suite/innodb_zip/t/cmp_per_index.test

raw
1 #
2 # Test information_schema.innodb_cmp_per_index
3 #
4
5 # numbers read in this test depend on the page size
6
7 # Using innodb_log_compressed=0 leads to a larger number of page
8 # compressions, because page_cur_insert_rec_zip() will reorganize the
9 # page before attempting an insert followed by page compression and
10 # page_zip_compress_write_log_no_data().
11 select @@global.innodb_log_compressed_pages into @save_innodb_log_compressed_pages;
12 SET @@global.innodb_log_compressed_pages=1;
13
14 -- vertical_results
15
16 SET GLOBAL innodb_cmp_per_index_enabled=ON;
17
18 # reset any leftover stats from previous tests
19 -- disable_query_log
20 -- disable_result_log
21 SELECT * FROM information_schema.innodb_cmp_per_index_reset;
22 -- enable_result_log
23 -- enable_query_log
24
25 # see that the table is empty
26 SELECT * FROM information_schema.innodb_cmp_per_index;
27
28 # create a table that uses compression
29 CREATE TABLE t (
30 a INT,
31 b VARCHAR(512),
32 c VARCHAR(16),
33 PRIMARY KEY (a),
34 INDEX (b(512)),
35 INDEX (c(16))
36 ) charset latin1 ENGINE=INNODB KEY_BLOCK_SIZE=2;
37
38 SELECT
39 database_name,
40 table_name,
41 index_name,
42 compress_ops,
43 compress_ops_ok,
44 uncompress_ops
45 FROM information_schema.innodb_cmp_per_index
46 ORDER BY 1, 2, 3;
47
48 # insert some data into it
49 BEGIN;
50 -- disable_query_log
51 let $i=128;
52 while ($i)
53 {
54 -- eval INSERT INTO t VALUES ($i, REPEAT('x', 512), NULL);
55 dec $i;
56 }
57 -- enable_query_log
58 COMMIT;
59
60 ALTER TABLE t DROP INDEX c;
61
62 CREATE USER 'tuser01'@'localhost' IDENTIFIED BY 'cDJvI9s_Uq';
63 FLUSH PRIVILEGES;
64
65 -- connect (con1,localhost,tuser01,cDJvI9s_Uq,)
66 -- connection con1
67
68 -- error ER_SPECIFIC_ACCESS_DENIED_ERROR
69 SELECT * FROM information_schema.innodb_cmp_per_index;
70
71 -- connection default
72 -- disconnect con1
73
74 DROP USER 'tuser01'@'localhost';
75
76 SELECT
77 database_name,
78 table_name,
79 index_name,
80 CASE WHEN compress_ops=47 and @@innodb_compression_level IN (4,8,9) THEN 65
81 ELSE compress_ops END as compress_ops,
82 CASE WHEN compress_ops_ok=47 and @@innodb_compression_level IN (4,8,9) THEN 65
83 ELSE compress_ops_ok END as compress_ops_ok,
84 uncompress_ops
85 FROM information_schema.innodb_cmp_per_index
86 ORDER BY 1, 2, 3;
87
88 SET GLOBAL innodb_log_compressed_pages=@save_innodb_log_compressed_pages;
89
90 --disable_testcase BUG#28624115
91
92 # restart mysqld and see that uncompress ops also gets increased when
93 # selecting from the table again
94
95 -- source include/restart_mysqld.inc
96
97 SET GLOBAL innodb_cmp_per_index_enabled=ON;
98
99 #Force table to use primary key
100 CREATE TABLE tmp_table SELECT * FROM t;
101
102 SELECT
103 database_name,
104 table_name,
105 index_name,
106 compress_ops,
107 compress_ops_ok,
108 CASE WHEN uncompress_ops=6 and @@innodb_compression_level IN (4,8,9) THEN 9
109 ELSE uncompress_ops END as uncompress_ops
110 FROM information_schema.innodb_cmp_per_index
111 ORDER BY 1, 2, 3;
112
113 DROP TABLE tmp_table;
114
115 --enable_testcase
116
117 DROP TABLE t;
118
119 SET GLOBAL innodb_cmp_per_index_enabled=default;