polardbxengine/mysql-test/suite/group_replication/t/gr_huge_gtid_executed.test

143 lines
5.5 KiB
Plaintext

################################################################################
# Validate that huge GTID_EXECUTED values are properly handled on distributed
# recovery, transactions certification and certification garbage collection
# procedure.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. Generate a huge GTID_EXECUTED with 70043 characters length. It will be
# like:
# aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:10000:10002:...:120000
# 2. Set huge GTID_EXECUTED on both M1 and M2.
# 3. Bootstrap start on M2. The huge GTID_EXECUTED will be exchanged on
# distributed recovery process on M1.
# 4. Execute some transactions and check that nothing bad happens. Validate
# that data is delivered to both members.
# 5. Wait for stable set propagation and certification info garbage collection.
# 6. Check that stable set is properly updated after stable set propagation and
# certification info garbage collection.
# 7. Clean up.
################################################################################
--source include/big_test.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
--echo
--echo ################################################################
--echo # 1. Generate a huge GTID_EXECUTED with 70043 characters length.
--echo # It will be like:
--echo # aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:10000:10002:...:120000
--let $gno= 100000
--let $gno_number= 10000
--let $gtid_executed_huge= aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:$gno
while ($gno_number > 0)
{
--let $gno= `SELECT $gno + 2`
--let $gtid_executed_huge= $gtid_executed_huge:$gno
--dec $gno_number
}
--echo
--echo ################################################################
--echo # 2. Set huge GTID_EXECUTED on both servers.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--echo Set GTID_PURGED to huge gtid executed
--disable_query_log
--eval SET GLOBAL GTID_PURGED= "$gtid_executed_huge"
--enable_query_log
--let $assert_text= GTID_EXECUTED must contain all 70043 characters
--let $assert_cond= [SELECT CHAR_LENGTH(@@GLOBAL.GTID_EXECUTED)] = 70043
--source include/assert.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--echo Set GTID_PURGED to huge gtid executed
--disable_query_log
--eval SET GLOBAL GTID_PURGED= "$gtid_executed_huge"
--enable_query_log
--let $assert_text= GTID_EXECUTED must contain all 70043 characters
--let $assert_cond= [SELECT CHAR_LENGTH(@@GLOBAL.GTID_EXECUTED)] = 70043
--source include/assert.inc
--echo
--echo ################################################################
--echo # 3. Start Group Replication.
--echo # The huge GTID_EXECUTED will be exchanged on distributed
--echo # recovery process on server1.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--echo
--echo ################################################################
--echo # 4. Execute some transactions and check that nothing bad happens.
--echo # Validate that data is delivered to both members.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--source include/rpl_sync.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.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 $rpl_connection_name= server1
--source include/rpl_connection.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 # 5. Wait for stable set propagation and certification info
--echo # garbage collection.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED`
--let $wait_timeout= 240
--let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_group_member_stats WHERE Transactions_committed_all_members = "$_gtid_executed" and member_id in (SELECT @@server_uuid)
--source include/wait_condition.inc
--echo
--echo ############################################################
--echo # 6. Check that stable set is properly updated after stable
--echo # set propagation and certification info garbage
--echo # collection.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= 'Transactions_committed_all_members must be equal to GTID_EXECUTED'
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "[SELECT Transactions_committed_all_members from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid)]"
--source include/assert.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= 'Transactions_committed_all_members must be equal to GTID_EXECUTED'
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "[SELECT Transactions_committed_all_members from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid)]"
--source include/assert.inc
--echo
--echo ############################################################
--echo # 7. Clean up.
DROP TABLE t1;
--source include/group_replication_end.inc