[MDEV-14566] Replication stops with error 1062 on slave Created: 2017-12-04  Updated: 2018-01-11  Resolved: 2018-01-11

Status: Closed
Project: MariaDB Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Florian Th Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: duplicate_key, need_feedback, replication
Environment:

Debian 9



 Description   

I've been setting up two Debian Stretch based MariaDB-Server in Master-Slave-Replication.

Slave's replication config section is:

server-id = 2226
auto_increment_increment = 1
auto_increment_offset = 1
log_bin = /var/tmp/mysql_binlog/mysql-bin.log
log_bin_index = /var/tmp/mysql_binlog/mysql-bin.log.index
expire_logs_days = 3
max_binlog_size = 100M
relay_log = /var/tmp/mysql_binlog/slave-relay.log
relay_log_index = /var/tmp/mysql_binlog/slave-relay.log.index
log_slave_updates = 1
replicate_annotate_row_events = 0
log_bin_trust_function_creators = 1

I am experiencing the following error:

show slave status\G;

Relay_Log_File: slave-relay.032025
Relay_Log_Pos: 14887746
Relay_Master_Log_File: mysql-bin.001119
Slave_IO_Running: Yes
Last_Errno: 1062
Last_Error: Error 'Duplicate entry '71899-single' for key 'PRIMARY'' on query. Default database: 'mydb'. Query: 'INSERT INTO document_reference
(document_reference_document_id, document_reference_type, document_reference_value)
VALUES (71899, "single", 0)'

but:

MariaDB [(none)]> select * from mydb.document_reference WHERE document_reference_document_id=71899;
Empty set (0.00 sec)

I've looked up the relay log file - there is only one insert statement.

Anyone has an idea what causes duplicate entry error on slave?

Added information:

Master settings:

auto_increment_increment | 1
auto_increment_offset | 1
binlog_format | MIXED

Table definition:

CREATE TABLE "document_reference" (
"document_reference_document_id" int(10) unsigned NOT NULL,
"document_reference_type" enum('single,'multi') COLLATE utf8_unicode_ci
NOT NULL DEFAULT 'single',
"document_reference_value" int(11) NOT NULL,
PRIMARY KEY ("document_reference_document_id","document_reference_type"))



 Comments   
Comment by Elena Stepanova [ 2017-12-11 ]

Please

  • specify the MariaDB version you are using;
  • paste the whole unabridged output of SHOW CREATE TABLE, the one in the description cannot be right, it's has syntax errors;
  • attach complete configuration files, as the mix of quote marks in the description is strange;
  • if possible, attach or at least paste the relevant fragment of the binary log.
Generated at Thu Feb 08 08:14:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.