From: magnus.blaudd Date: May 11 2012 1:39pm Subject: bzr push into mysql-trunk branch (magnus.blaudd:3749 to 3751) WL#6004 List-Archive: http://lists.mysql.com/commits/143895 Message-Id: <201205111339.q4BDdx2f004927@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3751 magnus.blaudd@stripped 2012-05-11 WL#6004 - change alter_table.test since we now have a transactional SE which supports mysql.* tables modified: mysql-test/r/alter_table.result mysql-test/t/alter_table.test 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 (t2.b >= (SELECT MIN(t1.a) FROM t1 WHERE t1.a <= 7)); When simplify_joins() checks not_null_tables() on the 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 'mysql-test/r/alter_table.result' --- a/mysql-test/r/alter_table.result 2012-04-16 15:13:26 +0000 +++ b/mysql-test/r/alter_table.result 2012-05-11 13:29:11 +0000 @@ -1907,8 +1907,6 @@ DROP TABLE tm1; # then this test needs to be updated # use mysql; -ALTER TABLE db ENGINE=innodb; -ERROR HY000: Storage engine 'InnoDB' does not support system tables. [mysql.db] ALTER TABLE user ENGINE=memory; ERROR HY000: Storage engine 'MEMORY' does not support system tables. [mysql.user] ALTER TABLE proc ENGINE=heap; @@ -1917,8 +1915,6 @@ ALTER TABLE func ENGINE=csv; ERROR HY000: Storage engine 'CSV' does not support system tables. [mysql.func] ALTER TABLE event ENGINE=merge; ERROR HY000: Storage engine 'MRG_MYISAM' does not support system tables. [mysql.event] -ALTER TABLE servers ENGINE=innodb; -ERROR HY000: Storage engine 'InnoDB' does not support system tables. [mysql.servers] ALTER TABLE procs_priv ENGINE=memory; ERROR HY000: Storage engine 'MEMORY' does not support system tables. [mysql.procs_priv] ALTER TABLE tables_priv ENGINE=heap; @@ -1927,10 +1923,6 @@ ALTER TABLE columns_priv ENGINE=csv; ERROR HY000: Storage engine 'CSV' does not support system tables. [mysql.columns_priv] ALTER TABLE time_zone ENGINE=merge; ERROR HY000: Storage engine 'MRG_MYISAM' does not support system tables. [mysql.time_zone] -ALTER TABLE help_topic ENGINE=innodb; -ERROR HY000: Storage engine 'InnoDB' does not support system tables. [mysql.help_topic] -CREATE TABLE db (dummy int) ENGINE=innodb; -ERROR HY000: Storage engine 'InnoDB' does not support system tables. [mysql.db] CREATE TABLE user (dummy int) ENGINE=memory; ERROR HY000: Storage engine 'MEMORY' does not support system tables. [mysql.user] CREATE TABLE proc (dummy int) ENGINE=heap; @@ -1939,8 +1931,6 @@ CREATE TABLE func (dummy int) ENGINE=csv ERROR HY000: Storage engine 'CSV' does not support system tables. [mysql.func] CREATE TABLE event (dummy int) ENGINE=merge; ERROR HY000: Storage engine 'MRG_MYISAM' does not support system tables. [mysql.event] -CREATE TABLE servers (dummy int) ENGINE=innodb; -ERROR HY000: Storage engine 'InnoDB' does not support system tables. [mysql.servers] CREATE TABLE procs_priv (dummy int) ENGINE=memory; ERROR HY000: Storage engine 'MEMORY' does not support system tables. [mysql.procs_priv] CREATE TABLE tables_priv (dummy int) ENGINE=heap; @@ -1949,7 +1939,5 @@ CREATE TABLE columns_priv (dummy int) EN ERROR HY000: Storage engine 'CSV' does not support system tables. [mysql.columns_priv] CREATE TABLE time_zone (dummy int) ENGINE=merge; ERROR HY000: Storage engine 'MRG_MYISAM' does not support system tables. [mysql.time_zone] -CREATE TABLE help_topic (dummy int) ENGINE=innodb; -ERROR HY000: Storage engine 'InnoDB' does not support system tables. [mysql.help_topic] use test; # End of Bug#11815557 === modified file 'mysql-test/t/alter_table.test' --- a/mysql-test/t/alter_table.test 2012-04-11 13:50:46 +0000 +++ b/mysql-test/t/alter_table.test 2012-05-11 13:29:11 +0000 @@ -1573,8 +1573,8 @@ DROP TABLE tm1; --echo # use mysql; ---error ER_UNSUPPORTED_ENGINE -ALTER TABLE db ENGINE=innodb; +#--error ER_UNSUPPORTED_ENGINE +#ALTER TABLE db ENGINE=innodb; --error ER_UNSUPPORTED_ENGINE ALTER TABLE user ENGINE=memory; --error ER_UNSUPPORTED_ENGINE @@ -1583,8 +1583,8 @@ ALTER TABLE proc ENGINE=heap; ALTER TABLE func ENGINE=csv; --error ER_UNSUPPORTED_ENGINE ALTER TABLE event ENGINE=merge; ---error ER_UNSUPPORTED_ENGINE -ALTER TABLE servers ENGINE=innodb; +#--error ER_UNSUPPORTED_ENGINE +#ALTER TABLE servers ENGINE=innodb; --error ER_UNSUPPORTED_ENGINE ALTER TABLE procs_priv ENGINE=memory; --error ER_UNSUPPORTED_ENGINE @@ -1593,11 +1593,11 @@ ALTER TABLE tables_priv ENGINE=heap; ALTER TABLE columns_priv ENGINE=csv; --error ER_UNSUPPORTED_ENGINE ALTER TABLE time_zone ENGINE=merge; ---error ER_UNSUPPORTED_ENGINE -ALTER TABLE help_topic ENGINE=innodb; +#--error ER_UNSUPPORTED_ENGINE +#ALTER TABLE help_topic ENGINE=innodb; ---error ER_UNSUPPORTED_ENGINE -CREATE TABLE db (dummy int) ENGINE=innodb; +#--error ER_UNSUPPORTED_ENGINE +#CREATE TABLE db (dummy int) ENGINE=innodb; --error ER_UNSUPPORTED_ENGINE CREATE TABLE user (dummy int) ENGINE=memory; --error ER_UNSUPPORTED_ENGINE @@ -1606,8 +1606,8 @@ CREATE TABLE proc (dummy int) ENGINE=hea CREATE TABLE func (dummy int) ENGINE=csv; --error ER_UNSUPPORTED_ENGINE CREATE TABLE event (dummy int) ENGINE=merge; ---error ER_UNSUPPORTED_ENGINE -CREATE TABLE servers (dummy int) ENGINE=innodb; +#--error ER_UNSUPPORTED_ENGINE +#CREATE TABLE servers (dummy int) ENGINE=innodb; --error ER_UNSUPPORTED_ENGINE CREATE TABLE procs_priv (dummy int) ENGINE=memory; --error ER_UNSUPPORTED_ENGINE @@ -1616,7 +1616,7 @@ CREATE TABLE tables_priv (dummy int) ENG CREATE TABLE columns_priv (dummy int) ENGINE=csv; --error ER_UNSUPPORTED_ENGINE CREATE TABLE time_zone (dummy int) ENGINE=merge; ---error ER_UNSUPPORTED_ENGINE -CREATE TABLE help_topic (dummy int) ENGINE=innodb; +#--error ER_UNSUPPORTED_ENGINE +#CREATE TABLE help_topic (dummy int) ENGINE=innodb; use test; --echo # End of Bug#11815557 === 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).