List:Commits« Previous MessageNext Message »
From:Evgeny Potemkin Date:March 18 2011 8:59am
Subject:bzr commit into mysql-trunk branch (epotemkin:3002) Bug#11807437
View as plain text  
#At file:///work/bzrroot/11807437-bug/ based on revid:epotemkin@stripped

 3002 Evgeny Potemkin	2011-03-18
      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
=== modified file 'mysql-test/r/derived.result'
--- a/mysql-test/r/derived.result	2011-02-17 12:14:26 +0000
+++ b/mysql-test/r/derived.result	2011-03-18 08:59:36 +0000
@@ -1328,3 +1328,20 @@ f1	f11	f2	f22	f3	f33
 DROP TABLE t1,t2,t3;
 DROP VIEW v1,v2,v3,v4,v6,v7;
 #
+#
+# Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
+#
+CREATE TABLE t1 (
+f1 int(11) DEFAULT NULL
+);
+SELECT 1
+FROM (
+SELECT 1, 2 FROM DUAL
+WHERE EXISTS  (
+SELECT f1
+FROM  t1
+)) AS tt
+;
+1
+DROP TABLE t1;
+#

=== modified file 'mysql-test/t/derived.test'
--- a/mysql-test/t/derived.test	2011-02-17 12:14:26 +0000
+++ b/mysql-test/t/derived.test	2011-03-18 08:59:36 +0000
@@ -693,3 +693,22 @@ DROP VIEW v1,v2,v3,v4,v6,v7;
 
 --echo #
 
+--echo #
+--echo # Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
+--echo #
+CREATE TABLE t1 (
+  f1 int(11) DEFAULT NULL
+);
+
+SELECT 1
+FROM (
+  SELECT 1, 2 FROM DUAL
+  WHERE EXISTS  (
+    SELECT f1
+    FROM  t1
+    )) AS tt
+;
+
+DROP TABLE t1;
+--echo #
+

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-02-17 12:14:26 +0000
+++ b/sql/sql_select.cc	2011-03-18 08:59:36 +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


Attachment: [text/bzr-bundle] bzr/epotemkin@mysql.com-20110318085936-meznbiwib17y11iv.bundle
Thread
bzr commit into mysql-trunk branch (epotemkin:3002) Bug#11807437Evgeny Potemkin18 Mar
  • Re: bzr commit into mysql-trunk branch (epotemkin:3002) Bug#11807437Roy Lyseng6 Apr