~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Test of multiple key caches
3
#
4
--disable_warnings
5
drop table if exists t1, t2, t3;
6
--enable_warnings
7
8
SET @save_key_buffer=@@key_buffer_size;
9
1106.4.2 by Brian Aker
Remove multi key cache
10
SELECT @@key_buffer_size;
1 by brian
clean slate
11
12
# Change default key cache size
13
SET @@global.key_buffer_size=16*1024*1024;
14
15
# Drop buffer
1106.4.2 by Brian Aker
Remove multi key cache
16
SET @@global.key_buffer_size=0;
1 by brian
clean slate
17
# Test double drop
1106.4.2 by Brian Aker
Remove multi key cache
18
SET @@global.key_buffer_size=0;
1 by brian
clean slate
19
20
# Print key buffer with different syntaxes
21
SHOW VARIABLES like "key_buffer_size";
22
SELECT @@key_buffer_size;
23
SELECT @@global.key_buffer_size;
1106.4.2 by Brian Aker
Remove multi key cache
24
SELECT @@global.key_buffer_size;
25
SELECT @@global.`key_buffer_size`;
26
SELECT @@global.`key_buffer_size`;
27
SELECT @@key_buffer_size;
1 by brian
clean slate
28
1106.4.2 by Brian Aker
Remove multi key cache
29
SELECT @@key_buffer_size;
30
SELECT @@key_buffer_size;
1 by brian
clean slate
31
32
SET @@global.key_buffer_size=@save_key_buffer;
33
34
#
35
# Errors
36
#
37
1106.4.2 by Brian Aker
Remove multi key cache
38
SELECT @@key_buffer_size;
39
-- error 1272
1 by brian
clean slate
40
SELECT @@skr.storage_engine="test";
41
1106.4.2 by Brian Aker
Remove multi key cache
42
-- error 1272
43
select @@keycache1.key_cache_block_size;
1 by brian
clean slate
44
45
show status like 'key_blocks_used';
46
47
# Cleanup
48
# We don't reset keycache2 as we want to ensure that mysqld will reset it
1106.4.2 by Brian Aker
Remove multi key cache
49
set global key_buffer_size=0;
1 by brian
clean slate
50
51
# Test to set up a too small size for a key cache (bug #2064)
1106.4.2 by Brian Aker
Remove multi key cache
52
set global key_buffer_size=100;
53
set global key_buffer_size=0;
1 by brian
clean slate
54
55
# Restore the changed variable value
766 by Brian Aker
Fixed key_cache test
56
-- error 1232
1 by brian
clean slate
57
set global key_cache_block_size= @my_key_cache_block_size;
58
59
#
60
# Bug #19079: corrupted index when key_cache_block_size is not multiple of
61
#             myisam_block_size
62
1063.9.11 by Stewart Smith
fix key_cache test for MyISAM as temp only. Use MyISAM temp tables except for one place where we use default engine table to help load up a MyISAM table (as it uses key cache)
63
CREATE temporary TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=MYISAM;
1 by brian
clean slate
64
SET @my_key_cache_block_size= @@global.key_cache_block_size;
65
SET GLOBAL key_cache_block_size=1536;
66
INSERT INTO t1 VALUES (1);
67
SELECT @@key_cache_block_size;
68
CHECK TABLE t1;
69
DROP TABLE t1;
70
1063.9.11 by Stewart Smith
fix key_cache test for MyISAM as temp only. Use MyISAM temp tables except for one place where we use default engine table to help load up a MyISAM table (as it uses key cache)
71
CREATE TEMPORARY TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int) ENGINE=MYISAM;
72
CREATE TEMPORARY TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int) ENGINE=MYISAM;
1 by brian
clean slate
73
SET GLOBAL key_cache_block_size=1536;
74
INSERT INTO t1 VALUES (1,0);
75
INSERT INTO t2(b) SELECT b FROM t1;
76
INSERT INTO t1(b) SELECT b FROM t2;
77
INSERT INTO t2(b) SELECT b FROM t1;
78
INSERT INTO t1(b) SELECT b FROM t2;
79
INSERT INTO t2(b) SELECT b FROM t1;
80
INSERT INTO t1(b) SELECT b FROM t2;
81
INSERT INTO t2(b) SELECT b FROM t1;
82
INSERT INTO t1(b) SELECT b FROM t2;
83
INSERT INTO t2(b) SELECT b FROM t1;
84
INSERT INTO t1(b) SELECT b FROM t2;
85
INSERT INTO t2(b) SELECT b FROM t1;
86
INSERT INTO t1(b) SELECT b FROM t2;
87
INSERT INTO t2(b) SELECT b FROM t1;
88
INSERT INTO t1(b) SELECT b FROM t2;
89
INSERT INTO t2(b) SELECT b FROM t1;
90
INSERT INTO t1(b) SELECT b FROM t2;
91
INSERT INTO t2(b) SELECT b FROM t1;
92
INSERT INTO t1(b) SELECT b FROM t2;
93
SELECT COUNT(*) FROM t1;
94
SELECT @@key_cache_block_size;
95
CHECK TABLE t1;
96
DROP TABLE t1,t2;
97
# Restore changed variables
98
set global key_cache_block_size= @my_key_cache_block_size;
99
100
#
101
# Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
102
# (One cannot drop the default key cache.)
103
#
104
set @@global.key_buffer_size=0;
105
select @@global.key_buffer_size;
106
107
#
108
# Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables
109
#
110
SET @bug28478_key_cache_block_size= @@global.key_cache_block_size;
111
SET GLOBAL key_cache_block_size= 1536;
1063.9.11 by Stewart Smith
fix key_cache test for MyISAM as temp only. Use MyISAM temp tables except for one place where we use default engine table to help load up a MyISAM table (as it uses key cache)
112
CREATE TEMPORARY TABLE t1 (
1 by brian
clean slate
113
  id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
766 by Brian Aker
Fixed key_cache test
114
  c1 CHAR(50),
115
  c2 CHAR(50),
116
  c3 CHAR(50),
1 by brian
clean slate
117
  KEY(c1, c2, c3)
118
  ) ENGINE= MyISAM;
119
INSERT INTO t1 (c1, c2, c3) VALUES
120
  ('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'),
121
  ('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j'),
122
  ('i', 'j', 'k'), ('j', 'k', 'l'), ('k', 'l', 'm'), ('l', 'm', 'n'),
123
  ('m', 'n', 'o'), ('n', 'o', 'p'), ('o', 'p', 'q'), ('p', 'q', 'r'),
124
  ('q', 'r', 's'), ('r', 's', 't'), ('s', 't', 'u'), ('t', 'u', 'v'),
125
  ('u', 'v', 'w'), ('v', 'w', 'x'), ('w', 'x', 'y'), ('x', 'y', 'z');
1063.9.11 by Stewart Smith
fix key_cache test for MyISAM as temp only. Use MyISAM temp tables except for one place where we use default engine table to help load up a MyISAM table (as it uses key cache)
126
CREATE TABLE t2 AS SELECT * FROM t1;
127
INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t2;
128
INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t2;
129
INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t2;
1 by brian
clean slate
130
CHECK TABLE t1;
131
SHOW VARIABLES LIKE 'key_cache_block_size';
132
SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
1063.9.11 by Stewart Smith
fix key_cache test for MyISAM as temp only. Use MyISAM temp tables except for one place where we use default engine table to help load up a MyISAM table (as it uses key cache)
133
DROP TABLE t1,t2;
1 by brian
clean slate
134
135
# End of 4.1 tests