UK restriction not working when inserting inside a transaction from different nodes
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC | Status tracked in 5.6 | |||||
5.5 |
Confirmed
|
Undecided
|
Unassigned | |||
5.6 |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Hello,
We have found that when inserting inside a trx from different nodes, UK checks are not working and we are able to insert duplicated values.
Here the table definition:
mysql> show create table t1\G
*******
Table: t1
Create Table: CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
`c3` varchar(1) DEFAULT NULL,
PRIMARY KEY (`c1`),
UNIQUE KEY `c2` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
FROM NODE 1:
mysql> start transaction; insert into t1(c2,c3) values(1,'A');
Query OK, 0 rows affected (0.00 sec)
FROM NODE 2:
mysql> start transaction; insert into t1(c2,c3) values(1,'B');
Query OK, 0 rows affected (0.00 sec)
FROM NODE 1:
mysql> commit;
Query OK, 0 rows affected (0.02 sec)
FROM NODE 2:
mysql> commit;
Query OK, 0 rows affected (0.02 sec)
mysql> select * from t1;
+----+-
| c1 | c2 | c3 |
+----+-
| 1 | 1 | A |
| 2 | 1 | B |
+----+-
2 rows in set (0.01 sec)
VERSION:
mysql> show global variables like '%version%';
+------
| Variable_name | Value |
+------
| innodb_version | 5.5.37-35.0-35.0 |
| protocol_version | 10 |
| slave_type_
| version | 5.5.37-35.0-55 |
| version_comment | Percona XtraDB Cluster (GPL), Release 25.10, wsrep_25.10.r3985 |
| version_
| version_compile_os | debian-linux-gnu |
+------
mysql> show global status like '%provider_
+------
| Variable_name | Value |
+------
| wsrep_provider_
+------
1 row in set (0,00 sec)
Verified with PXC 5.5.37
Node 1:
mysql> CREATE TABLE `tb1` (
-> `c1` int(11) NOT NULL AUTO_INCREMENT,
-> `c2` int(11) DEFAULT NULL,
-> `c3` varchar(1) DEFAULT NULL,
-> PRIMARY KEY (`c1`),
-> UNIQUE KEY `c2` (`c2`)
-> ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.07 sec)
mysql>
mysql> start transaction; insert into tb1(c2,c3) values(1,'A');
Query OK, 0 rows affected (0.00 sec)
Query OK, 1 row affected (0.00 sec)
Node 2:
mysql> start transaction; insert into tb1(c2,c3) values(1,'B');
Query OK, 0 rows affected (0.00 sec)
Query OK, 1 row affected (0.00 sec)
Node 1:
mysql> commit;
Query OK, 0 rows affected (0.03 sec)
Node 2:
mysql> commit;
Query OK, 0 rows affected (0.05 sec)
mysql> select * from tb1; -----+- -----+ -----+- -----+ -----+- -----+
+----+-
| c1 | c2 | c3 |
+----+-
| 1 | 1 | A |
| 2 | 1 | B |
+----+-
2 rows in set (0.00 sec)
mysql>