403Webshell
Server IP : 172.67.216.182  /  Your IP : 172.70.142.117
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/mysql-test/suite/binlog/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/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;

Youez - 2016 - github.com/yon3zu
LinuXploit