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

log_slave_updates is required for wsrep_gtid_mode

    XMLWordPrintable

    Details

      Description

      When wsrep_gtid_mode is ON, transactions replicated via Galera Cluster's replication should increment the GTID in the domain given by wsrep_gtid_domain_id on all nodes. This only seems to happen on all nodes if log_slave_updates is enabled.

      For example, let's say that we have a 2-node Galera Cluster:

      Node 1:

      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'wsrep_gtid%';
      +----------------------+-------+
      | Variable_name        | Value |
      +----------------------+-------+
      | wsrep_gtid_domain_id | 3     |
      | wsrep_gtid_mode      | ON    |
      +----------------------+-------+
      2 rows in set (0.00 sec)
       
      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'log_slave_updates';
      +-------------------+-------+
      | Variable_name     | Value |
      +-------------------+-------+
      | log_slave_updates | OFF   |
      +-------------------+-------+
      1 row in set (0.00 sec)
       
      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'gtid%pos';
      +------------------+-----------------------+
      | Variable_name    | Value                 |
      +------------------+-----------------------+
      | gtid_binlog_pos  | 0-1-5,1-1-63334,3-1-9 |
      | gtid_current_pos | 0-1-5,1-1-63334,3-1-9 |
      | gtid_slave_pos   |                       |
      +------------------+-----------------------+
      3 rows in set (0.00 sec)
      

      Node 2:

      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'wsrep_gtid%';
      +----------------------+-------+
      | Variable_name        | Value |
      +----------------------+-------+
      | wsrep_gtid_domain_id | 3     |
      | wsrep_gtid_mode      | ON    |
      +----------------------+-------+
      2 rows in set (0.01 sec)
       
      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'log_slave_updates';
      +-------------------+-------+
      | Variable_name     | Value |
      +-------------------+-------+
      | log_slave_updates | OFF   |
      +-------------------+-------+
      1 row in set (0.00 sec)
       
      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'gtid%pos';
      +------------------+-----------------------+
      | Variable_name    | Value                 |
      +------------------+-----------------------+
      | gtid_binlog_pos  | 0-1-5,1-1-63334,3-1-9 |
      | gtid_current_pos |                       |
      | gtid_slave_pos   |                       |
      +------------------+-----------------------+
      3 rows in set (0.00 sec)
      

      Now let's see how gtid_binlog_pos changes on each node.

      Node 1:

      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'gtid%pos';
      +------------------+------------------------+
      | Variable_name    | Value                  |
      +------------------+------------------------+
      | gtid_binlog_pos  | 0-1-5,1-1-63334,3-1-10 |
      | gtid_current_pos | 0-1-5,1-1-63334,3-1-10 |
      | gtid_slave_pos   |                        |
      +------------------+------------------------+
      3 rows in set (0.00 sec)
      

      Node 2:

      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'gtid%pos';
      +------------------+-----------------------+
      | Variable_name    | Value                 |
      +------------------+-----------------------+
      | gtid_binlog_pos  | 0-1-5,1-1-63334,3-1-9 |
      | gtid_current_pos |                       |
      | gtid_slave_pos   |                       |
      +------------------+-----------------------+
      3 rows in set (0.00 sec)
       
      MariaDB [(none)]> select * from db1.tab1;
      +----+------+
      | id | str  |
      +----+------+
      |  1 | str1 |
      |  2 | str2 |
      +----+------+
      2 rows in set (0.00 sec)
      

      Let's try again with log_slave_updates enabled.

      Node 1:

      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'wsrep_gtid%';
      +----------------------+-------+
      | Variable_name        | Value |
      +----------------------+-------+
      | wsrep_gtid_domain_id | 3     |
      | wsrep_gtid_mode      | ON    |
      +----------------------+-------+
      2 rows in set (0.00 sec)
       
      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'log_slave_updates';
      +-------------------+-------+
      | Variable_name     | Value |
      +-------------------+-------+
      | log_slave_updates | ON    |
      +-------------------+-------+
      1 row in set (0.00 sec)
       
      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'gtid%pos';
      +------------------+------------------------+
      | Variable_name    | Value                  |
      +------------------+------------------------+
      | gtid_binlog_pos  | 0-1-5,1-1-63334,3-1-10 |
      | gtid_current_pos | 0-1-5,1-1-63334,3-1-10 |
      | gtid_slave_pos   |                        |
      +------------------+------------------------+
      3 rows in set (0.00 sec)
       
      MariaDB [(none)]> insert into db1.tab1 values (3, 'str3');
      Query OK, 1 row affected (0.01 sec)
       
      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'gtid%pos';
      +------------------+------------------------+
      | Variable_name    | Value                  |
      +------------------+------------------------+
      | gtid_binlog_pos  | 0-1-5,1-1-63334,3-1-11 |
      | gtid_current_pos | 0-1-5,1-1-63334,3-1-11 |
      | gtid_slave_pos   |                        |
      +------------------+------------------------+
      3 rows in set (0.00 sec)
      

      Node 2:

      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'gtid%pos';
      +------------------+------------------------+
      | Variable_name    | Value                  |
      +------------------+------------------------+
      | gtid_binlog_pos  | 0-1-5,1-1-63334,3-1-11 |
      | gtid_current_pos |                        |
      | gtid_slave_pos   |                        |
      +------------------+------------------------+
      3 rows in set (0.00 sec)
       
      MariaDB [(none)]> select * from db1.tab1;
      +----+------+
      | id | str  |
      +----+------+
      |  1 | str1 |
      |  2 | str2 |
      |  3 | str3 |
      +----+------+
      3 rows in set (0.00 sec)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jplindst Jan Lindström
              Reporter:
              GeoffMontee Geoff Montee
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration