MINI MINI MANI MO

Path : /opt/mysql/mysql-test/suite/group_replication/t/
File Upload :
Current File : //opt/mysql/mysql-test/suite/group_replication/t/gr_last_conflict_free_transaction.test

################################################################################
# Validate that column last_conflict_free_transaction from
# performance_schema.replication_group_member_stats table
# always show the last conflict free transaction.
#
# Steps:
#   0. The test requires two servers: M1 and M2.
#   1. With both members ONLINE. Assert that last_conflict_free_transaction is
#      correct when last transaction GTID was generated on M1 and M2.
#   2. Assert that last_conflict_free_transaction is correct
#      when last transaction GTID was specified on M1 and M2.
#   3. Clean up.
################################################################################

--source ../inc/have_group_replication_plugin.inc
--source ../inc/group_replication.inc


--echo
--echo ############################################################
--echo # 1. Assert that last_conflict_free_transaction is correct
--echo #    when last transaction GTID was generated.
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
--source include/rpl_sync.inc

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= On server1, the value of last_conflict_free_transaction must be the last positively certified transaction (group generated)
# Transaction GNO is 3 since 1 and 2 were used on view change log events for server 1 and 2 join.
--let $assert_cond= "[SELECT last_conflict_free_transaction FROM performance_schema.replication_group_member_stats]" = "$group_replication_group_name:3"
--source include/assert.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= On server2, the value of last_conflict_free_transaction must be the last positively certified transaction (group generated)
--let $assert_cond= "[SELECT last_conflict_free_transaction FROM performance_schema.replication_group_member_stats]" = "$group_replication_group_name:3"
--source include/assert.inc


--echo
--echo ############################################################
--echo # 2. Assert that last_conflict_free_transaction is correct
--echo #    when last transaction GTID was specified.
SET GTID_NEXT= "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1";
INSERT INTO t1 VALUES (1);
SET GTID_NEXT= AUTOMATIC;
--source include/rpl_sync.inc

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= On server1, the value of last_conflict_free_transaction must be the last positively certified transaction (specified GTID)
--let $assert_cond= "[SELECT last_conflict_free_transaction FROM performance_schema.replication_group_member_stats]" = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1"
--source include/assert.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= On server2, the value of last_conflict_free_transaction must be the last positively certified transaction (specified GTID)
--let $assert_cond= "[SELECT last_conflict_free_transaction FROM performance_schema.replication_group_member_stats]" = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1"
--source include/assert.inc


--echo
--echo ############################################################
--echo # 3. Clean up.
DROP TABLE t1;

--source ../inc/group_replication_end.inc

OHA YOOOO