Debian Codegraph @

mysql-test/suite/binlog_gtid/t/binlog_gtid_automatic_using_rolled_back.test

raw
1 # ==== Purpose ====
2 #
3 # The fix for BUG#24398760 introduced an optimization on the assignment of
4 # automatic GTIDs. The optimization keeps track of the last GNO assigned (let's
5 # call it X) to a transaction and put X + 1 as the new free GNO to be assigned.
6 #
7 # The above mentioned will be true unless a transaction that owns a GTID with a
8 # GNO smaller than the new free GNO to be assigned be rolled back. Then, the new
9 # free GNO to be assigned should be the rolled back one.
10 #
11 # This test case creates a table (UUID:1) in a session, and starts a transaction
12 # in another session specifying UUID:2 as GTID_NEXT. Then, on the first session,
13 # it creates another transaction (UUID:3) and displays GTID_EXECUTED and
14 # GTID_OWNED global variables.
15 #
16 # Finally, the test case rolls back the UUID:2 transaction, and creates a new
17 # transaction with automatic GTID generation. It must be assigned with UUID:2.
18 #
19 # ==== Related Bugs and Worklogs ====
20 #
21 # BUG#24398760 GTIDS REDUCE PERFORMANCE ON WORKLOADS WITH MANY SMALL
22 # TRANSACTIONS
23 #
24
25 # This test case is binary log format agnostic
26 --source include/have_binlog_format_row.inc
27
28 RESET MASTER;
29
30 --connect (conn1,127.0.0.1,root,,test,$MASTER_MYPORT,)
31
32 --let $rpl_connection_name= conn1
33 --source include/rpl_connection.inc
34 --let $uuid= `SELECT @@GLOBAL.SERVER_UUID`
35 --let $session_id= `SELECT CONCAT("#", CONNECTION_ID())`
36 --replace_result $uuid MASTER_UUID
37 eval SET @@SESSION.GTID_NEXT = '$uuid:2';
38 BEGIN;
39
40 --let $rpl_connection_name= default
41 --source include/rpl_connection.inc
42 CREATE TABLE t1 (a INT); #uuid:1
43 INSERT INTO t1 VALUES (1); #uuid:3
44
45 --replace_result $uuid MASTER_UUID $session_id \#SESSION_ID
46 SELECT @@GLOBAL.GTID_EXECUTED, @@GLOBAL.GTID_OWNED;
47
48 --let $rpl_connection_name= conn1
49 --source include/rpl_connection.inc
50 ROLLBACK;
51
52 --let $rpl_connection_name= default
53 --source include/rpl_connection.inc
54 INSERT INTO t1 VALUES (1); #uuid:2
55 --replace_result $uuid MASTER_UUID
56 SELECT @@GLOBAL.GTID_EXECUTED, @@GLOBAL.GTID_OWNED;
57
58 # Cleanup
59 --disconnect conn1
60 DROP TABLE t1;