From c7419debba007918f6317ccf844ae333031fcff5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Aug 2007 02:22:31 -0600 Subject: [PATCH] Post-merge fix. Update some test results, and add an InnoDB-only compatibility hook, thd_mark_transaction_to_rollback(). mysql-test/r/ps.result: Post-merge fix. Changes for WL 3984 (Revise locking of mysql.general_log and mysql.slow_log) cause some test result differences. mysql-test/r/show_check.result: Post-merge fix. Changes for WL 3984 (Revise locking of mysql.general_log and mysql.slow_log) cause some test result differences. sql/sql_class.cc: Post-merge fix, add InnoDB compatibility hook (defined for InnoDB only), thd_mark_transaction_to_rollback(). storage/innobase/handler/ha_innodb.cc: Post-merge fix, add InnoDB compatibility hook (defined for InnoDB only), thd_mark_transaction_to_rollback(). storage/innobase/handler/ha_innodb.h: Post-merge fix, add InnoDB compatibility hook (defined for InnoDB only), thd_mark_transaction_to_rollback(). --- mysql-test/r/ps.result | 35 +++++++++++---------------- mysql-test/r/show_check.result | 7 ++---- sql/sql_class.cc | 5 ++++ storage/innobase/handler/ha_innodb.cc | 6 ++--- storage/innobase/handler/ha_innodb.h | 7 ++++++ 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 341a6b7cd43..edac68a88d6 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1857,10 +1857,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql general_log 0 0 -mysql slow_log 0 0 -mysql host 0 0 mysql user 0 0 +mysql general_log 0 0 +mysql host 0 0 call proc_1(); show open tables from mysql; Database Table In_use Name_locked @@ -1871,10 +1870,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql general_log 0 0 -mysql slow_log 0 0 -mysql host 0 0 mysql user 0 0 +mysql general_log 0 0 +mysql host 0 0 call proc_1(); show open tables from mysql; Database Table In_use Name_locked @@ -1885,10 +1883,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql general_log 0 0 -mysql slow_log 0 0 -mysql host 0 0 mysql user 0 0 +mysql general_log 0 0 +mysql host 0 0 call proc_1(); show open tables from mysql; Database Table In_use Name_locked @@ -1899,10 +1896,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql general_log 0 0 -mysql slow_log 0 0 -mysql host 0 0 mysql user 0 0 +mysql general_log 0 0 +mysql host 0 0 flush tables; create function func_1() returns int begin flush tables; return 1; end| ERROR 0A000: FLUSH is not allowed in stored function or trigger @@ -1932,10 +1928,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql general_log 0 0 -mysql slow_log 0 0 -mysql host 0 0 mysql user 0 0 +mysql general_log 0 0 +mysql host 0 0 execute abc; show open tables from mysql; Database Table In_use Name_locked @@ -1946,10 +1941,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql general_log 0 0 -mysql slow_log 0 0 -mysql host 0 0 mysql user 0 0 +mysql general_log 0 0 +mysql host 0 0 execute abc; show open tables from mysql; Database Table In_use Name_locked @@ -1960,10 +1954,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql general_log 0 0 -mysql slow_log 0 0 -mysql host 0 0 mysql user 0 0 +mysql general_log 0 0 +mysql host 0 0 flush tables; deallocate prepare abc; create procedure proc_1() flush logs; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 669043b5656..1a34dd84dd7 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -256,9 +256,8 @@ create table t1(n int); insert into t1 values (1); show open tables; Database Table In_use Name_locked -mysql general_log 0 0 -mysql slow_log 0 0 test t1 0 0 +mysql general_log 0 0 drop table t1; create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed; show create table t1; @@ -685,9 +684,8 @@ Database Table In_use Name_locked mysql db 0 0 mysql time_zone 0 0 mysql general_log 0 0 -mysql slow_log 0 0 -mysql user 0 0 mysql proc 0 0 +mysql user 0 0 mysql time_zone_name 0 0 SHOW OPEN TABLES FROM mysql LIKE 'u%'; Database Table In_use Name_locked @@ -702,7 +700,6 @@ SHOW OPEN TABLES LIKE '%o%'; Database Table In_use Name_locked mysql time_zone 0 0 mysql general_log 0 0 -mysql slow_log 0 0 mysql proc 0 0 mysql time_zone_name 0 0 FLUSH TABLES; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c7c6a164e10..0135acddd8c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2583,6 +2583,11 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd) { return (int) thd->variables.binlog_format; } + +extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all) +{ + mark_transaction_to_rollback(thd, all); +} #endif // INNODB_COMPATIBILITY_HOOKS */ /**************************************************************************** diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 0a1e63a4c65..f606134578a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -601,7 +601,7 @@ convert_error_code_to_mysql( tell it also to MySQL so that MySQL knows to empty the cached binlog for this transaction */ - mark_transaction_to_rollback(thd, TRUE); + thd_mark_transaction_to_rollback(thd, TRUE); return(HA_ERR_LOCK_DEADLOCK); @@ -611,7 +611,7 @@ convert_error_code_to_mysql( latest SQL statement in a lock wait timeout. Previously, we rolled back the whole transaction. */ - mark_transaction_to_rollback(thd, + thd_mark_transaction_to_rollback(thd, (bool)row_rollback_on_timeout); return(HA_ERR_LOCK_WAIT_TIMEOUT); @@ -664,7 +664,7 @@ convert_error_code_to_mysql( tell it also to MySQL so that MySQL knows to empty the cached binlog for this transaction */ - mark_transaction_to_rollback(thd, TRUE); + thd_mark_transaction_to_rollback(thd, TRUE); return(HA_ERR_LOCK_TABLE_FULL); } else if (error == DB_TOO_MANY_CONCURRENT_TRXS) { diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index b10cccded18..270b000dfc4 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -234,6 +234,13 @@ int thd_non_transactional_update(const MYSQL_THD thd); @return Value to be used as index into the binlog_format_names array */ int thd_binlog_format(const MYSQL_THD thd); + +/** + Mark transaction to rollback and mark error as fatal to a sub-statement. + @param thd Thread handle + @param all TRUE <=> rollback main transaction. +*/ +void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all); } /*