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

Setting gtid_binlog_state with non-local server_id does not update gtid_current_pos

    XMLWordPrintable

Details

    Description

      Currently, gtid_binlog_pos can be manually updated by changing gtid_binlog_state.

      https://mariadb.com/kb/en/library/gtid/#gtid_binlog_state

      Since gtid_current_pos is a union of gtid_binlog_pos and gtid_slave_pos, this also updates gtid_current_pos. For example:

      MariaDB [db1]> SHOW GLOBAL VARIABLES WHERE Variable_name IN( 'log_bin', 'server_id', 'gtid_binlog_pos', 'gtid_binlog_state', 'gtid_slave_pos', 'gtid_current_pos' );
      +-------------------+------------------+
      | Variable_name     | Value            |
      +-------------------+------------------+
      | gtid_binlog_pos   | 1-1-101,2-1-2002 |
      | gtid_binlog_state | 1-1-101,2-1-2002 |
      | gtid_current_pos  | 1-1-101,2-1-2002 |
      | gtid_slave_pos    |                  |
      | log_bin           | ON               |
      | server_id         | 1                |
      +-------------------+------------------+
      6 rows in set (0.001 sec)
       
      MariaDB [db1]> RESET MASTER;
      Query OK, 0 rows affected (0.005 sec)
       
      MariaDB [db1]> SHOW GLOBAL VARIABLES WHERE Variable_name IN( 'log_bin', 'server_id', 'gtid_binlog_pos', 'gtid_binlog_state', 'gtid_slave_pos', 'gtid_current_pos' );
      +-------------------+-------+
      | Variable_name     | Value |
      +-------------------+-------+
      | gtid_binlog_pos   |       |
      | gtid_binlog_state |       |
      | gtid_current_pos  |       |
      | gtid_slave_pos    |       |
      | log_bin           | ON    |
      | server_id         | 1     |
      +-------------------+-------+
      6 rows in set (0.001 sec)
       
      MariaDB [db1]> SET GLOBAL gtid_binlog_state='1-1-101,2-1-2002';
      Query OK, 0 rows affected (0.005 sec)
       
      MariaDB [db1]> SHOW GLOBAL VARIABLES WHERE Variable_name IN( 'log_bin', 'server_id', 'gtid_binlog_pos', 'gtid_binlog_state', 'gtid_slave_pos', 'gtid_current_pos' );
      +-------------------+------------------+
      | Variable_name     | Value            |
      +-------------------+------------------+
      | gtid_binlog_pos   | 1-1-101,2-1-2002 |
      | gtid_binlog_state | 1-1-101,2-1-2002 |
      | gtid_current_pos  | 1-1-101,2-1-2002 |
      | gtid_slave_pos    |                  |
      | log_bin           | ON               |
      | server_id         | 1                |
      +-------------------+------------------+
      6 rows in set (0.001 sec)
      

      However, there seems to be a bug where gtid_current_pos is not updated if gtid_binlog_state is updated with GTIDs that contain non-local server_id values. Compare the above behavior to the following:

      MariaDB [db1]> SHOW GLOBAL VARIABLES WHERE Variable_name IN( 'log_bin', 'server_id', 'gtid_binlog_pos', 'gtid_binlog_state', 'gtid_slave_pos', 'gtid_current_pos' );
      +-------------------+------------------+
      | Variable_name     | Value            |
      +-------------------+------------------+
      | gtid_binlog_pos   | 1-1-101,2-1-2002 |
      | gtid_binlog_state | 1-1-101,2-1-2002 |
      | gtid_current_pos  | 1-1-101,2-1-2002 |
      | gtid_slave_pos    |                  |
      | log_bin           | ON               |
      | server_id         | 1                |
      +-------------------+------------------+
      6 rows in set (0.001 sec)
       
      MariaDB [db1]> RESET MASTER;
      Query OK, 0 rows affected (0.005 sec)
       
      MariaDB [db1]> SHOW GLOBAL VARIABLES WHERE Variable_name IN( 'log_bin', 'server_id', 'gtid_binlog_pos', 'gtid_binlog_state', 'gtid_slave_pos', 'gtid_current_pos' );
      +-------------------+-------+
      | Variable_name     | Value |
      +-------------------+-------+
      | gtid_binlog_pos   |       |
      | gtid_binlog_state |       |
      | gtid_current_pos  |       |
      | gtid_slave_pos    |       |
      | log_bin           | ON    |
      | server_id         | 1     |
      +-------------------+-------+
      6 rows in set (0.001 sec)
       
      MariaDB [db1]> SET GLOBAL gtid_binlog_state='1-2-101,2-2-2002';
      Query OK, 0 rows affected (0.005 sec)
       
      MariaDB [db1]> SHOW GLOBAL VARIABLES WHERE Variable_name IN( 'log_bin', 'server_id', 'gtid_binlog_pos', 'gtid_binlog_state', 'gtid_slave_pos', 'gtid_current_pos' );
      +-------------------+------------------+
      | Variable_name     | Value            |
      +-------------------+------------------+
      | gtid_binlog_pos   | 1-2-101,2-2-2002 |
      | gtid_binlog_state | 1-2-101,2-2-2002 |
      | gtid_current_pos  |                  |
      | gtid_slave_pos    |                  |
      | log_bin           | ON               |
      | server_id         | 1                |
      +-------------------+------------------+
      6 rows in set (0.001 sec)
      

      I think that if an update to gtid_binlog_state causes gtid_binlog_pos to be updated, then gtid_current_pos should also be updated--even if the GTIDs didn't contain the local server_id.

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              8 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.