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

Implement system variable to disallow local GTIDs in Galera

    XMLWordPrintable

Details

    Description

      It is possible to use Galera Cluster with replication. For example:

      https://mariadb.com/kb/en/library/documentation/replication/galera-cluster/using-mariadb-replication-with-mariadb-galera-cluster/configuring-mariadb-replication-between-two-mariadb-galera-clusters/

      https://mariadb.com/kb/en/library/documentation/replication/galera-cluster/using-mariadb-replication-with-mariadb-galera-cluster/using-mariadb-gtids-with-mariadb-galera-cluster/

      https://mariadb.com/kb/en/library/documentation/replication/galera-cluster/using-mariadb-replication-with-mariadb-galera-cluster/using-mariadb-replication-with-mariadb-galera-cluster-using-mariadb-replica/

      However, if the slave of the Galera Cluster needs to fail over to a new master node, then that can be complicated by the fact that the different nodes may have different GTID positions due to local transactions.

      Nodes can have GTIDs for local transactions in the following scenarios:

      • A DDL statement is executed with wsrep_OSU_method=RSU set.
      • A DML statement writes to a non-InnoDB table.
      • A DML statement writes to an InnoDB table with wsrep_on=OFF set.

      We may want to come up with a way to disallow any statements that would cause local GTIDs in Galera Cluster.

      For example, we could implement a new system variable called wsrep_disallow_local_gtids. If a user tries to execute a statement that would cause a local GTID, then it could trigger an error. For example:

      SET GLOBAL wsrep_disallow_local_gtids=ON;
      Query OK, 0 rows affected (0.000 sec)
       
      SET SESSION wsrep_OSU_method='RSU';
      Query OK, 0 rows affected (0.000 sec)
       
      ALTER TABLE tab FORCE;
      ERROR X (Y): You can't execute statements that would generate local GTIDs when 
        wsrep_disallow_local_gtids is set. Try disabling binary logging with "SET sql_log_bin=0" 
        to execute this statement.
      

      Or:

      SET GLOBAL wsrep_disallow_local_gtids=ON;
      Query OK, 0 rows affected (0.000 sec)
       
      SET SESSION wsrep_on=OFF;
      Query OK, 0 rows affected (0.000 sec)
       
      INSERT INTO innodb_tab VALUES (1, 'str');
      ERROR X (Y): You can't execute statements that would generate local GTIDs when 
        wsrep_disallow_local_gtids is set. Try disabling binary logging with "SET sql_log_bin=0" 
        to execute this statement.
      

      But users could still work around this by disabling binary logging. For example:

      SET GLOBAL wsrep_disallow_local_gtids=ON;
      Query OK, 0 rows affected (0.000 sec)
       
      SET SESSION wsrep_on=OFF;
      Query OK, 0 rows affected (0.000 sec)
       
      SET SESSION sql_log_bin=0;
      Query OK, 0 rows affected (0.000 sec)
       
      INSERT INTO innodb_tab VALUES (1, 'str');
      Query OK, 1 rows affected (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            People

              jplindst Jan Lindström (Inactive)
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              7 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.