Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HA_ERR_FOUND_DUPP_KEY Clone Plugin for Replication with GTID mode #1507

Open
rockeet opened this issue Dec 12, 2024 · 1 comment
Open

HA_ERR_FOUND_DUPP_KEY Clone Plugin for Replication with GTID mode #1507

rockeet opened this issue Dec 12, 2024 · 1 comment

Comments

@rockeet
Copy link
Contributor

rockeet commented Dec 12, 2024

Got HA_ERR_FOUND_DUPP_KEY using Clone Plugin for Replication(with GTID mode). Replication Works fine with InnoDB, also fine with clone by xtrabackup and MyRocks.

myrocks version : 8.0.32 git sha: 69710da

server1:

#/root/test.sh
#!/bin/bash
mysql  -e '
CREATE DATABASE IF NOT EXISTS test;
use test;
CREATE TABLE IF NOT EXISTS large_data (
    id INT AUTO_INCREMENT PRIMARY KEY, 
    content VARCHAR(1024)
)ENGINE=RocksDB;

DELIMITER $$
DROP PROCEDURE IF EXISTS insert_large_data;
CREATE PROCEDURE insert_large_data()
BEGIN
    DECLARE i INT DEFAULT 0; 
    WHILE i < 2000000 DO
        INSERT INTO large_data (content)
        VALUES (SUBSTRING(CONCAT(MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND())), 1, 1024));
        SET i = i + 1;
    END WHILE;    
END $$
DELIMITER ;
'
while true;
do
	if [ -e /root/stop ];then
		break;
	fi
  mysql -Dtest -e "call insert_large_data()";
done;

run bash /root/test.sh on server1 before start clone on server2.
then create user on server 1 for clone :

CREATE USER 'clone'@'%' IDENTIFIED BY 'test123';
GRANT ALL ON *.* TO 'clone'@'%';
ALTER USER 'clone'@'%' IDENTIFIED WITH mysql_native_password BY 'test123';
flush privileges;

then run clone on server2:

set global clone_valid_donor_list ='10.3.0.121:3306';
CLONE INSTANCE FROM 'clone'@'10.3.0.121':3306 IDENTIFIED BY 'test123';

after restart srever2 :

change master to master_host='10.3.0.121', master_user='clone', master_password='test123',master_auto_position=1;
start slave;

I got 1602 error:

mysql> show slave status\G
*************************** 1. row ***************************
                Slave_IO_State: Waiting for source to send event
                   Master_Host: 10.3.0.121
                   Master_User: clone
                   Master_Port: 3306
                 Connect_Retry: 60
               Master_Log_File: binlog.000001
           Read_Master_Log_Pos: 20537793
                Relay_Log_File: iZwz9azwk66n3vfhfj5rjdZ-relay-bin.000002
                 Relay_Log_Pos: 1647
         Relay_Master_Log_File: binlog.000001
              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_Symbolic_Errno: regular sql errno
                    Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'ea7ca911-b823-11ef-9485-00163e0a62a9:12' at master log binlog.000001, end_log_pos 3562; Could not execute Write_rows event on table test.large_data; Duplicate entry '1' for key 'large_data.PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log binlog.000001, end_log_pos 3562; See error log and/or                        performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

Here is my.cnf for two servers:

[client]
default-character-set=utf8mb4
socket=/var/lib/mysql/mysql.sock
[mysql]
default-character-set=utf8mb4
[mysqldump]
default-character-set=utf8mb4
[mysqld]
# server-id should be not same for them
server-id=167968889 
transaction_isolation=Repeatable-read
user=mysql
datadir=/var/lib/mysql
plugin_dir=/usr/local/mysql/lib/plugin
pid-file=/tmp/mysqld.pid
socket=/var/lib/mysql/mysql.sock
mysqlx_socket=/var/lib/mysql/mysqlx.sock
default-storage-engine=rocksdb
plugin-load-add=mysql_clone.so
character-set-server=utf8mb4
binlog-format=ROW
log_timestamps=SYSTEM
skip-name-resolve
disabled_storage_engines=myisam
bind-address=0.0.0.0
gtid_mode=ON
enforce_gtid_consistency=ON
#replicate-do-db
binlog-ignore-db = sys,performance_schema,information_schema
@laurynas-biveinis
Copy link
Contributor

Do you have sample server logs from server1 during clone and server2 startup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants