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

Implement system variable to disallow local GTIDs in Galera

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

            GeoffMontee Geoff Montee (Inactive) created issue -
            GeoffMontee Geoff Montee (Inactive) made changes -
            Field Original Value New Value
            GeoffMontee Geoff Montee (Inactive) made changes -
            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:

            {code}
            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.
            {code}

            Or:

            {code}
            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.
            {code}

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

            {code}
            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)
            {code}
            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:

            {code}
            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.
            {code}

            Or:

            {code}
            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.
            {code}

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

            {code}
            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)
            {code}
            GeoffMontee Geoff Montee (Inactive) made changes -
            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:

            {code}
            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.
            {code}

            Or:

            {code}
            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.
            {code}

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

            {code}
            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)
            {code}
            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:

            {code}
            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.
            {code}

            Or:

            {code}
            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.
            {code}

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

            {code}
            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)
            {code}
            GeoffMontee Geoff Montee (Inactive) made changes -
            GeoffMontee Geoff Montee (Inactive) made changes -
            julien.fritsch Julien Fritsch made changes -
            Richard Richard Stracke made changes -
            jplindst Jan Lindström (Inactive) made changes -
            Fix Version/s 10.6 [ 24028 ]
            jplindst Jan Lindström (Inactive) made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jplindst Jan Lindström (Inactive) added a comment - https://github.com/MariaDB/server/commit/ebb2db5912ebb9b4e3ef230f15ae65529ff30be4
            jplindst Jan Lindström (Inactive) made changes -
            Assignee Jan Lindström [ jplindst ] Julius Goryavsky [ sysprg ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            sysprg Julius Goryavsky made changes -
            Status In Review [ 10002 ] Stalled [ 10000 ]
            sysprg Julius Goryavsky made changes -
            Assignee Julius Goryavsky [ sysprg ] Jan Lindström [ jplindst ]
            jplindst Jan Lindström (Inactive) made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            jplindst Jan Lindström (Inactive) made changes -
            issue.field.resolutiondate 2021-03-02 06:14:34.0 2021-03-02 06:14:34.124
            jplindst Jan Lindström (Inactive) made changes -
            Fix Version/s 10.6.0 [ 24431 ]
            Fix Version/s 10.6 [ 24028 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]

            Added a new wsrep_mode feature DISALLOW_LOCAL_GTID for this. 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.

            If user has set wsrep_mode=DISALLOW_LOCAL_GTID these operations produce a error ERROR HY000: Galera replication not supported.

            jplindst Jan Lindström (Inactive) added a comment - Added a new wsrep_mode feature DISALLOW_LOCAL_GTID for this. 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. If user has set wsrep_mode=DISALLOW_LOCAL_GTID these operations produce a error ERROR HY000: Galera replication not supported.
            jplindst Jan Lindström (Inactive) made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 100102 ] MariaDB v4 [ 134103 ]
            mariadb-jira-automation Jira Automation (IT) made changes -
            Zendesk Related Tickets 184649

            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.