Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

replication from MySQL 5.1.73 to MariaDB 10.1.22 - Duplicate Entry issues

$
0
0

We are upgrading webservers and are trying to do the migration without downtime.

We're currently running MySQL 5.1.73 as a master and the new server (slave) is MariaDB 10.1.22

We have temporary tables in MySQL that get used to create statistics and then they are truncated.

The SQL that gets run is an INSERT..SELECT 0, (0 is for the primary column id that has auto increment)..

insert into tempStats select 0,tl.date,tl.sellerId...

I did a mysqldump from MySQL got the position, imported the data to MariaDB, started up the slave and then we keep getting the 'Duplicate entry' SQL errors.

Example:

MariaDB [(none)]> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event

          Master_Host: SERVERIP_HERE

          Master_User: st3slave

Master_Port: 3306

        Connect_Retry: 60

      Master_Log_File: mysqld-bin.001097

  Read_Master_Log_Pos: 346910538

       Relay_Log_File: main-dom0-relay-bin.000002

        Relay_Log_Pos: 69379592

Relay_Master_Log_File: mysqld-bin.001093

     Slave_IO_Running: Yes

    Slave_SQL_Running: No

      Replicate_Do_DB: database_name_here

  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 '1923' for key 'PRIMARY'' on query. Default database: 'XYZ'. Query: 'insert into tempStats select 0,tl.date,tl.sellerId from tempLeadStatsSellersLeadsData tl left join tempLeadStatsSellers t on (t.date = tl.date AND t.sellerId = tl.sellerId AND t.type = tl.type AND t.subId = tl.subId) where isnull(t.date)'

         Skip_Counter: 0

  Exec_Master_Log_Pos: 410583345


      Relay_Log_Space: 4300695570

      Until_Condition: None

       Until_Log_File:
        Until_Log_Pos: 0
   Master_SSL_Allowed: Yes

   Master_SSL_CA_File: /etc/mysql/sslcerts/ca-cert.pem
   Master_SSL_CA_Path:
      Master_SSL_Cert: /etc/mysql/sslcerts/new-live-server-cert.pem
    Master_SSL_Cipher:

       Master_SSL_Key: /etc/mysql/sslcerts/new-live-server-key.pem
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 '1923' for key 'PRIMARY'' on query. Default database: 'XYZ'. Query: 'insert into tempStats select 0,tl.date,tl.sellerId from tempLeadStatsSellersLeadsData tl left join tempLeadStatsSellers t on (t.date = tl.date AND t.sellerId = tl.sellerId AND t.type = tl.type AND t.subId = tl.subId) where isnull(t.date)'

Replicate_Ignore_Server_Ids:

     Master_Server_Id: 4
       Master_SSL_Crl: /etc/mysql/sslcerts/ca-cert.pem
   Master_SSL_Crlpath:
           Using_Gtid: No
          Gtid_IO_Pos:

Replicate_Do_Domain_Ids: Replicate_Ignore_Domain_Ids:

        Parallel_Mode: none

1 row in set (0.00 sec)

It's easy for us to do:

SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; stop slave; start slave;

show slave status\G;

But the problem is these reports get rebuilt every 5 minutes. We thought it was the parallel mode and have set these options in Maria db cnf:

slave-parallel-threads=0

slave_parallel_threads=0

slave_parallel_mode=none

slave-parallel-mode=none

The SQL that it's failing on is a table that has the first column as the primary key that is on auto_increment and the query inserts "0" as the first column, so it seems like MariaDB is still doing some kind of parallel insertion here?

here's a copy of the server.cnf from the slave that's running MariaDB:

[mysqld] slow_query_log = 1 slow_query_log_file = /var/log/mysql-slow.log long_query_time = 2 # log_queries_not_using_indexes

slave which db to fetch from master

replicate-do-db=DB_NAME

end slave config

server_id=55

ssl

enable mysql replication over ssl

ssl

ssl-ca=/etc/mysql/sslcerts/ca-cert.pem ssl-cert=/etc/mysql/sslcerts/new-live-server-cert.pem ssl-key=/etc/mysql/sslcerts/new-live-server-key.pem

#master

#which db to dump to binlog

log-bin=mysql-bin

#lets log the updates we get from the master to binlog too

#so that the dev box can read these too

log-slave-updates

binlog-do-db=DB_NAME_HERE

#end master config Anyone have any insight into why we keep getting these duplicate inserts errors?


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>