config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/binlog/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/binlog/t/binlog_group_commit_gtid_order.test

# ==== Purpose ====
#
# This test will evaluate if a set of transactions being applied as
# a group will apply their GTIDs in order, avoiding temporary creation
# of gaps in gtid_executed.
#
# The test pause two inserts in the same commit group, letting the
# second insert (greater GTID number) to finish first.
#
# The test also assert that the gtid_executed::free_intervals_mutex
# is not used as no gap was generated in gtid_executed.
#
# ==== Related Bugs and Worklogs ====
#
# BUG#19982543 SERIOUS TPS DECLINE IF GTID IS ENABLED IN 5.7
#

--source include/have_binlog_format_mixed.inc
--source include/have_binlog_order_commits.test
--source include/have_perfschema.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_gtid.inc

RESET MASTER;
--let $master_uuid=`SELECT @@GLOBAL.server_uuid`

# Group commit parameters
--let $delay=1000000
--let $bgcd_saved=`SELECT @@GLOBAL.binlog_group_commit_sync_delay`

# Create two tables, one for each connection
CREATE TABLE t1 (c1 INT) Engine=InnoDB;
CREATE TABLE t2 (c1 INT) Engine=InnoDB;

# Get the current counter for gtid_executed::free_intervals_mutex
SET @free_intervals_mutex_before= (
  SELECT COUNT_STAR
  FROM performance_schema.events_waits_summary_global_by_event_name WHERE
  EVENT_NAME='wait/synch/mutex/sql/Gtid_set::gtid_executed::free_intervals_mutex');

# Set group commit parameters
--eval SET GLOBAL binlog_group_commit_sync_delay=$delay

--echo # Create two new connections: con1 and con2
--connect (con1, localhost, root,,)
--connect (con2, localhost, root,,)

--echo # At con1
--connection con1
SET DEBUG_SYNC='reached_finish_commit SIGNAL go_con2 WAIT_FOR go_con1';

# The following INSERT will be the group commit leader.
# Once reaching the 'reached_finish_commit' debug sync point, it will
# allow con2 to proceed with other INSERT to be part of the commit group
# and will wait for a signal to continue with its own finish_commit.
--send INSERT INTO t1 VALUES (1)
# The above INSERT will be MASTER_UUID:3

--echo # At con2
--connection con2
# The following session debug point will tell con2 that it has done with its
# finish_commit.
--let $debug_point= leaving_finish_commit
--let $debug_type= SESSION
--source include/add_debug_point.inc

# Wait for the INSERT at con1 to be the group leader.
SET DEBUG_SYNC='now WAIT_FOR go_con2';

# The following INSERT is not the group commit leader.
INSERT INTO t2 VALUES (2);
# The above INSERT will be MASTER_UUID:4

# In a non-fixed server, the GTIDs of transactions committed in group were
# added to gtid_executed at finish_commit by each thread.
# So, we wait for the current connection to finish its commit before letting
# the commit group leader go.
SET DEBUG_SYNC='now WAIT_FOR signal_leaving_finish_commit';

# We collect the gtid_executed now. A non-fixed server would have the GTID
# of the con2 INSERT but wouldn't have the GTID of the con1 INSERT.
# A fixed server will have both GTIDs in the gtid_executed, as the GTIDs of
# a commit group are now added to the gtid_executed set while processing the
# commit group queue (in order), and not at finish_commit.
--let $gtid_executed_after_second_insert=`SELECT @@GLOBAL.gtid_executed`

# Let the commit group leader to finish its commit now.
SET DEBUG_SYNC='now SIGNAL go_con1';
--source include/remove_debug_point.inc

--echo # At default connection
--connection default
# Ensure that the GTID of the commit group leader is at gtid_executed
# before continuing.
--let $wait_succeeded= `SELECT WAIT_FOR_EXECUTED_GTID_SET('$master_uuid:3')`

# Assert that the WAIT_FOR_EXECUTED_GTID_SET above didn't timed out.
--let $assert_text= "The first insert has finished"
--let $assert_cond= "$wait_succeeded" = 0
--source include/assert.inc

# Assert that no gaps were found after the second insert finished.
--let $current_gtid_executed=`SELECT @@GLOBAL.gtid_executed`
--let $assert_text= "No gaps should exist in gtid_executed after the second insert"
--let $assert_cond= "$gtid_executed_after_second_insert" = "$current_gtid_executed"
--source include/assert.inc

# Assert that free_intervals_mutex wasn't used (no gaps were produced).
SET @free_intervals_mutex_after= (
  SELECT COUNT_STAR
  FROM performance_schema.events_waits_summary_global_by_event_name WHERE
  EVENT_NAME='wait/synch/mutex/sql/Gtid_set::gtid_executed::free_intervals_mutex');
--let $assert_text= "gtid_executed::free_intervals_mutex wasn't used"
--let $assert_cond= @free_intervals_mutex_before = @free_intervals_mutex_after
--source include/assert.inc

# Cleanup
--disconnect con1
--disconnect con2

--connection default
--eval SET GLOBAL binlog_group_commit_sync_delay=$bgcd_saved

DROP TABLE t1, t2;
RESET MASTER;

Man Man