1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
################################################################################
# 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
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--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
|