MDEV#5552 Deadlock when inserting NULL column value

in column with UNIQUE index

References: lp:1276424
This commit is contained in:
Nirbhay Choubey 2014-02-28 23:15:35 -05:00
parent c3a2394641
commit 689aaab0f8
2 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,47 @@
#
# MDEV#5552 Deadlock when inserting NULL column value in column with
# UNIQUE index
#
USE test;
# On node_1
CREATE TABLE t1(c1 INT DEFAULT NULL, UNIQUE KEY c1(c1)) ENGINE=INNODB;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM test.t1;
c1
NULL
NULL
# On node_2
SELECT * FROM test.t1;
c1
NULL
NULL
# On node_1
INSERT INTO t1 VALUES (1);
UPDATE t1 SET c1=NULL WHERE c1=1;
SELECT * FROM test.t1;
c1
NULL
NULL
NULL
# On node_2
SELECT * FROM test.t1;
c1
NULL
NULL
NULL
# On node_1
DELETE FROM t1 WHERE c1<=>NULL;
SELECT * FROM test.t1;
c1
# On node_2
SELECT * FROM test.t1;
c1
DROP TABLE t1;
# End of test

View file

@ -0,0 +1,54 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV#5552 Deadlock when inserting NULL column value in column with
--echo # UNIQUE index
--echo #
USE test;
--echo
--echo # On node_1
--connection node_1
CREATE TABLE t1(c1 INT DEFAULT NULL, UNIQUE KEY c1(c1)) ENGINE=INNODB;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM test.t1;
--echo
--echo # On node_2
--connection node_2
SELECT * FROM test.t1;
--echo
--echo # On node_1
--connection node_1
INSERT INTO t1 VALUES (1);
UPDATE t1 SET c1=NULL WHERE c1=1;
SELECT * FROM test.t1;
--echo
--echo # On node_2
--connection node_2
SELECT * FROM test.t1;
--echo
--echo # On node_1
--connection node_1
DELETE FROM t1 WHERE c1<=>NULL;
SELECT * FROM test.t1;
--echo
--echo # On node_2
--connection node_2
SELECT * FROM test.t1;
--let $galera_diff_statement = SELECT * FROM t1
--source include/galera_diff.inc
# Cleanup
DROP TABLE t1;
--source include/galera_end.inc
--echo # End of test