Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 10.0.4
-
Component/s: None
-
Labels: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 */
Gliffy Diagrams
Attachments
Issue Links
- relates to
-
MDEV-26 Global transaction ID
-
- Closed
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Pushed to 10.0-base