List:Commits« Previous MessageNext Message »
From:Karen Langford Date:January 11 2012 5:52pm
Subject:bzr push into mysql-5.5 branch (karen.langford:3680 to 3681)
View as plain text  
 3681 hery.ramilison@stripped	2012-01-11 [merge]
      Merge from mysql-5.5.20-release

    modified:
      mysql-test/r/key_cache.result
      mysql-test/r/mysqlcheck.result
      mysql-test/r/partition_key_cache.result
      mysql-test/t/key_cache.test
      mysql-test/t/mysqlcheck.test
      mysql-test/t/partition_key_cache.test
      sql/sql_admin.cc
      storage/myisam/mi_preload.c
 3680 Nirbhay Choubey	2012-01-10 [merge]
      Merge of fix for bug#11760384 from mysql-5.1.

    modified:
      client/mysqldump.c
      mysql-test/r/mysqldump.result
      mysql-test/t/mysqldump.test
=== modified file 'mysql-test/r/key_cache.result'
--- a/mysql-test/r/key_cache.result	2010-11-25 03:50:16 +0000
+++ b/mysql-test/r/key_cache.result	2011-12-14 14:33:01 +0000
@@ -383,3 +383,19 @@ Variable_name	Value
 key_cache_block_size	1536
 SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
 DROP TABLE t1;
+#
+# Bug#12361113: crash when load index into cache
+#
+# Note that this creates an empty disabled key cache!
+SET GLOBAL key_cache_none.key_cache_block_size = 1024;
+CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) ) ENGINE = MYISAM;
+INSERT INTO t1 VALUES (1, 1);
+CACHE INDEX t1 in key_cache_none;
+ERROR HY000: Unknown key cache 'key_cache_none'
+# The bug crashed the server at LOAD INDEX below. Now it will succeed 
+# since the default cache is used due to CACHE INDEX failed for
+# key_cache_none.
+LOAD INDEX INTO CACHE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	preload_keys	status	OK
+DROP TABLE t1;

=== modified file 'mysql-test/r/mysqlcheck.result'
--- a/mysql-test/r/mysqlcheck.result	2011-03-08 08:41:57 +0000
+++ b/mysql-test/r/mysqlcheck.result	2011-12-15 16:12:04 +0000
@@ -206,6 +206,7 @@ DROP TABLE `@`;
 CREATE TABLE `� --default-character-set="latin1" --databases test
+call mtr.add_suppression("Can't find file: '..test.@003f.frm'");
 test.?
 Error    : Table doesn't exist
 status   : Operation failed

=== modified file 'mysql-test/r/partition_key_cache.result'
--- a/mysql-test/r/partition_key_cache.result	2009-12-22 09:35:56 +0000
+++ b/mysql-test/r/partition_key_cache.result	2011-12-14 14:33:01 +0000
@@ -397,6 +397,33 @@ test.t1	assign_to_keycache	error	Subpart
 test.t1	assign_to_keycache	Error	Key 'inx_b' doesn't exist in table 't1'
 test.t1	assign_to_keycache	status	Operation failed
 DROP TABLE t1,t2;
+#
+# Bug#12361113: crash when load index into cache
+#
+# Note that this creates an empty disabled key cache!
+SET GLOBAL key_cache_none.key_cache_block_size = 1024;
+CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) )
+ENGINE = MYISAM
+PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 VALUES (1, 1);
+CACHE INDEX t1 IN key_cache_none;
+ERROR HY000: Unknown key cache 'key_cache_none'
+CACHE INDEX t1 PARTITION (p0) IN key_cache_none;
+ERROR HY000: Unknown key cache 'key_cache_none'
+CACHE INDEX t1 PARTITION (p1) IN key_cache_none;
+ERROR HY000: Unknown key cache 'key_cache_none'
+CACHE INDEX t1 PARTITION (p0) KEY (`b`) IN key_cache_none;
+ERROR HY000: Unknown key cache 'key_cache_none'
+CACHE INDEX t1 PARTITION (p1) KEY (`b`) IN key_cache_none;
+ERROR HY000: Unknown key cache 'key_cache_none'
+# The bug crashed the server at LOAD INDEX below. Now it will succeed
+# since the default cache is used due to CACHE INDEX failed for
+# key_cache_none.
+LOAD INDEX INTO CACHE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	preload_keys	status	OK
+DROP TABLE t1;
+# Clean up
 SET GLOBAL hot_cache.key_buffer_size = 0;
 SET GLOBAL warm_cache.key_buffer_size = 0;
 SET @@global.cold_cache.key_buffer_size = 0;

=== modified file 'mysql-test/t/key_cache.test'
--- a/mysql-test/t/key_cache.test	2010-11-25 03:50:16 +0000
+++ b/mysql-test/t/key_cache.test	2011-12-14 14:33:01 +0000
@@ -251,3 +251,19 @@ SET GLOBAL key_cache_block_size= @bug284
 DROP TABLE t1;
 
 # End of 4.1 tests
+
+--echo #
+--echo # Bug#12361113: crash when load index into cache
+--echo #
+
+--echo # Note that this creates an empty disabled key cache!
+SET GLOBAL key_cache_none.key_cache_block_size = 1024;
+CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) ) ENGINE = MYISAM;
+INSERT INTO t1 VALUES (1, 1);
+--error ER_UNKNOWN_KEY_CACHE
+CACHE INDEX t1 in key_cache_none;
+--echo # The bug crashed the server at LOAD INDEX below. Now it will succeed 
+--echo # since the default cache is used due to CACHE INDEX failed for
+--echo # key_cache_none.
+LOAD INDEX INTO CACHE t1;
+DROP TABLE t1;

=== modified file 'mysql-test/t/mysqlcheck.test'
--- a/mysql-test/t/mysqlcheck.test	2011-03-08 08:41:57 +0000
+++ b/mysql-test/t/mysqlcheck.test	2011-12-15 16:12:04 +0000
@@ -146,6 +146,7 @@ CREATE TABLE `��` (a INT) engine=myisam;
 SET NAMES DEFAULT;
 --echo mysqlcheck --default-character-set="latin1" --databases test
 # Error returned depends on platform, replace it with "Table doesn't exist"
+call mtr.add_suppression("Can't find file: '..test.@003f.frm'");
 --replace_result "Can't find file: './test/@003f.frm' (errno: 22)" "Table doesn't exist" "Table 'test.?' doesn't exist" "Table doesn't exist"
 --exec $MYSQL_CHECK --default-character-set="latin1" --databases test
 --echo mysqlcheck --default-character-set="utf8" --databases test

=== modified file 'mysql-test/t/partition_key_cache.test'
--- a/mysql-test/t/partition_key_cache.test	2009-12-22 09:35:56 +0000
+++ b/mysql-test/t/partition_key_cache.test	2011-12-14 14:33:01 +0000
@@ -239,6 +239,34 @@ CACHE INDEX t2 INDEX (`inx_b`) IN hot_ca
 CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
 CACHE INDEX t1 INDEX (`inx_b`) IN hot_cache;
 DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug#12361113: crash when load index into cache
+--echo #
+--echo # Note that this creates an empty disabled key cache!
+SET GLOBAL key_cache_none.key_cache_block_size = 1024;
+CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) )
+ENGINE = MYISAM
+PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 VALUES (1, 1);
+--error ER_UNKNOWN_KEY_CACHE
+CACHE INDEX t1 IN key_cache_none;
+--error ER_UNKNOWN_KEY_CACHE
+CACHE INDEX t1 PARTITION (p0) IN key_cache_none;
+--error ER_UNKNOWN_KEY_CACHE
+CACHE INDEX t1 PARTITION (p1) IN key_cache_none;
+--error ER_UNKNOWN_KEY_CACHE
+CACHE INDEX t1 PARTITION (p0) KEY (`b`) IN key_cache_none;
+--error ER_UNKNOWN_KEY_CACHE
+CACHE INDEX t1 PARTITION (p1) KEY (`b`) IN key_cache_none;
+--echo # The bug crashed the server at LOAD INDEX below. Now it will succeed
+--echo # since the default cache is used due to CACHE INDEX failed for
+--echo # key_cache_none.
+LOAD INDEX INTO CACHE t1;
+DROP TABLE t1;
+
+
+--echo # Clean up
 SET GLOBAL hot_cache.key_buffer_size = 0;
 SET GLOBAL warm_cache.key_buffer_size = 0;
 SET @@global.cold_cache.key_buffer_size = 0;

=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc	2011-06-30 15:46:53 +0000
+++ b/sql/sql_admin.cc	2011-12-14 14:33:01 +0000
@@ -911,6 +911,11 @@ bool mysql_assign_to_keycache(THD* thd,
     DBUG_RETURN(TRUE);
   }
   mysql_mutex_unlock(&LOCK_global_system_variables);
+  if (!key_cache->key_cache_inited)
+  {
+    my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str);
+    DBUG_RETURN(true);
+  }
   check_opt.key_cache= key_cache;
   DBUG_RETURN(mysql_admin_table(thd, tables, &check_opt,
 				"assign_to_keycache", TL_READ_NO_INSERT, 0, 0,

=== modified file 'storage/myisam/mi_preload.c'
--- a/storage/myisam/mi_preload.c	2011-06-30 15:46:53 +0000
+++ b/storage/myisam/mi_preload.c	2011-12-14 14:33:01 +0000
@@ -53,6 +53,9 @@ int mi_preload(MI_INFO *info, ulonglong
   if (!keys || !mi_is_any_key_active(key_map) || key_file_length == pos)
     DBUG_RETURN(0);
 
+  /* Preload into a non initialized key cache should never happen. */
+  DBUG_ASSERT(share->key_cache->key_cache_inited);
+
   block_length= keyinfo[0].block_length;
 
   if (ignore_leaves)

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5 branch (karen.langford:3680 to 3681) Karen Langford12 Jan