Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-14566

Replication stops with error 1062 on slave

    XMLWordPrintable

Details

    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"))

      Attachments

        Activity

          People

            Unassigned Unassigned
            Pumuckl77 Florian Th
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.