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 -- source include/have_innodb.inc
6
7 # numbers read in this test depend on the page size
8 -- source include/have_innodb_16k.inc
9 # include/restart_mysqld.inc does not work in embedded mode
10 -- source include/not_embedded.inc
11 --source include/test_db_charset_latin1.inc
12
13 -- vertical_results
14
15 SET @save_enabled= @@GLOBAL.innodb_cmp_per_index_enabled;
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 --disable_query_log
29 SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
30 SET GLOBAL innodb_read_only_compressed=OFF;
31 --enable_query_log
32 # create a table that uses compression
33 CREATE TABLE t (
34 a INT,
35 b VARCHAR(512),
36 c VARCHAR(16),
37 PRIMARY KEY (a),
38 INDEX (b(512)),
39 INDEX (c(16))
40 ) ENGINE=INNODB KEY_BLOCK_SIZE=2;
41
42 SELECT
43 database_name,
44 table_name,
45 index_name,
46 compress_ops,
47 compress_ops_ok,
48 uncompress_ops
49 FROM information_schema.innodb_cmp_per_index
50 ORDER BY 1, 2, 3;
51
52 # insert some data into it
53 BEGIN;
54 -- disable_query_log
55 let $i=128;
56 while ($i)
57 {
58 -- eval INSERT INTO t VALUES ($i, REPEAT('x', 512), NULL);
59 dec $i;
60 }
61 -- enable_query_log
62 COMMIT;
63
64 ALTER TABLE t DROP INDEX c;
65 --disable_query_log
66 SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
67 --enable_query_log
68
69 GRANT USAGE ON *.* TO 'tuser01'@'localhost' IDENTIFIED BY 'cDJvI9s_Uq';
70 FLUSH PRIVILEGES;
71
72 -- connect (con1,localhost,tuser01,cDJvI9s_Uq,)
73 -- connection con1
74
75 -- error ER_SPECIFIC_ACCESS_DENIED_ERROR
76 SELECT * FROM information_schema.innodb_cmp_per_index;
77
78 -- connection default
79 -- disconnect con1
80
81 DROP USER 'tuser01'@'localhost';
82
83 SELECT
84 database_name,
85 table_name,
86 index_name,
87 compress_ops,
88 compress_ops_ok,
89 uncompress_ops
90 FROM information_schema.innodb_cmp_per_index
91 ORDER BY 1, 2, 3;
92 DROP TABLE t;
93
94 SET GLOBAL innodb_cmp_per_index_enabled=@save_enabled;
95
96 --source include/test_db_charset_restore.inc