List:Commits« Previous MessageNext Message »
From:magnus.blaudd Date:May 11 2012 1:21pm
Subject:bzr push into mysql-trunk branch (magnus.blaudd:3749 to 3750) WL#6004
View as plain text  
 3750 magnus.blaudd@stripped	2012-05-11
      WL#6004
       - temporary hack allowing mysql.* tables in a transactional engine

    modified:
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/row/row0mysql.cc
 3749 Norvald H. Ryeng	2012-04-27
      Bug#13735712 SELECT W/ SUBQUERY PRODUCES MORE ROWS WHEN USING
      VARIABLES
      
      Outer join queries with ALL may return incorrect results because the
      optimizer incorrectly rewrites them to use inner join. E.g.:
      
      SELECT *
      FROM t2 RIGHT JOIN t3 ON(t3.c = t2.b)
      WHERE t2.b < ALL(SELECT t1.a FROM t1 WHERE t1.a <= 7);
      
      is first rewritten by Item_in_subselect::single_value_transformer()
      into:
      
      SELECT *
      FROM t2 RIGHT JOIN t3 ON(t3.c = t2.b)
      WHERE <not>(t2.b >= (SELECT MIN(t1.a) FROM t1 WHERE t1.a <= 7));
      
      When simplify_joins() checks not_null_tables() on the <not> condition
      to find out if the outer join can be transformed into an inner join,
      Item_func::not_null_tables() returns its arguments'
      not_null_tables(). This means that simplify_joins() is told that the
      condition will be false if t2.b is NULL. But the condition is actually
      true if t1 has no rows where t1.a <= 7. This leads to the optimizer
      incorrectly rewriting the query to use inner join.
      
      Fix: Let Item_func_not_all::not_null_tables() return a zero table map.
     @ mysql-test/include/subquery.inc
        Add test cases for bugs #13735712.
     @ mysql-test/r/subquery_all.result
        Add test cases for bugs #13735712.
     @ mysql-test/r/subquery_all_bka.result
        Add test cases for bugs #13735712.
     @ mysql-test/r/subquery_all_bka_nixbnl.result
        Add test cases for bugs #13735712.
     @ mysql-test/r/subquery_nomat_nosj.result
        Add test cases for bugs #13735712.
     @ mysql-test/r/subquery_nomat_nosj_bka.result
        Add test cases for bugs #13735712.
     @ mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result
        Add test cases for bugs #13735712.
     @ mysql-test/r/subquery_none.result
        Add test cases for bugs #13735712.
     @ mysql-test/r/subquery_none_bka.result
        Add test cases for bugs #13735712.
     @ mysql-test/r/subquery_none_bka_nixbnl.result
        Add test cases for bugs #13735712.
     @ sql/item_cmpfunc.h
        Return 0 from Item_func_not_all::not_null_tables().

    modified:
      mysql-test/include/subquery.inc
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_all_bka_nixbnl.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_bka.result
      mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result
      mysql-test/r/subquery_none.result
      mysql-test/r/subquery_none_bka.result
      mysql-test/r/subquery_none_bka_nixbnl.result
      sql/item_cmpfunc.h
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2012-04-25 15:46:11 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2012-05-11 12:58:57 +0000
@@ -2623,6 +2623,23 @@ ha_innobase::init_table_handle_for_HANDL
 	reset_template();
 }
 
+
+#ifndef TEMPORARY_HACK_FOR_WL6004
+static bool
+is_supported_system_table(const char*,
+                          const char*,
+                          bool is_sql_layer_system_table)
+{
+  if (is_sql_layer_system_table)
+  {
+    /* All MySQL system tables supported */
+    return true;
+  }
+  return false;
+}
+#endif
+
+
 /*********************************************************************//**
 Opens an InnoDB database.
 @return	0 on success, error code on failure */
@@ -2663,6 +2680,10 @@ innobase_init(
 	innobase_hton->drop_database = innobase_drop_database;
 	innobase_hton->panic = innobase_end;
 
+#ifndef TEMPORARY_HACK_FOR_WL6004
+        innobase_hton->is_supported_system_table = is_supported_system_table;
+#endif
+
 	innobase_hton->start_consistent_snapshot =
 		innobase_start_trx_and_assign_read_view;
 

=== modified file 'storage/innobase/row/row0mysql.cc'
--- a/storage/innobase/row/row0mysql.cc	2012-04-24 06:21:11 +0000
+++ b/storage/innobase/row/row0mysql.cc	2012-05-11 12:58:57 +0000
@@ -124,9 +124,13 @@ row_mysql_is_system_table(
 		return(FALSE);
 	}
 
+#ifndef TEMPORARY_HACK_FOR_WL6004
+        return(FALSE);
+#else
 	return(0 == strcmp(name + 6, "host")
 	       || 0 == strcmp(name + 6, "user")
 	       || 0 == strcmp(name + 6, "db"));
+#endif
 }
 
 /*********************************************************************//**

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (magnus.blaudd:3749 to 3750) WL#6004magnus.blaudd22 May