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

With --init-rpl-role=SLAVE, Status Variable `Rpl_status` is always updated by the first connection to change state

    XMLWordPrintable

Details

    • Unexpected results

    Description

      To Reproduce

      .opt

      --init-rpl-role=SLAVE
      

      --source include/have_log_bin.inc
       
      --connect (master1, 127.0.0.1, root, , , $SERVER_MYPORT_1)
      --connect (master2, 127.0.0.1, root, , , $SERVER_MYPORT_2)
      --connect (  slave, 127.0.0.1, root, , , $SERVER_MYPORT_3)
       
       
      --replace_result $SERVER_MYPORT_1 MYPORT_1
      evalp CHANGE MASTER 'master1' TO
        master_host='127.0.0.1', master_port=$SERVER_MYPORT_1,
        master_user='root';
      evalp CHANGE MASTER 'master2' TO
        master_host='127.0.0.1', master_port=$SERVER_MYPORT_2,
        master_user='root';
       
      SELECT variable_value
        FROM information_schema.global_status
        WHERE variable_name='RPL_STATUS';
      #=> IDLE_SLAVE
       
       
      SET @@SESSION.default_master_connection = 'master1';
      --source include/start_slave.inc
      SELECT variable_value
        FROM information_schema.global_status
        WHERE variable_name='RPL_STATUS';
      #=> ACTIVE_SLAVE
       
      SET @@SESSION.default_master_connection = 'master2';
      --source include/start_slave.inc
      SELECT variable_value
        FROM information_schema.global_status
        WHERE variable_name='RPL_STATUS';
      #=> ACTIVE_SLAVE
       
       
      --source include/stop_slave.inc
      SELECT variable_value
        FROM information_schema.global_status
        WHERE variable_name='RPL_STATUS';
      SET @@SESSION.default_master_connection = 'master1';
      #=> IDLE_SLAVE
       
      --source include/stop_slave.inc
      SELECT variable_value
        FROM information_schema.global_status
        WHERE variable_name='RPL_STATUS';
      #=> IDLE_SLAVE
       
       
      # Cleanup
      --source include/reset_master_slave.inc
       
      --disconnect master1
      --disconnect master2
      --disconnect slave
      

      Solution suggestions

      • Restrict the updates to Rpl_status, change_rpl_status() to the blank-name connection only.
        This requires the fewest changes, but loses multi-source replication support for Rpl_status.
      • Move the code behind Rpl_status, rpl_status, to per-connection data (similar to what the code comment suggests) and have the status variable redirect according to @@default_master_connection:

        TODO: make rpl_status part of Master_info

        This matches how system variables were migrated to multi-source replication, but requires some work.

      • Keep Rpl_status a global view of all connections, after defining which states are "any" and which require "all".
        This concept first needs discussion.
      • Deprecate Rpl_status altogether in favour of SHOW SLAVE STATUS (or information_schema.slave_status as of 11.6 (MDEV-33526)).
        MySQL has already removed this in version 5.6.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ParadoxV5 Jimmy Hú
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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