# UK restriction not working when inserting inside a transaction from different nodes

**URL:** <https://forums.percona.com/t/uk-restriction-not-working-when-inserting-inside-a-transaction-from-different-nodes/3668>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [August 8, 2014, 5:24am UTC](https://forums.percona.com/t/uk-restriction-not-working-when-inserting-inside-a-transaction-from-different-nodes/3668 "2014-08-08T05:24:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsancheztello](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@jsancheztello](https://forums.percona.com/u/jsancheztello)\
**Post date:** [August 8, 2014, 5:24am UTC](https://forums.percona.com/t/uk-restriction-not-working-when-inserting-inside-a-transaction-from-different-nodes/3668/1 "2014-08-08T05:24:15Z")

</div>

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  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1. row \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
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\_conversions | |  
| version | 5.5.37-35.0-55 |  
| version\_comment | Percona XtraDB Cluster (GPL), Release 25.10, wsrep\_25.10.r3985 |  
| version\_compile\_machine | x86\_64 |  
| version\_compile\_os | debian-linux-gnu |  
±------------------------±---------------------------------------------------------------+

mysql\> show global status like ‘%provider\_version%’;  
±-----------------------±-----------+  
| Variable\_name | Value |  
±-----------------------±-----------+  
| wsrep\_provider\_version | 2.10(r175) |  
±-----------------------±-----------+  
1 row in set (0,00 sec)

---

<div class="post-metadata">

**Author:** ![taka-h](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/taka-h/32/1023_2.png) [@taka-h](https://forums.percona.com/u/taka-h)\
**Post date:** [August 11, 2014, 2:29am UTC](https://forums.percona.com/t/uk-restriction-not-working-when-inserting-inside-a-transaction-from-different-nodes/3668/2 "2014-08-11T02:29:27Z")

</div>

somebody seems to register this bug.

[URL=“[https://bugs.launchpad.net/percona-xtradb-cluster/+bug/1354385](https://bugs.launchpad.net/percona-xtradb-cluster/+bug/1354385)”][https://bugs.launchpad.net/percona-x...r/+bug/1354385[/URL]](https://bugs.launchpad.net/percona-x...r/+bug/1354385%5B/URL%5D)

---

<div class="post-metadata">

**Author:** ![jsancheztello](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@jsancheztello](https://forums.percona.com/u/jsancheztello)\
**Post date:** [August 11, 2014, 3:01am UTC](https://forums.percona.com/t/uk-restriction-not-working-when-inserting-inside-a-transaction-from-different-nodes/3668/3 "2014-08-11T03:01:23Z")

</div>

That’s me 😉

---

<div class="post-metadata">

**Author:** ![taka-h](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/taka-h/32/1023_2.png) [@taka-h](https://forums.percona.com/u/taka-h)\
**Post date:** [August 11, 2014, 7:34am UTC](https://forums.percona.com/t/uk-restriction-not-working-when-inserting-inside-a-transaction-from-different-nodes/3668/4 "2014-08-11T07:34:14Z")

</div>

I also think this is bug. thank you for your good report!
