MINI MINI MANI MO
# ==== Purpose ====
#
# The fix for BUG#24398760 introduced an optimization on the assignment of
# automatic GTIDs. The optimization keeps track of the last GNO assigned (let's
# call it X) to a transaction and put X + 1 as the new free GNO to be assigned.
#
# The above mentioned will be true unless a transaction that owns a GTID with a
# GNO smaller than the new free GNO to be assigned be rolled back. Then, the new
# free GNO to be assigned should be the rolled back one.
#
# This test case creates a table (UUID:1) in a session, and starts a transaction
# in another session specifying UUID:2 as GTID_NEXT. Then, on the first session,
# it creates another transaction (UUID:3) and displays GTID_EXECUTED and
# GTID_OWNED global variables.
#
# Finally, the test case rolls back the UUID:2 transaction, and creates a new
# transaction with automatic GTID generation. It must be assigned with UUID:2.
#
# ==== Related Bugs and Worklogs ====
#
# BUG#24398760 GTIDS REDUCE PERFORMANCE ON WORKLOADS WITH MANY SMALL
# TRANSACTIONS
#
# This test case is binary log format agnostic
--source include/have_binlog_format_row.inc
--source include/have_gtid.inc
RESET MASTER;
--connect (conn1,127.0.0.1,root,,test,$MASTER_MYPORT,)
--let $rpl_connection_name= conn1
--source include/rpl_connection.inc
--let $uuid= `SELECT @@GLOBAL.SERVER_UUID`
--let $session_id= `SELECT CONCAT("#", CONNECTION_ID())`
--replace_result $uuid MASTER_UUID
eval SET @@SESSION.GTID_NEXT = '$uuid:2';
BEGIN;
--let $rpl_connection_name= default
--source include/rpl_connection.inc
CREATE TABLE t1 (a INT); #uuid:1
INSERT INTO t1 VALUES (1); #uuid:3
--replace_result $uuid MASTER_UUID $session_id \#SESSION_ID
SELECT @@GLOBAL.GTID_EXECUTED, @@GLOBAL.GTID_OWNED;
--let $rpl_connection_name= conn1
--source include/rpl_connection.inc
ROLLBACK;
--let $rpl_connection_name= default
--source include/rpl_connection.inc
INSERT INTO t1 VALUES (1); #uuid:2
--replace_result $uuid MASTER_UUID
SELECT @@GLOBAL.GTID_EXECUTED, @@GLOBAL.GTID_OWNED;
# Cleanup
--disconnect conn1
DROP TABLE t1;
OHA YOOOO