mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysql_cab_desk.:C:/source/c++/mysql-5.1
into mysql_cab_desk.:C:/source/c++/mysql-5.1-new-rpl-merge mysql-test/lib/mtr_report.pl: Auto merged mysql-test/t/disabled.def: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/log_event.cc: Auto merged mysql-test/suite/rpl/r/rpl_row_create_table.result: Merge with 5.1 main.
This commit is contained in:
7
mysql-test/include/have_bug25714.inc
Normal file
7
mysql-test/include/have_bug25714.inc
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Check if the variable MYSQL_BUG25714 is set
|
||||
#
|
||||
--require r/have_bug25714.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("MYSQL_BUG25714") > 0 as "have_bug25714_exe";
|
||||
enable_query_log;
|
@ -814,8 +814,132 @@ create table t1 (a int) engine=innodb;
|
||||
alter table t1 alter a set default 1;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
--echo
|
||||
--echo Bug#24918 drop table and lock / inconsistent between
|
||||
--echo perm and temp tables
|
||||
--echo
|
||||
--echo Check transactional tables under LOCK TABLES
|
||||
--echo
|
||||
--disable_warnings
|
||||
drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp,
|
||||
t24918_access;
|
||||
--enable_warnings
|
||||
create table t24918_access (id int);
|
||||
create table t24918 (id int) engine=myisam;
|
||||
create temporary table t24918_tmp (id int) engine=myisam;
|
||||
create table t24918_trans (id int) engine=innodb;
|
||||
create temporary table t24918_trans_tmp (id int) engine=innodb;
|
||||
|
||||
lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
|
||||
drop table t24918;
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
select * from t24918_access;
|
||||
drop table t24918_trans;
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
select * from t24918_access;
|
||||
drop table t24918_trans_tmp;
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
select * from t24918_access;
|
||||
drop table t24918_tmp;
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
select * from t24918_access;
|
||||
unlock tables;
|
||||
|
||||
drop table t24918_access;
|
||||
#
|
||||
# Bug #28591: MySQL need not sort the records in case of ORDER BY
|
||||
# primary_key on InnoDB table
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2);
|
||||
INSERT INTO t1 SELECT a + 8, 2 FROM t1;
|
||||
INSERT INTO t1 SELECT a + 16, 1 FROM t1;
|
||||
query_vertical EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a;
|
||||
SELECT * FROM t1 WHERE b=2 ORDER BY a;
|
||||
query_vertical EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
||||
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
||||
query_vertical EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
||||
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
||||
|
||||
CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a), KEY bkey (b,c))
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1);
|
||||
INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2;
|
||||
INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2;
|
||||
|
||||
query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a;
|
||||
SELECT * FROM t2 WHERE b=1 ORDER BY a;
|
||||
query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
|
||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
|
||||
query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
|
||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
|
||||
query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
|
||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug #29644: alter table hangs if records locked in share mode by long
|
||||
# running transaction
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
|
||||
INSERT INTO t1 SELECT a + 8 FROM t1;
|
||||
INSERT INTO t1 SELECT a + 16 FROM t1;
|
||||
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE p1 ()
|
||||
BEGIN
|
||||
DECLARE i INT DEFAULT 50;
|
||||
DECLARE cnt INT;
|
||||
START TRANSACTION;
|
||||
ALTER TABLE t1 ENGINE=InnoDB;
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
WHILE (i > 0) DO
|
||||
SET i = i - 1;
|
||||
SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
|
||||
END WHILE;
|
||||
COMMIT;
|
||||
END;|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
CONNECT (con1,localhost,root,,);
|
||||
CONNECT (con2,localhost,root,,);
|
||||
|
||||
CONNECTION con1;
|
||||
SEND CALL p1();
|
||||
CONNECTION con2;
|
||||
SEND CALL p1();
|
||||
CONNECTION default;
|
||||
CALL p1();
|
||||
|
||||
CONNECTION con1;
|
||||
REAP;
|
||||
CONNECTION con2;
|
||||
REAP;
|
||||
CONNECTION default;
|
||||
DISCONNECT con1;
|
||||
DISCONNECT con2;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #28125: ERROR 2013 when adding index.
|
||||
#
|
||||
create table t1(a text) engine=innodb default charset=utf8;
|
||||
insert into t1 values('aaa');
|
||||
alter table t1 add index(a(1024));
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
|
||||
# UPDATE": if the row is updated, it's like a regular UPDATE:
|
||||
|
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user