# Duplicate Primary Key Error with Percona Cluster

**URL:** <https://forums.percona.com/t/duplicate-primary-key-error-with-percona-cluster/3683>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [August 19, 2014, 5:07pm UTC](https://forums.percona.com/t/duplicate-primary-key-error-with-percona-cluster/3683 "2014-08-19T17:07:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MeirW](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@MeirW](https://forums.percona.com/u/MeirW)\
**Post date:** [August 19, 2014, 5:07pm UTC](https://forums.percona.com/t/duplicate-primary-key-error-with-percona-cluster/3683/1 "2014-08-19T17:07:16Z")

</div>

We recently setup our database with a Galera Cluster.  
I have been getting the following errors every few hours:  
Duplicate entry ‘XXXXXXX’ for key ‘PRIMARY’

This occurs with a number of tables, all using InnoDB.

We are using 3 machines in our cluster.  
a. Master  
b. Master  
c. Backup - in case a SST is needed or the other two go down.

wsrep\_auto\_increment\_control is ON.  
innodb\_autoinc\_lock\_mode is set to 2 (as the Percona documentation says this is mandatory).

What is causing it?  
What can we do about it, without using only one Database for writes?

Thanks is advance.

---

<div class="post-metadata">

**Author:** ![guillaume.houdmon](https://avatars.discourse-cdn.com/v4/letter/g/ea666f/32.png) [@guillaume.houdmon](https://forums.percona.com/u/guillaume.houdmon)\
**Post date:** [September 15, 2014, 2:31am UTC](https://forums.percona.com/t/duplicate-primary-key-error-with-percona-cluster/3683/2 "2014-09-15T02:31:58Z")

</div>

I have the same issue with the same architecture.  
Did you find the source of your problem or a workaround?  
Thanks.

---

<div class="post-metadata">

**Author:** ![przemek](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/przemek/32/3_2.png) [@przemek](https://forums.percona.com/u/przemek)\
**Post date:** [October 2, 2014, 1:48pm UTC](https://forums.percona.com/t/duplicate-primary-key-error-with-percona-cluster/3683/3 "2014-10-02T13:48:43Z")

</div>

Can you show an example of such transaction together with table definition? And paste my.cnf. Do you use any MyISAM tables?
