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

Setting gtid* values from inside a transaction might cause unexpected results

Details

    • Bug
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Fixed
    • None
    • 10.0.4
    • None
    • None

    Description

      Currently it's possible to set gtid_domain_id or gtid_seq_no from inside a transaction.
      If someone is doing such a strange thing, they most likely expect the change to take effect for the remaining part of the transaction; or, short of that, starting from the next transaction. In fact, the change will affect the whole current transaction.
      It might be considered less of a user's strange behavior and more of a real problem if autocommit = 0 is used, and hence the user doesn't really do something stupid explicitly.

      Changing variables that go to the binary log from inside a transaction is not unheard of, e.g. sql_mode can be modified several times, as it is written into the binlog with each statement. However, with gtid* it obviously makes no sense, so I suggest to forbid it at all (e.g. binlog_format cannot be changed inside a transaction).

      Test case:

      --source include/master-slave.inc
      --source include/have_innodb.inc
       
      set autocommit = 0;
      create table t1 (i int) engine=InnoDB;
      create table t2 (i int) engine=InnoDB;
       
      insert into t1 values (1);
      insert into t1 values (2);
      insert into t1 values (3);
       
      set gtid_domain_id=1;
      insert into t2 values (1);
      insert into t2 values (2);
      commit;
       
      show binlog events;

      Output:

      Log_name	Pos	Event_type	Server_id	End_log_pos	Info
      master-bin.000001	4	Format_desc	1	248	Server ver: 10.0.1-MariaDB-gcov-debug-log, Binlog ver: 4
      master-bin.000001	248	Gtid_list	1	273	[]
      master-bin.000001	273	Binlog_checkpoint	1	313	master-bin.000001
      master-bin.000001	313	Gtid	1	351	GTID 0-1-1
      master-bin.000001	351	Query	1	451	use `test`; create table t1 (i int) engine=InnoDB
      master-bin.000001	451	Gtid	1	489	GTID 0-1-2
      master-bin.000001	489	Query	1	589	use `test`; create table t2 (i int) engine=InnoDB
      master-bin.000001	589	Gtid	1	627	BEGIN GTID 1-1-3
      master-bin.000001	627	Query	1	715	use `test`; insert into t1 values (1)
      master-bin.000001	715	Query	1	803	use `test`; insert into t1 values (2)
      master-bin.000001	803	Query	1	891	use `test`; insert into t1 values (3)
      master-bin.000001	891	Query	1	979	use `test`; insert into t2 values (1)
      master-bin.000001	979	Query	1	1067	use `test`; insert into t2 values (2)
      master-bin.000001	1067	Xid	1	1094	COMMIT /* xid=132 */

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            serg Sergei Golubchik made changes -
            Fix Version/s 10.0.4 [ 13101 ]
            Fix Version/s 10.0.3 [ 12900 ]
            knielsen Kristian Nielsen made changes -
            Status Open [ 1 ] In Progress [ 3 ]

            Pushed to 10.0-base

            knielsen Kristian Nielsen added a comment - Pushed to 10.0-base
            knielsen Kristian Nielsen made changes -
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow defaullt [ 27603 ] MariaDB v2 [ 45514 ]
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow MariaDB v2 [ 45514 ] MariaDB v3 [ 62593 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 62593 ] MariaDB v4 [ 146739 ]

            People

              knielsen Kristian Nielsen
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.