List:Commits« Previous MessageNext Message »
From:igor Date:April 19 2006 5:57am
Subject:bk commit into 4.1 tree (igor:1.2464) BUG#19079
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of igor. When igor does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2464 06/04/18 20:57:31 igor@stripped +3 -0
  Fixed bug #19079.
  The bug caused a reported index corruption in the cases when
  key_cache_block_size was not a multiple of myisam_block_size,
  e.g. when key_cache_block_size=1536 while myisam_block_size=1024.

  mysys/mf_keycache.c
    1.53 06/04/18 20:57:27 igor@stripped +7 -5
    Fixed bug #19079.
    The bug caused a reported index corruption in the cases when
    key_cache_block_size was not a multiple of myisam_block_size,
    e.g. when key_cache_block_size=1536 while myisam_block_size=1024.

  mysql-test/t/key_cache.test
    1.17 06/04/18 20:57:27 igor@stripped +40 -1
    Added a test case for bug #19079.

  mysql-test/r/key_cache.result
    1.15 06/04/18 20:57:27 igor@stripped +42 -0
    Added a test case for bug #19079.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	igor
# Host:	rurik.mysql.com
# Root:	/home/igor/dev/mysql-4.1-2

--- 1.52/mysys/mf_keycache.c	2005-09-14 04:18:11 -07:00
+++ 1.53/mysys/mf_keycache.c	2006-04-18 20:57:27 -07:00
@@ -1741,6 +1741,7 @@
     uint status;
     int page_st;
 
+    offset= (uint) (filepos & (keycache->key_cache_block_size-1));
     /* Read data in key_cache_block_size increments */
     do
     {
@@ -1750,7 +1751,6 @@
 	keycache_pthread_mutex_unlock(&keycache->cache_lock);
 	goto no_key_cache;
       }
-      offset= (uint) (filepos & (keycache->key_cache_block_size-1));
       filepos-= offset;
       read_length= length;
       set_if_smaller(read_length, keycache->key_cache_block_size-offset);
@@ -1826,6 +1826,7 @@
 #endif
       buff+= read_length;
       filepos+= read_length+offset;
+      offset= 0;
 
     } while ((length-= read_length));
     DBUG_RETURN(start);
@@ -1877,17 +1878,17 @@
     uint read_length;
     int page_st;
     int error;
+    uint offset;
 
+    offset= (uint) (filepos & (keycache->key_cache_block_size-1));
     do
     {
-      uint offset;
       keycache_pthread_mutex_lock(&keycache->cache_lock);
       if (!keycache->can_be_used)
       {
 	keycache_pthread_mutex_unlock(&keycache->cache_lock);
 	DBUG_RETURN(0);
       }
-      offset= (uint) (filepos & (keycache->key_cache_block_size-1));
       /* Read data into key cache from buff in key_cache_block_size incr. */
       filepos-= offset;
       read_length= length;
@@ -1945,6 +1946,7 @@
 
       buff+= read_length;
       filepos+= read_length+offset;
+      offset= 0;
 
     } while ((length-= read_length));
   }
@@ -2011,17 +2013,17 @@
     /* Key cache is used */
     uint read_length;
     int page_st;
+    uint offset;
 
+    offset= (uint) (filepos & (keycache->key_cache_block_size-1));
     do
     {
-      uint offset;
       keycache_pthread_mutex_lock(&keycache->cache_lock);
       if (!keycache->can_be_used)
       {
 	keycache_pthread_mutex_unlock(&keycache->cache_lock);
 	goto no_key_cache;
       }
-      offset= (uint) (filepos & (keycache->key_cache_block_size-1));
       /* Write data in key_cache_block_size increments */
       filepos-= offset;
       read_length= length;

--- 1.14/mysql-test/r/key_cache.result	2005-07-25 11:25:23 -07:00
+++ 1.15/mysql-test/r/key_cache.result	2006-04-18 20:57:27 -07:00
@@ -287,3 +287,45 @@
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 drop table t1;
+CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
+SET GLOBAL key_cache_block_size=1536;
+INSERT INTO t1 VALUES (1);
+SELECT @@key_cache_block_size;
+@@key_cache_block_size
+1536
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+DROP TABLE t1;
+CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
+CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
+SET GLOBAL key_cache_block_size=1536;
+INSERT INTO t1 VALUES (1,0);
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4181
+SELECT @@key_cache_block_size;
+@@key_cache_block_size
+1536
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+DROP TABLE t1,t2;

--- 1.16/mysql-test/t/key_cache.test	2005-07-27 17:21:43 -07:00
+++ 1.17/mysql-test/t/key_cache.test	2006-04-18 20:57:27 -07:00
@@ -149,6 +149,7 @@
 --replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED
1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
 show status like 'key_blocks_unused';
 
+
 # Cleanup
 # We don't reset keycache2 as we want to ensure that mysqld will reset it
 set global keycache2.key_buffer_size=0;
@@ -157,7 +158,7 @@
 set global keycache3.key_buffer_size=100;
 set global keycache3.key_buffer_size=0;
 
-# Test case for buf 6447
+# Test case for bug 6447
 
 create table t1 (mytext text, FULLTEXT (mytext));
 insert t1 values ('aaabbb');
@@ -167,5 +168,43 @@
 check table t1;
 
 drop table t1;
+
+#
+# Bug #19079: corrupted index when key_cache_block_size is not multiple of
+#             myisam_block_size
+
+CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
+SET GLOBAL key_cache_block_size=1536;
+INSERT INTO t1 VALUES (1);
+SELECT @@key_cache_block_size;
+CHECK TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
+CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
+SET GLOBAL key_cache_block_size=1536;
+INSERT INTO t1 VALUES (1,0);
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+INSERT INTO t2(b) SELECT b FROM t1;
+INSERT INTO t1(b) SELECT b FROM t2;
+SELECT COUNT(*) FROM t1;
+SELECT @@key_cache_block_size;
+CHECK TABLE t1;
+DROP TABLE t1,t2;
 
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (igor:1.2464) BUG#19079igor19 Apr