config root man

Current Path : /usr/opt/mysql57/mysql-test/suite/group_replication/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 : //usr/opt/mysql57/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

Man Man