summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorunknown <istruewing@chilla.local>2007-05-31 20:04:54 +0200
committerunknown <istruewing@chilla.local>2007-05-31 20:04:54 +0200
commit489a3fe4ee6b8243d026197f8f74a1e3aa30a4d8 (patch)
treefa7a327a0b4ab782ce7e0cdffe5bd4bd41b7f163 /mysql-test/r
parentb9ec849bb28a149652602de342300022416eca46 (diff)
downloadmariadb-git-489a3fe4ee6b8243d026197f8f74a1e3aa30a4d8.tar.gz
Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables
Setting a key_cache_block_size which is not a power of 2 could corrupt MyISAM tables. A couple of computations in the key cache code use bit operations which do only work if key_cache_block_size is a power of 2. Replaced bit operations by arithmetic operations to make key cache able to handle block sizes that are not a power of 2. include/keycache.h: Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables Removed element 'key_cache_shift' from KEY_CACHE after the changes in mf_keycache.c made it unused. mysql-test/r/key_cache.result: Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables Added test result mysql-test/t/key_cache.test: Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables Added test mysys/mf_keycache.c: Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables Replaced bit operations by arithmetic operations to make key cache able to handle block sizes that are not a power of 2.
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/key_cache.result27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
index a1bf3d0e128..1ab58c1ad6c 100644
--- a/mysql-test/r/key_cache.result
+++ b/mysql-test/r/key_cache.result
@@ -341,3 +341,30 @@ Warning 1438 Cannot drop default keycache
select @@global.key_buffer_size;
@@global.key_buffer_size
2097152
+SET @bug28478_key_cache_block_size= @@global.key_cache_block_size;
+SET GLOBAL key_cache_block_size= 1536;
+CREATE TABLE t1 (
+id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+c1 CHAR(150),
+c2 CHAR(150),
+c3 CHAR(150),
+KEY(c1, c2, c3)
+) ENGINE= MyISAM;
+INSERT INTO t1 (c1, c2, c3) VALUES
+('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'),
+('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j'),
+('i', 'j', 'k'), ('j', 'k', 'l'), ('k', 'l', 'm'), ('l', 'm', 'n'),
+('m', 'n', 'o'), ('n', 'o', 'p'), ('o', 'p', 'q'), ('p', 'q', 'r'),
+('q', 'r', 's'), ('r', 's', 't'), ('s', 't', 'u'), ('t', 'u', 'v'),
+('u', 'v', 'w'), ('v', 'w', 'x'), ('w', 'x', 'y'), ('x', 'y', 'z');
+INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
+INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
+INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SHOW VARIABLES LIKE 'key_cache_block_size';
+Variable_name Value
+key_cache_block_size 1536
+SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
+DROP TABLE t1;