List:Commits« Previous MessageNext Message »
From:Evgeny Potemkin Date:March 4 2011 11:27am
Subject:bzr push into mysql-trunk branch (epotemkin:3005 to 3007) Bug#11808582
WL#5274
View as plain text  
 3007 Evgeny Potemkin	2011-02-25
      Bug#11808582: VALGRIND ON WL#5274: INVALID WRITE IN MC_REPLACE_STRMEM.C:493) 
      TABLE_SHARE::column_bitmap_size wasn't initialized for tmp tables. This
      caused valgrind to throw a warning.
      Now setup_tmp_table_column_bitmaps initializes TABLE_SHARE::column_bitmap_size.
     @ mysql-test/r/derived.result
        Added a test case for the bug#11808582.
     @ mysql-test/t/derived.test
        Added a test case for the bug#11808582.
     @ sql/sql_select.cc
        Bug#11808582: VALGRIND ON WL#5274: INVALID WRITE IN MC_REPLACE_STRMEM.C:493) 
        Now setup_tmp_table_column_bitmaps initializes TABLE_SHARE::column_bitmap_size.

    modified:
      mysql-test/r/derived.result
      mysql-test/t/derived.test
      sql/sql_select.cc
 3006 Evgeny Potemkin	2011-02-25
      Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
      After a merge initialization of JOIN::best_rowcount wasn't added in few
      cases, thus valgrind was throwing reported warning.
      Added initialization of JOIN::best_rowcount.
     @ mysql-test/r/derived.result
        Added a test case for the bug#11807437.
     @ mysql-test/t/derived.test
        Added a test case for the bug#11807437.
     @ sql/sql_select.cc
        Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
        Added initialization of JOIN::best_rowcount.

    modified:
      mysql-test/r/derived.result
      mysql-test/t/derived.test
      sql/sql_select.cc
 3005 Evgeny Potemkin	2011-02-23
      Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW IN SUBQUERY 
      The mysql_derived_cleanup function was mistakenly called for EXPLAIN causing
      materializable view to be prepared for the second time and thus throwing the
      reported assertion.
      Fixed by skipping immediate cleanup in case of EXPLAIN.
     @ mysql-test/r/derived.result
        Added a test case for the bug#11791649.
     @ mysql-test/t/derived.test
        Added a test case for the bug#11791649.
     @ sql/item_subselect.cc
        Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW IN SUBQUERY 
        subselect_uniquesubquery_engine::exec and subselect_indexsubquery_engine::exec
        functions now don't call cleanup function immediately for EXPLAIN queries.
     @ sql/sql_select.cc
        Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW IN SUBQUERY
        join_materialize_table function now doesn't call cleanup for EXPLAIN queries.

    modified:
      mysql-test/r/derived.result
      mysql-test/t/derived.test
      sql/item_subselect.cc
      sql/sql_select.cc
=== modified file 'mysql-test/r/derived.result'
--- a/mysql-test/r/derived.result	2011-02-23 14:37:35 +0000
+++ b/mysql-test/r/derived.result	2011-02-25 13:48:31 +0000
@@ -1558,3 +1558,43 @@ id	select_type	table	type	possible_keys
 DROP VIEW view1;
 DROP TABLE t1,t2;
 #
+#
+# Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
+#
+CREATE TABLE `CC` (
+`col_int_key` int(11) DEFAULT NULL
+);
+SELECT 1 AS field1
+FROM  (
+SELECT 1 as 'col_int_key',2 as 'col_varchar_nokey'
+    FROM DUAL
+WHERE EXISTS  (
+SELECT C_SQ1_alias1.col_int_key AS C_SQ1_field1
+FROM  CC AS C_SQ1_alias1
+)) AS alias2
+;
+field1
+DROP TABLE CC;
+#
+#
+# Bug#11808582: VALGRIND ON WL#5274: INVALID WRITE IN MC_REPLACE_STRMEM.C:493) 
+#
+CREATE TABLE CC (
+pk INT NOT NULL AUTO_INCREMENT,
+col_int_key INT,
+col_time_key time,
+col_varchar_key VARCHAR(1),
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+SELECT alias1.col_time_key AS field1
+FROM ( ( SELECT SQ1_alias1.* FROM CC AS SQ1_alias1 ) AS alias1
+INNER JOIN CC AS alias2
+ON (alias2.col_int_key = alias1.col_int_key)
+)
+WHERE alias1.col_int_key = 207
+ORDER BY alias1.col_varchar_key, alias1.pk ASC, field1;
+field1
+DROP TABLE CC;
+#

=== modified file 'mysql-test/t/derived.test'
--- a/mysql-test/t/derived.test	2011-02-23 14:37:35 +0000
+++ b/mysql-test/t/derived.test	2011-02-25 13:48:31 +0000
@@ -916,3 +916,46 @@ DROP VIEW view1;
 DROP TABLE t1,t2;
 --echo #
 
+--echo #
+--echo # Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
+--echo #
+CREATE TABLE `CC` (
+  `col_int_key` int(11) DEFAULT NULL
+);
+
+SELECT 1 AS field1
+FROM  (
+    SELECT 1 as 'col_int_key',2 as 'col_varchar_nokey'
+    FROM DUAL
+    WHERE EXISTS  (
+      SELECT C_SQ1_alias1.col_int_key AS C_SQ1_field1
+      FROM  CC AS C_SQ1_alias1
+      )) AS alias2
+;
+
+DROP TABLE CC;
+--echo #
+
+--echo #
+--echo # Bug#11808582: VALGRIND ON WL#5274: INVALID WRITE IN MC_REPLACE_STRMEM.C:493) 
+--echo #
+CREATE TABLE CC (
+  pk INT NOT NULL AUTO_INCREMENT,
+  col_int_key INT,
+  col_time_key time,
+  col_varchar_key VARCHAR(1),
+  PRIMARY KEY (pk),
+  KEY col_int_key (col_int_key),
+  KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+SELECT alias1.col_time_key AS field1
+FROM ( ( SELECT SQ1_alias1.* FROM CC AS SQ1_alias1 ) AS alias1
+  INNER JOIN CC AS alias2
+  ON (alias2.col_int_key = alias1.col_int_key)
+  )
+WHERE alias1.col_int_key = 207
+ORDER BY alias1.col_varchar_key, alias1.pk ASC, field1;
+
+DROP TABLE CC;
+--echo #
+

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-02-23 14:37:35 +0000
+++ b/sql/sql_select.cc	2011-02-25 13:48:31 +0000
@@ -1853,6 +1853,7 @@ JOIN::optimize()
       zero_result_cause=  select_lex->having_value == Item::COND_FALSE ?
                            "Impossible HAVING" : "Impossible WHERE";
       tables= 0;
+      best_rowcount= 0;
       goto setup_subq_exit;
     }
   }
@@ -1898,6 +1899,7 @@ JOIN::optimize()
     */
     if ((res=opt_sum_query(select_lex->leaf_tables, all_fields, conds)))
     {
+      best_rowcount= 0;
       if (res == HA_ERR_KEY_NOT_FOUND)
       {
         DBUG_PRINT("info",("No matching min/max row"));
@@ -1921,6 +1923,7 @@ JOIN::optimize()
       DBUG_PRINT("info",("Select tables optimized away"));
       zero_result_cause= "Select tables optimized away";
       tables_list= 0;				// All tables resolved
+      best_rowcount= 1;
       const_tables= tables;
       /*
         Extract all table-independent conditions and replace the WHERE
@@ -15395,6 +15398,7 @@ void setup_tmp_table_column_bitmaps(TABL
   table->s->all_set= table->def_read_set;
   bitmap_set_all(&table->s->all_set);
   table->default_column_bitmaps();
+  table->s->column_bitmap_size= bitmap_buffer_size(field_count);
 }
 
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (epotemkin:3005 to 3007) Bug#11808582WL#5274Evgeny Potemkin4 Mar