diff options
author | unknown <tsmith@ramayana.hindu.god> | 2007-08-01 18:59:41 -0600 |
---|---|---|
committer | unknown <tsmith@ramayana.hindu.god> | 2007-08-01 18:59:41 -0600 |
commit | 48eb7f8c857493ca7d30da4b78b279e4938f8c83 (patch) | |
tree | 1fa7c6a583124fd9e3ba466b15acf7b8518f3303 /mysql-test/include | |
parent | 15835a5693da749cc9635d127ff708286831872e (diff) | |
parent | d07385965a42e086f53b94b8f0f435c1e586d28d (diff) | |
download | mariadb-git-48eb7f8c857493ca7d30da4b78b279e4938f8c83.tar.gz |
Merge 50 -> 51 (-opt changesets)
sql/handler.cc:
Auto merged
sql/handler.h:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_rcontext.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_select.h:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_union.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
mysql-test/include/read_many_rows.inc:
Manual merge
mysql-test/r/read_many_rows_innodb.result:
Manual merge
sql/sql_class.cc:
Manual merge
sql/sql_class.h:
Manual merge
storage/innobase/handler/ha_innodb.cc:
Manual merge
Diffstat (limited to 'mysql-test/include')
-rw-r--r-- | mysql-test/include/read_many_rows.inc | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/mysql-test/include/read_many_rows.inc b/mysql-test/include/read_many_rows.inc index e69f5a05cd6..ff57c0ca13d 100644 --- a/mysql-test/include/read_many_rows.inc +++ b/mysql-test/include/read_many_rows.inc @@ -59,3 +59,109 @@ INSERT INTO t4 SELECT * FROM t3 ORDER BY CONCAT(a); SELECT SUM(id) FROM t3; DROP TABLE t1,t2,t3,t4; + +# +# Bug#24989: The DEADLOCK error is improperly handled by InnoDB. +# +CREATE TABLE t1 (f1 int NOT NULL) ENGINE=InnoDB; +CREATE TABLE t2 (f2 int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +DELIMITER |; +CREATE TRIGGER t1_bi before INSERT + ON t1 FOR EACH ROW +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock'; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; + INSERT INTO t2 (f2) VALUES (1); + DELETE FROM t2 WHERE f2 = 1; +END;| + +CREATE PROCEDURE proc24989() +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock'; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; + INSERT INTO t2 (f2) VALUES (1); + DELETE FROM t2 WHERE f2 = 1; +END;| + +create procedure proc24989_2() + deterministic +begin + declare continue handler for sqlexception + select 'Outer handler' as 'exception'; + + insert into t1 values(1); + select "continued"; +end| + +DELIMITER ;| + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +connection con1; +start transaction; +insert into t1 values(1); + +connection con2; +start transaction; +insert into t2 values(123); +send insert into t1 values(1); + +connection con1; +--sleep 1 +insert into t1 values(1); + +connection con2; +--error 1213 +reap; +select @a; +# check that the whole transaction was rolled back +select * from t2; + +connection con1; +commit; +start transaction; +insert into t1 values(1); + +connection con2; +start transaction; +insert into t2 values(123); +send call proc24989(); + +connection con1; +--sleep 1 +insert into t1 values(1); + +connection con2; +reap; +select @a,@b; +# check that the whole transaction was rolled back +select * from t2; + +connection con1; +commit; +start transaction; +insert into t1 values(1); + +connection con2; +start transaction; +insert into t2 values(123); +send call proc24989_2(); + +connection con1; +--sleep 1 +insert into t1 values(1); +commit; + +connection con2; +reap; +# check that the whole transaction was rolled back +select * from t2; + +disconnect con1; +disconnect con2; +connection default; +drop procedure proc24989; +drop procedure proc24989_2; +drop table t1,t2; + |