Bug #86890 Dupllicate Entry in Slave
Submitted: 30 Jun 2017 14:58 Modified: 10 Jul 2017 11:57
Reporter: Anirudh Vasudevan Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.7 OS:CentOS
Assigned to: MySQL Verification Team CPU Architecture:Any
Tags: Duplicate Key Entry, replication, slave

[30 Jun 2017 14:58] Anirudh Vasudevan
Description:
I've come across the duplicate entry for primary error in my slave quite a few times. That was due to inconsistency of data in Master and Slave. But this time, the same error occured despite the slave being in complete sync with Master. I had globally increased innodb_buffer_pool_size to 4GB and key_buffer_size to 1GB and soon after, the slave failed saying "Error 1062 Duplicate Entry for Primary".
Are these connected in any way ? 

I started skipping a few errors(set global sql_slave_skip_counter=1) thinking that it would be less, but I was getting the duplicate error for almost every table in my database. Finding this very strange. Would be great if someone threw some light on this.

Thanks & Regards,
Anirudh

How to repeat:
Configure a Master-Slave Replication

Increase innodb_buffer_pool size and key_buffer_size globally.
[30 Jun 2017 18:03] Anirudh Vasudevan
Does it cause any problem if one tries to increase buffer_pool_size or key_buffer_size globally while replication is active?
[10 Jul 2017 11:57] MySQL Verification Team
Hi,

The size of the ibdpool and keybuffer are not related to the duplicate key. You have issues with how your system is configured and solving that can't happen trough bugs system. If you like, please, contact MySQL Support team (https://support.oracle.com) and they will be happy to help you setup your system properly.

best regards
Bogdan