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

mysql.gtid_slave_pos accumulates values for a domain

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • None
    • 10.0.4
    • None
    • None

    Description

      After the fix for MDEV-4688, at any point of time I see two consequent values in mysql.gtid_slave_pos for a given domain:

      # [slave] Table contents after 1st synchronization 
      domain_id	sub_id	server_id	seq_no
      0	1	1	1
      0	2	1	2

      As long as the slave is running, the values get rotated:

      # [slave] Table contents after 2nd synchronization
      domain_id	sub_id	server_id	seq_no
      0	2	1	2
      0	3	1	3

      It's new, but doesn't seem too bad in itself, so if it helps to fix some other issues, so be it.
      However, after server restart, the old values are kept in the table, and new ones are added when replication resumes:

      # [slave] Table contents after 1st restart 
      domain_id	sub_id	server_id	seq_no
      0	2	1	2
      0	3	1	3

      # [slave] Table contents after 3rd synchronization 
      domain_id	sub_id	server_id	seq_no
      0	2	1	2
      0	3	1	3
      0	4	1	4

      # [slave] Table contents after 2nd restart
      domain_id	sub_id	server_id	seq_no
      0	2	1	2
      0	3	1	3
      0	4	1	4

      # [slave] Table contents after 4th synchronization 
      domain_id	sub_id	server_id	seq_no
      0	2	1	2
      0	3	1	3
      0	5	1	5
      0	6	1	6

      etc.

      It's possibly harmless if the slave makes sure it always uses the greatest value for a domain (as it probably does anyway), but with time the table might get cluttered, so if it's fixable, I think it's better to fix it

      bzr version-info

      revision-id: knielsen@knielsen-hq.org-20130621095346-9bi73emjowwe396n
      revno: 3663
      branch-nick: 10.0-base

      Test case:

      --source include/master-slave.inc
      --source include/have_innodb.inc
      --source include/have_binlog_format_row.inc
       
      --connection slave
      set sql_log_bin=0;
      --source include/stop_slave.inc
      alter table mysql.gtid_slave_pos engine=InnoDB;
      change master to master_use_gtid=current_pos;
      --source include/start_slave.inc
       
      --connection master
      create table t1 (i int, c varchar(8)) engine=InnoDB;
      insert into t1 values (1,'a'),(2,'b');
       
      --sync_slave_with_master
      --echo # [slave] Table contents after 1st synchronization 
      select * from mysql.gtid_slave_pos;
       
      --connection master
      insert into t1 values (3,'c'),(4,'d');
       
      --sync_slave_with_master
      --echo # [slave] Table contents after 2nd synchronization 
      select * from mysql.gtid_slave_pos;
       
      --enable_reconnect
      --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
      restart
      EOF
       
      --shutdown_server 0
      --source include/wait_until_connected_again.inc
       
      --echo # [slave] Table contents after 1st restart 
      select * from mysql.gtid_slave_pos;
      --source include/start_slave.inc
       
       
      --connection master
       
      insert into t1 values (5,'e'),(6,'f');
       
      --sync_slave_with_master
      --echo # [slave] Table contents after 3nd synchronization 
      select * from mysql.gtid_slave_pos;
       
      --enable_reconnect
      --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
      restart
      EOF
       
      --shutdown_server 0
      --source include/wait_until_connected_again.inc
       
      --echo # [slave] Table contents after 2nd restart
      select * from mysql.gtid_slave_pos;
      --source include/start_slave.inc
       
      --connection master
       
      insert into t1 values (7,'g'),(8,'h');
      drop table t1;
       
      --sync_slave_with_master
      --echo # [slave] Table contents after 4th synchronization 
      select * from mysql.gtid_slave_pos;
       

      Attachments

        Issue Links

          Activity

            People

              knielsen Kristian Nielsen
              elenst Elena Stepanova
              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.