Not able to re-initialize the replication

Document ID : KB000097922
Last Modified Date : 17/09/2018
Show Technical Document Details
Issue:
When I check the slave status, I just see one error. So there is just 1 error. Is there a way to check for more duplicates? 
[root~]# mysql -e 'show slave status\G' 
*************************** 1. row *************************** 
Slave_IO_State: Waiting for master to send event 
Master_Host: xxx.xx.com 
Master_User: repluser 
Master_Port: 3307 
Connect_Retry: 100 
Master_Log_File: ssgbin-log.000002 
Read_Master_Log_Pos: 133670013 
Relay_Log_File: ssgrelay-bin.000006 
Relay_Log_Pos: 2233683 
Relay_Master_Log_File: ssgbin-log.000002 
Slave_IO_Running: Yes 
Slave_SQL_Running: No 
Replicate_Do_DB: 
Replicate_Ignore_DB: 
Replicate_Do_Table: 
Replicate_Ignore_Table: 
Replicate_Wild_Do_Table: 
Replicate_Wild_Ignore_Table: 
Last_Errno: 1062 
Last_Error: Error 'Duplicate entry 'a320457cde-99.238.100.148' for key 'countername'' on query. Default database: 'ssg'. Query: 'insert into counters (countername, goid) values ('a320457cde-99.238.100.148', x'1962874862065718D8BF365623EA6DED')' 
Skip_Counter: 0 
Exec_Master_Log_Pos: 116689591 
Relay_Log_Space: 19177003 
Until_Condition: None 
Until_Log_File: 
Until_Log_Pos: 0 
Master_SSL_Allowed: No 
Master_SSL_CA_File: 
Master_SSL_CA_Path: 
Master_SSL_Cert: 
Master_SSL_Cipher: 
Master_SSL_Key: 
Seconds_Behind_Master: NULL 
Master_SSL_Verify_Server_Cert: No 
Last_IO_Errno: 0 
Last_IO_Error: 
Last_SQL_Errno: 1062 
Last_SQL_Error: Error 'Duplicate entry 'a320457cde-99.238.100.148' for key 'countername'' on query. Default database: 'ssg'. Query: 'insert into counters (countername, goid) values ('a320457cde-99.238.100.148', x'1962874862065718D8BF365623EA6DED')' 
Replicate_Ignore_Server_Ids: 
Master_Server_Id: 2 
Environment:
9.3 CR01
Cause:
The replication was broken due to duplicate entries in 'counter' table or relay logs
Resolution:
Advised the user to carry out the following steps which has resolved the customer's problem.

1. check there is no duplicates in the counter table. 
    >> select count(*), countername from counters  group by countername having count(*) > 1 
if there are duplicates, you may consider the deleting them from 'counters'  table:
   a. keep a backup copy of counter table : 
       CREATE TABLE IF NOT EXISTS counter_bk SELECT * FROM counter; 
   b.. remove the specific counter from the 'counter' table: 
        DELETE FROM counter WHERE countername = 'a320457cde-99.238.100.148' 

2. clean up the bin logs and relay logs using the following KB article
     https://comm.support.ca.com/kb/mysql-partition-is-100-full-mysql-wont-operate/kb000044691

3. Finally, reinitialize the replication. 
    https://comm.support.ca.com/kb/reinitialize-replication-in-a-multinode-cluster/kb000044402