0

I am using MariaDB 10.2.10 under Debian 9 in Master/Slave replication. I am experiencing problems with replication since the slave is refusing replication due to 1062 duplicate key errors.

After a long time of investigation I found, that the binlog of the master contains the same INSERT statement twice. It is written in statement AND row based format. binlog_format is set to MIXED.

I had a look at general log - the INSERT statement was only commited once.

Heres the outpout of mysqlbinlog:

# at 11481089
#171205 10:22:37 server id 126  end_log_pos 11481132 CRC32 0x73b0f77c   
                 Write_rows: table id 22683990 flags: STMT_END_F
### INSERT INTO `mydb`.`document_reference`
### SET
###   @1=30561
###   @2=6
###   @3=0

# at 11481132
#171205 10:22:37 server id 126  end_log_pos 11481387 CRC32 0x599e2b04       
                 Query   thread_id=3282752       exec_time=0     error_code=0
SET TIMESTAMP=1512465757/*!*/;
INSERT INTO document_reference 
(document_reference_document_id, document_reference_type, document_reference_value) 
VALUES (30561, "single", 0)
/*!*/;
# at 11481387
#171205 10:22:37 server id 126  end_log_pos 11481418 CRC32 0x73fe1166   Xid = 248234294
COMMIT/*!*/;

Anyone has an idea, why this statement is written twice to the binlog?

Pumuckl77
  • 1
  • 1
  • What is `BINLOG_MODE`? What is the client? Can this be reproduced using the commandline mysql client? – Rick James Dec 05 '17 at 17:50
  • BINLOG_MODE is mixed. It's PHP code which rans the query. I cannot reproduce the same issue via command line. – Pumuckl77 Dec 05 '17 at 18:31
  • In addition, the same code is running without errors on several master/slave-pairs running MariaDB 10.0.x also with binlog_mode=mixed. We just set up a new pair running with MariaDB 10.2.10 and now we experience that failure. Maybe there was some change regarding binlog in the last versions? – Pumuckl77 Dec 05 '17 at 18:33

0 Answers0