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

SHOW SLAVE STATUS does not correctly reflect broken replication

    XMLWordPrintable

Details

    Description

      We intentionally inserted some data on a slave which should arrive from the master at the same time. The following Query was running on Master all the time and twice on the Slave:

      insert into test values (null, 'stop repl', null);
      

      this was to show how replication will stop and how this will look like in SHOW SLAVE STATUS. Unfortunately SHOW SLAVE STATUS die NOT show this behaviour but was displaying:

                   Slave_IO_Running: Yes
                  Slave_SQL_Running: Yes
      

      But replication clearly stopped. No more rows were inserted on Slave in table test.

      After stopping and starting slave this state was also reflected in the SHOW SLAVE STATUS command.

      Last_Errno: 1062
      Last_Error: Error 'Duplicate entry '174985' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'insert into test values (NULL, 'Test data insert', CURRENT_TIMESTAMP())'
      

      Unfortunately we could not reproduce this behaviour nor create a reproducible test case.

      The steps we did on the Slave were as follows:

      zcat /tmp/fulldump.sql.gz | mysql -uroot
      set global innodb_flush_log_at_trx_commit = 0;
       
      change master to master_host='notebook12', master_user='slave', master_password='password';
      show slave status\G
      CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000002', MASTER_LOG_POS=368;
      show slave status\G
      start slave;
      show slave status\G
      set global read_only = on;
      use test
      show create table test\G
      -- 2x
      insert into test values (null, 'stop repl', null);
      select * from test where data = 'stop repl';
      show slave status\G
      select * from test where data = 'stop repl';
      select * from test where id between 174980 and 174990;
      select * from test where id between 174980 and 174995;
      select * from test where id between 174980 and 175000;
      -- We were confused here why rows did not show up
      show slave status\G
      select * from test where id between 174980 and 175000;
      select * from test where id between 174980 and 176000;
      select * from test where id between 174980;
      select * from test;
      stop slave;
      start slave;
      show slave status\G --> Error
      

      Table looks as follows:

      CREATE TABLE `test` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `data` varchar(64) DEFAULT NULL,
        `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
        PRIMARY KEY (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      ;
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            oli Oli Sennhauser
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.