From: Mattias Jonsson Date: May 15 2012 2:32pm Subject: bzr push into mysql-trunk branch (mattias.jonsson:3829 to 3830) WL#4443 List-Archive: http://lists.mysql.com/commits/143823 Message-Id: <201205151432.q4FEWMbJ021342@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3830 Mattias Jonsson 2012-05-15 WL#4443: Fix for crashes when failing during opening trigger tables. May need more work, but this fixes at least some crashes found in RQG. modified: mysql-test/r/partition_locking.result mysql-test/t/partition_locking.test sql/sql_base.cc 3829 Mattias Jonsson 2012-05-14 [merge] WL#4443: Merge into updated mysql-trunk. removed: mysql-test/r/grant_cache_ps_prot.result mysql-test/t/grant_cache_ps_prot.test added: mysql-test/collections/mysql-trunk-wl4443.push mysql-test/include/partition_default_functions.inc mysql-test/r/partition_locking.result mysql-test/t/partition_locking.test renamed: mysql-test/r/grant_cache_no_prot.result => mysql-test/r/grant_cache.result mysql-test/t/grant_cache_no_prot.test => mysql-test/t/grant_cache.test modified: include/my_bitmap.h include/my_time.h mysql-test/include/commit.inc mysql-test/include/grant_cache.inc mysql-test/include/handler.inc mysql-test/r/commit_1innodb.result mysql-test/r/explain.result mysql-test/r/func_if.result mysql-test/r/handler_innodb.result mysql-test/r/handler_myisam.result mysql-test/r/innodb_explain_json_non_select_all.result mysql-test/r/innodb_explain_json_non_select_none.result mysql-test/r/innodb_explain_non_select_all.result mysql-test/r/innodb_explain_non_select_none.result mysql-test/r/myisam_explain_json_non_select_all.result mysql-test/r/myisam_explain_json_non_select_none.result mysql-test/r/myisam_explain_non_select_all.result mysql-test/r/myisam_explain_non_select_none.result mysql-test/r/partition_binlog.result mysql-test/r/partition_explicit_prune.result mysql-test/r/partition_pruning.result mysql-test/r/partition_truncate.result mysql-test/r/type_date.result mysql-test/suite/binlog/r/binlog_unsafe.result mysql-test/suite/opt_trace/r/bugs_no_prot_all.result mysql-test/suite/opt_trace/r/bugs_no_prot_none.result mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result mysql-test/suite/parts/inc/partition-dml-1-9.inc mysql-test/suite/parts/r/partition-dml-1-9-innodb.result mysql-test/suite/parts/r/partition-dml-1-9-myisam.result mysql-test/suite/perfschema/r/part_table_io.result mysql-test/suite/perfschema/r/stage_mdl_function.result mysql-test/t/explain.test mysql-test/t/partition_binlog.test mysql-test/t/partition_explicit_prune.test mysql-test/t/partition_pruning.test mysql-test/t/partition_truncate.test mysql-test/t/type_date.test mysys/my_bitmap.c sql/ha_partition.cc sql/ha_partition.h sql/handler.cc sql/handler.h sql/item.cc sql/item.h sql/item_cmpfunc.cc sql/item_func.cc sql/item_func.h sql/item_strfunc.h sql/item_subselect.cc sql/opt_explain.cc sql/opt_range.cc sql/partition_info.cc sql/partition_info.h sql/rpl_info_table_access.cc sql/share/errmsg-utf8.txt sql/sp.cc sql/sql_base.cc sql/sql_base.h sql/sql_cache.h sql/sql_class.cc sql/sql_class.h sql/sql_delete.cc sql/sql_executor.cc sql/sql_handler.cc sql/sql_insert.cc sql/sql_insert.h sql/sql_lex.cc sql/sql_lex.h sql/sql_optimizer.cc sql/sql_parse.cc sql/sql_parse.h sql/sql_partition.cc sql/sql_partition.h sql/sql_partition_admin.cc sql/sql_prepare.cc sql/sql_resolver.cc sql/sql_select.cc sql/sql_select.h sql/sql_show.cc sql/sql_tmp_table.cc sql/sql_union.cc sql/sql_update.cc sql/sql_view.cc sql/table.cc sql/table.h unittest/gunit/my_bitmap-t.cc mysql-test/r/grant_cache.result mysql-test/t/grant_cache.test === modified file 'mysql-test/r/partition_locking.result' --- a/mysql-test/r/partition_locking.result revid:mattias.jonsson@stripped +++ b/mysql-test/r/partition_locking.result revid:mattias.jonsson@stripped @@ -4724,3 +4724,21 @@ a b 11 1 DROP TABLE t1; DROP TABLE t2; +# +# Test of InnoDB INSERT TABLE with non existing table in trigger +# +CREATE TABLE t1 (a INT) +ENGINE = InnoDB; +# Create a table to be used in a trigger on t1 +CREATE TABLE t2 (a INT) +ENGINE = InnoDB; +# Create a trigger on t1 which uses t2 +CREATE TRIGGER tr1_1_N BEFORE INSERT ON t1 +FOR EACH ROW BEGIN +UPDATE t2 SET a = 8 WHERE a > 3 LIMIT 0; +END// +# Drop t2 to cause a failure when inserting into t1 +DROP TABLE t2; +INSERT INTO t1 VALUES (1); +ERROR 42S02: Table 'test.t2' doesn't exist +DROP TABLE t1; === modified file 'mysql-test/t/partition_locking.test' --- a/mysql-test/t/partition_locking.test revid:mattias.jonsson@stripped +++ b/mysql-test/t/partition_locking.test revid:mattias.jonsson@stripped @@ -1709,3 +1709,26 @@ eval $get_handler_status_counts; SELECT * FROM t2 ORDER BY a, b; DROP TABLE t1; DROP TABLE t2; + +--echo # +--echo # Test of InnoDB INSERT TABLE with non existing table in trigger +--echo # +CREATE TABLE t1 (a INT) +ENGINE = InnoDB; + +--echo # Create a table to be used in a trigger on t1 +CREATE TABLE t2 (a INT) +ENGINE = InnoDB; +--echo # Create a trigger on t1 which uses t2 +delimiter //; +CREATE TRIGGER tr1_1_N BEFORE INSERT ON t1 +FOR EACH ROW BEGIN + UPDATE t2 SET a = 8 WHERE a > 3 LIMIT 0; +END// +delimiter ;// + +--echo # Drop t2 to cause a failure when inserting into t1 +DROP TABLE t2; +--error ER_NO_SUCH_TABLE +INSERT INTO t1 VALUES (1); +DROP TABLE t1; === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc revid:mattias.jonsson@stripped +++ b/sql/sql_base.cc revid:mattias.jonsson@stripped @@ -5743,7 +5743,9 @@ end: transaction of the enclosing statement. */ DBUG_ASSERT(thd->transaction.stmt.is_empty() || - (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)); + (thd->state_flags & Open_tables_state::BACKUPS_AVAIL) || + (thd->stmt_arena->state == + Query_arena::STMT_INITIALIZED_FOR_SP)); close_thread_tables(thd); /* Don't keep locks for a failed statement. */ thd->mdl_context.rollback_to_savepoint(mdl_savepoint); No bundle (reason: useless for push emails).