List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:February 12 2009 10:12am
Subject:bzr commit into mysql-5.1-bugteam branch (svoj:2802)
View as plain text  
#At file:///home/svoj/devel/bzr-mysql/mysql-5.1-bugteam-push/ based on revid:svoj@stripped

 2802 Sergey Vojtovich	2009-02-12 [merge]
      Merge 5.1-bugteam (local) -> 5.1-bugteam.
modified:
  mysql-test/r/merge.result
  mysql-test/t/merge.test
  storage/myisammrg/myrg_open.c

=== modified file 'mysql-test/r/merge.result'
--- a/mysql-test/r/merge.result	2009-02-04 13:00:40 +0000
+++ b/mysql-test/r/merge.result	2009-02-05 13:03:47 +0000
@@ -2041,4 +2041,23 @@ EXPLAIN SELECT COUNT(*) FROM t4;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
 DROP TABLE t1, t2, t3, t4;
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES(0),(1),(2),(3),(4);
+ANALYZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	analyze	status	OK
+CREATE TABLE m1(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
+SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1';
+CARDINALITY
+5
+SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1';
+CARDINALITY
+5
+SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1';
+CARDINALITY
+5
+SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1';
+CARDINALITY
+5
+DROP TABLE t1, m1;
 End of 5.1 tests

=== modified file 'mysql-test/t/merge.test'
--- a/mysql-test/t/merge.test	2009-02-04 13:00:40 +0000
+++ b/mysql-test/t/merge.test	2009-02-05 13:03:47 +0000
@@ -1435,4 +1435,17 @@ EXPLAIN SELECT COUNT(*) FROM t1;
 EXPLAIN SELECT COUNT(*) FROM t4;
 DROP TABLE t1, t2, t3, t4;
 
+#
+# BUG#39185 - Cardinality for merge tables calculated incorrectly.
+#
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES(0),(1),(2),(3),(4);
+ANALYZE TABLE t1;
+CREATE TABLE m1(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
+SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1'; 
+SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1'; 
+SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1'; 
+SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1'; 
+DROP TABLE t1, m1;
+
 --echo End of 5.1 tests

=== modified file 'storage/myisammrg/myrg_open.c'
--- a/storage/myisammrg/myrg_open.c	2009-02-04 13:00:40 +0000
+++ b/storage/myisammrg/myrg_open.c	2009-02-05 13:03:47 +0000
@@ -428,10 +428,11 @@ int myrg_attach_children(MYRG_INFO *m_in
       if (!m_info->rec_per_key_part)
       {
         if(!(m_info->rec_per_key_part= (ulong*)
-             my_malloc(key_parts * sizeof(long), MYF(MY_WME|MY_ZEROFILL))))
+             my_malloc(key_parts * sizeof(long), MYF(MY_WME))))
           goto err; /* purecov: inspected */
         errpos= 1;
       }
+      bzero((char*) m_info->rec_per_key_part, key_parts * sizeof(long));
     }
 
     /* Add MyISAM table info. */

Thread
bzr commit into mysql-5.1-bugteam branch (svoj:2802)Sergey Vojtovich12 Feb