mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Merge with MySQL 5.1.60
This commit is contained in:
@@ -11,4 +11,6 @@
|
||||
##############################################################################
|
||||
|
||||
innodb_bug52745: Disabled as this has valgrind failures (also in MySQL 5.1.50)
|
||||
innodb-index: Disabled until merging with XtraDB 5.1.60
|
||||
innodb-index: Disabled until merging with XtraDB 5.1.60
|
||||
innodb-lock: Disabled until merging with XtraDB 5.1.60
|
||||
innodb_replace: Disabled until merging with XtraDB 5.1.60
|
||||
|
@@ -2,8 +2,6 @@
|
||||
# embedded server ignores 'delayed', so skip this
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
@@ -20,10 +18,3 @@ SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES(null);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@@ -2,8 +2,6 @@
|
||||
# embedded server ignores 'delayed', so skip this
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
@@ -34,10 +32,3 @@ SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES(null);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@@ -1,7 +1,5 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
##
|
||||
# Bug #56228: dropping tables from within an active statement crashes server
|
||||
#
|
||||
@@ -33,10 +31,3 @@ SELECT bug56228();
|
||||
DROP FUNCTION bug56228;
|
||||
DROP TEMPORARY TABLE t2_56228;
|
||||
DROP TEMPORARY TABLE IF EXISTS t1_56228;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@@ -2,8 +2,6 @@
|
||||
# embedded server ignores 'delayed', so skip this
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
@@ -639,10 +637,3 @@ INSERT INTO t1 VALUES (18446744073709551615);
|
||||
-- source include/restart_mysqld.inc
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@@ -61,7 +61,6 @@ SET storage_engine=InnoDB;
|
||||
--disable_query_log
|
||||
# These values can change during the test
|
||||
LET $innodb_file_format_orig=`select @@innodb_file_format`;
|
||||
LET $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
|
||||
LET $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
|
||||
--enable_query_log
|
||||
@@ -568,7 +567,6 @@ DROP TABLE IF EXISTS t1;
|
||||
|
||||
--disable_query_log
|
||||
EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
|
||||
EVAL SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
|
||||
EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
|
||||
--enable_query_log
|
||||
|
@@ -2,14 +2,12 @@
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
let $per_table=`select @@innodb_file_per_table`;
|
||||
let $format=`select @@innodb_file_format`;
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format='Barracuda';
|
||||
|
||||
# Test an assertion failure on purge.
|
||||
# Bug #12429576 - Test an assertion failure on purge.
|
||||
CREATE TABLE t1_purge (
|
||||
A INT,
|
||||
B BLOB, C BLOB, D BLOB, E BLOB,
|
||||
@@ -59,6 +57,68 @@ DELETE FROM t1_purge;
|
||||
DELETE FROM t2_purge;
|
||||
DELETE FROM t3_purge;
|
||||
DELETE FROM t4_purge;
|
||||
# Instead of doing a --sleep 10, wait until the rest of the tests in
|
||||
# this file complete before dropping the tables. By then, the purge thread
|
||||
# will have delt with the updates above.
|
||||
|
||||
# Bug#12637786 - Bad assert by purge thread for records with external data
|
||||
# used in secondary indexes.
|
||||
SET @r=REPEAT('a',500);
|
||||
CREATE TABLE t12637786(a INT,
|
||||
v1 VARCHAR(500), v2 VARCHAR(500), v3 VARCHAR(500),
|
||||
v4 VARCHAR(500), v5 VARCHAR(500), v6 VARCHAR(500),
|
||||
v7 VARCHAR(500), v8 VARCHAR(500), v9 VARCHAR(500),
|
||||
v10 VARCHAR(500), v11 VARCHAR(500), v12 VARCHAR(500),
|
||||
v13 VARCHAR(500), v14 VARCHAR(500), v15 VARCHAR(500),
|
||||
v16 VARCHAR(500), v17 VARCHAR(500), v18 VARCHAR(500)
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
CREATE INDEX idx1 ON t12637786(a,v1);
|
||||
INSERT INTO t12637786 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
|
||||
UPDATE t12637786 SET a=1000;
|
||||
DELETE FROM t12637786;
|
||||
# We need to activate the purge thread at this point to make sure it does not
|
||||
# assert and is able to clean up the old versions of secondary index entries.
|
||||
# But instead of doing a --sleep 10, wait until the rest of the tests in
|
||||
# this file complete before dropping the table. By then, the purge thread
|
||||
# will have delt with the updates above.
|
||||
|
||||
# Bug#12963823 - Test that the purge thread does not crash when
|
||||
# the number of indexes has changed since the UNDO record was logged.
|
||||
create table t12963823(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
|
||||
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob)
|
||||
engine=innodb row_format=dynamic;
|
||||
SET @r = repeat('a', 767);
|
||||
insert into t12963823 values (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r);
|
||||
create index ndx_a on t12963823 (a(500));
|
||||
create index ndx_b on t12963823 (b(500));
|
||||
create index ndx_c on t12963823 (c(500));
|
||||
create index ndx_d on t12963823 (d(500));
|
||||
create index ndx_e on t12963823 (e(500));
|
||||
create index ndx_f on t12963823 (f(500));
|
||||
create index ndx_k on t12963823 (k(500));
|
||||
create index ndx_l on t12963823 (l(500));
|
||||
|
||||
SET @r = repeat('b', 500);
|
||||
update t12963823 set a=@r,b=@r,c=@r,d=@r;
|
||||
update t12963823 set e=@r,f=@r,g=@r,h=@r;
|
||||
update t12963823 set i=@r,j=@r,k=@r,l=@r;
|
||||
update t12963823 set m=@r,n=@r,o=@r,p=@r;
|
||||
alter table t12963823 drop index ndx_a;
|
||||
alter table t12963823 drop index ndx_b;
|
||||
create index ndx_g on t12963823 (g(500));
|
||||
create index ndx_h on t12963823 (h(500));
|
||||
create index ndx_i on t12963823 (i(500));
|
||||
create index ndx_j on t12963823 (j(500));
|
||||
create index ndx_m on t12963823 (m(500));
|
||||
create index ndx_n on t12963823 (n(500));
|
||||
create index ndx_o on t12963823 (o(500));
|
||||
create index ndx_p on t12963823 (p(500));
|
||||
show create table t12963823;
|
||||
# We need to activate the purge thread at this point to see if it crashes
|
||||
# but instead of doing a --sleep 10, wait until the rest of the tests in
|
||||
# this file complete before dropping the table. By then, the purge thread
|
||||
# will have delt with the updates above.
|
||||
|
||||
|
||||
eval set global innodb_file_per_table=$per_table;
|
||||
eval set global innodb_file_format=$format;
|
||||
@@ -462,6 +522,17 @@ create index t1u on t1 (u(1));
|
||||
|
||||
drop table t1;
|
||||
|
||||
# Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE
|
||||
CREATE TABLE bug12547647(
|
||||
a INT NOT NULL, b BLOB NOT NULL, c TEXT,
|
||||
PRIMARY KEY (b(10), a), INDEX (c(10))
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7731));
|
||||
COMMIT;
|
||||
# The following used to cause infinite undo log allocation.
|
||||
--error ER_TOO_BIG_ROWSIZE
|
||||
UPDATE bug12547647 SET c = REPEAT('b',16928);
|
||||
DROP TABLE bug12547647;
|
||||
# Bug#12637786
|
||||
SET @r=REPEAT('a',500);
|
||||
CREATE TABLE t1(a INT,
|
||||
@@ -472,6 +543,7 @@ CREATE TABLE t1(a INT,
|
||||
v13 VARCHAR(500), v14 VARCHAR(500), v15 VARCHAR(500),
|
||||
v16 VARCHAR(500), v17 VARCHAR(500), v18 VARCHAR(500)
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
|
||||
CREATE INDEX idx1 ON t1(a,v1);
|
||||
INSERT INTO t1 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
|
||||
UPDATE t1 SET a=1000;
|
||||
@@ -480,19 +552,6 @@ DELETE FROM t1;
|
||||
-- sleep 10
|
||||
DROP TABLE t1;
|
||||
|
||||
# Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE
|
||||
CREATE TABLE bug12547647(
|
||||
a INT NOT NULL, b BLOB NOT NULL, c TEXT,
|
||||
PRIMARY KEY (b(10), a), INDEX (c(10))
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
|
||||
INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7731));
|
||||
COMMIT;
|
||||
# The following used to cause infinite undo log allocation.
|
||||
--error ER_TOO_BIG_ROWSIZE
|
||||
UPDATE bug12547647 SET c = REPEAT('b',16928);
|
||||
DROP TABLE bug12547647;
|
||||
|
||||
eval set global innodb_file_per_table=$per_table;
|
||||
eval set global innodb_file_format=$format;
|
||||
eval set global innodb_file_format_check=$format;
|
||||
@@ -630,11 +689,9 @@ disconnect a;
|
||||
disconnect b;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# Drop these tables since the purge thread must have run by now
|
||||
# and did not crash.
|
||||
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
DROP TABLE t12637786;
|
||||
DROP TABLE t12963823;
|
||||
|
@@ -100,3 +100,44 @@ select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
--echo #
|
||||
--echo #Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
|
||||
--echo #fixed by re-fixing Bug#7975
|
||||
--echo #aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
|
||||
--echo #
|
||||
|
||||
connection default;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
|
||||
BEGIN;
|
||||
# this used to wrongly acquire an X lock; now it takes an S lock
|
||||
INSERT IGNORE INTO t1 VALUES(3,14);
|
||||
|
||||
connection con1;
|
||||
BEGIN;
|
||||
# this used to wrongly acquire an X lock; now it takes an S lock
|
||||
INSERT IGNORE INTO t1 VALUES(3,23);
|
||||
--send
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT * FROM t1 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
connection default;
|
||||
COMMIT;
|
||||
connection con1;
|
||||
reap;
|
||||
COMMIT;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
|
||||
connection default;
|
||||
DROP TABLE t1;
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
let $per_table=`select @@innodb_file_per_table`;
|
||||
let $format=`select @@innodb_file_format`;
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
set global innodb_file_per_table=off;
|
||||
set global innodb_file_format=`0`;
|
||||
|
||||
@@ -337,4 +336,3 @@ drop table normal_table, zip_table;
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format=$format;
|
||||
eval set global innodb_file_per_table=$per_table;
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@@ -1042,6 +1042,24 @@ update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id
|
||||
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
drop table t3,t2,t1;
|
||||
|
||||
# test ON UPDATE CASCADE
|
||||
CREATE TABLE t1 (
|
||||
c1 VARCHAR(8), c2 VARCHAR(8),
|
||||
PRIMARY KEY (c1, c2)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
c0 INT PRIMARY KEY,
|
||||
c1 VARCHAR(8) UNIQUE,
|
||||
FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
|
||||
-- error ER_FOREIGN_DUPLICATE_KEY
|
||||
UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
|
||||
DROP TABLE t2,t1;
|
||||
|
||||
#
|
||||
# test for recursion depth limit
|
||||
#
|
||||
|
@@ -15,7 +15,6 @@ SET storage_engine=InnoDB;
|
||||
-- disable_result_log
|
||||
|
||||
let $file_format=`select @@innodb_file_format`;
|
||||
let $file_format_check=`select @@innodb_file_format_check`;
|
||||
let $file_per_table=`select @@innodb_file_per_table`;
|
||||
SET GLOBAL innodb_file_format='Barracuda';
|
||||
SET GLOBAL innodb_file_per_table=on;
|
||||
@@ -28,5 +27,4 @@ INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.90
|
||||
CHECK TABLE table0 EXTENDED;
|
||||
DROP TABLE table0;
|
||||
EVAL SET GLOBAL innodb_file_format=$file_format;
|
||||
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
|
||||
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
|
||||
|
@@ -0,0 +1 @@
|
||||
--force-restart
|
@@ -3,7 +3,6 @@ let collation=utf8_persian_ci;
|
||||
--source include/have_collation.inc
|
||||
|
||||
let $file_format=`select @@innodb_file_format`;
|
||||
let $file_format_check=`select @@innodb_file_format_check`;
|
||||
let $file_per_table=`select @@innodb_file_per_table`;
|
||||
SET GLOBAL innodb_file_format='Barracuda';
|
||||
SET GLOBAL innodb_file_per_table=on;
|
||||
@@ -107,5 +106,4 @@ SHOW WARNINGS;
|
||||
DROP TABLE bug52745;
|
||||
|
||||
EVAL SET GLOBAL innodb_file_format=$file_format;
|
||||
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
|
||||
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
|
||||
|
@@ -4,7 +4,6 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
|
||||
let $file_format=`select @@innodb_file_format`;
|
||||
let $file_format_check=`select @@innodb_file_format_check`;
|
||||
let $file_per_table=`select @@innodb_file_per_table`;
|
||||
|
||||
SET GLOBAL innodb_file_format='Barracuda';
|
||||
@@ -21,5 +20,4 @@ SHOW WARNINGS;
|
||||
DROP TABLE bug53591;
|
||||
|
||||
EVAL SET GLOBAL innodb_file_format=$file_format;
|
||||
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
|
||||
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
|
||||
|
@@ -8,7 +8,6 @@
|
||||
SET @tx_isolation_orig = @@tx_isolation;
|
||||
SET @innodb_file_per_table_orig = @@innodb_file_per_table;
|
||||
SET @innodb_file_format_orig = @@innodb_file_format;
|
||||
SET @innodb_file_format_check_orig = @@innodb_file_format_check;
|
||||
# The flag innodb_change_buffering_debug is only available in debug builds.
|
||||
# It instructs InnoDB to try to evict pages from the buffer pool when
|
||||
# change buffering is possible, so that the change buffer will be used
|
||||
@@ -138,6 +137,5 @@ DROP TABLE bug56680;
|
||||
SET GLOBAL tx_isolation = @tx_isolation_orig;
|
||||
SET GLOBAL innodb_file_per_table = @innodb_file_per_table_orig;
|
||||
SET GLOBAL innodb_file_format = @innodb_file_format_orig;
|
||||
SET GLOBAL innodb_file_format_check = @innodb_file_format_check_orig;
|
||||
-- error 0, ER_UNKNOWN_SYSTEM_VARIABLE
|
||||
SET GLOBAL innodb_change_buffering_debug = @innodb_change_buffering_debug_orig;
|
||||
|
@@ -3,8 +3,6 @@
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb_plugin.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
# Close tables used by other tests (to not get crashed myisam tables)
|
||||
flush tables;
|
||||
|
||||
@@ -69,5 +67,3 @@ XA COMMIT '789';
|
||||
SELECT * FROM t;
|
||||
|
||||
DROP TABLE t;
|
||||
--disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@@ -0,0 +1 @@
|
||||
--innodb-buffer-pool-size=8M
|
59
mysql-test/suite/innodb_plugin/t/innodb_cmp_drop_table.test
Normal file
59
mysql-test/suite/innodb_plugin/t/innodb_cmp_drop_table.test
Normal file
@@ -0,0 +1,59 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
|
||||
let $per_table=`select @@innodb_file_per_table`;
|
||||
let $format=`select @@innodb_file_format`;
|
||||
|
||||
-- let $query_i_s = SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0
|
||||
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format=`1`;
|
||||
|
||||
create table t1(a text) engine=innodb key_block_size=8;
|
||||
|
||||
-- disable_query_log
|
||||
|
||||
# insert some rows so we are using compressed pages
|
||||
-- let $i = 10
|
||||
while ($i)
|
||||
{
|
||||
insert into t1 values(repeat('abcdefghijklmnopqrstuvwxyz',100));
|
||||
dec $i;
|
||||
}
|
||||
-- enable_query_log
|
||||
|
||||
# we should be using some 8K pages
|
||||
-- eval $query_i_s
|
||||
|
||||
drop table t1;
|
||||
|
||||
# no lazy eviction at drop table in 5.1 there should still be no
|
||||
# used 8K pages
|
||||
-- eval $query_i_s
|
||||
|
||||
# create a non-compressed table and insert enough into it to evict
|
||||
# compressed pages
|
||||
create table t2(a text) engine=innodb;
|
||||
|
||||
-- disable_query_log
|
||||
|
||||
-- let $i = 200
|
||||
while ($i)
|
||||
{
|
||||
insert into t2 values(repeat('abcdefghijklmnopqrstuvwxyz',1000));
|
||||
dec $i;
|
||||
}
|
||||
|
||||
-- enable_query_log
|
||||
|
||||
# now there should be no 8K pages in the buffer pool
|
||||
-- eval $query_i_s
|
||||
|
||||
drop table t2;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format=$format;
|
||||
eval set global innodb_file_per_table=$per_table;
|
@@ -0,0 +1 @@
|
||||
--force-restart
|
1
mysql-test/suite/innodb_plugin/t/innodb_misc1-master.opt
Normal file
1
mysql-test/suite/innodb_plugin/t/innodb_misc1-master.opt
Normal file
@@ -0,0 +1 @@
|
||||
--binlog_cache_size=32768 --innodb_lock_wait_timeout=1
|
1178
mysql-test/suite/innodb_plugin/t/innodb_misc1.test
Normal file
1178
mysql-test/suite/innodb_plugin/t/innodb_misc1.test
Normal file
File diff suppressed because it is too large
Load Diff
186
mysql-test/suite/innodb_plugin/t/innodb_replace.test
Normal file
186
mysql-test/suite/innodb_plugin/t/innodb_replace.test
Normal file
@@ -0,0 +1,186 @@
|
||||
--source include/have_innodb_plugin.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
--echo #
|
||||
--echo #Bug#11759688 52020: InnoDB can still deadlock
|
||||
--echo #on just INSERT...ON DUPLICATE KEY
|
||||
--echo #a.k.a. Bug#7975 deadlock without any locking, simple select and update
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
connection con1;
|
||||
|
||||
BEGIN;
|
||||
# normal INSERT of a duplicate should only S-lock the existing record (3,1)
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert1 WAIT_FOR select1';
|
||||
--send
|
||||
INSERT INTO t1 VALUES(3,2);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert1';
|
||||
# this should S-lock (3,1); no conflict
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
# this should X-lock (3,1), conflicting with con1
|
||||
--send
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT * FROM t1 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select1';
|
||||
|
||||
connection con1;
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
# We are still holding an S-lock on (3,1) after the failed INSERT.
|
||||
# The following will upgrade it to an X-lock, causing a deadlock.
|
||||
# InnoDB should resolve the deadlock by aborting the blocked SELECT.
|
||||
INSERT INTO t1 VALUES(3,3) ON DUPLICATE KEY UPDATE b=b+10;
|
||||
|
||||
connection default;
|
||||
--error ER_LOCK_DEADLOCK
|
||||
reap;
|
||||
connection con1;
|
||||
COMMIT;
|
||||
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert2 WAIT_FOR select2';
|
||||
--send
|
||||
REPLACE INTO t1 VALUES(3,4);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert2';
|
||||
SELECT * FROM t1;
|
||||
--send
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked because of X lock.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT * FROM t1 LOCK IN SHARE MODE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select2';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert3 WAIT_FOR select3';
|
||||
--send
|
||||
INSERT INTO t1 VALUES(3,5) ON DUPLICATE KEY UPDATE b=b+20;
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert3';
|
||||
--send
|
||||
SELECT b FROM t1 LOCK IN SHARE MODE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked because of X lock.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT b FROM t1 LOCK IN SHARE MODE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select3';
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert4 WAIT_FOR select4';
|
||||
--send
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert4';
|
||||
# this should S-lock (3,1); no conflict
|
||||
SELECT b FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
# this should X-lock (3,1), conflicting with con1
|
||||
--send
|
||||
SELECT b FROM t1 WHERE a=3 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'statistics' and
|
||||
info = 'SELECT b FROM t1 WHERE a=3 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select4';
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
connection con1;
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert5 WAIT_FOR select5';
|
||||
--send
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' IGNORE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert5';
|
||||
SELECT * FROM t1;
|
||||
# this should S-lock; no conflict
|
||||
SELECT * FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
# this should X-lock, conflicting with the S-lock of the IGNORE in con1
|
||||
--send
|
||||
SELECT * FROM t1 WHERE a=3 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'statistics' and
|
||||
info = 'SELECT * FROM t1 WHERE a=3 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select5';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
connection con1;
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert6 WAIT_FOR select6';
|
||||
--send
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' REPLACE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert6';
|
||||
SELECT * FROM t1;
|
||||
# this should conflict with the X-lock acquired by the REPLACE
|
||||
--send
|
||||
SELECT a,b FROM t1 LOCK IN SHARE MODE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT a,b FROM t1 LOCK IN SHARE MODE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select6';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t1;
|
Reference in New Issue
Block a user