| 1 |
################################################################################ |
| 2 |
# Validate that huge GTID_EXECUTED values are properly handled on distributed |
| 3 |
# recovery, transactions certification and certification garbage collection |
| 4 |
# procedure. |
| 5 |
# |
| 6 |
# Test: |
| 7 |
# 0. The test requires two servers: M1 and M2. |
| 8 |
# 1. Generate a huge GTID_EXECUTED with 70043 characters length. It will be |
| 9 |
# like: |
| 10 |
# aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:10000:10002:...:120000 |
| 11 |
# 2. Set huge GTID_EXECUTED on both M1 and M2. |
| 12 |
# 3. Bootstrap start on M2. The huge GTID_EXECUTED will be exchanged on |
| 13 |
# distributed recovery process on M1. |
| 14 |
# 4. Execute some transactions and check that nothing bad happens. Validate |
| 15 |
# that data is delivered to both members. |
| 16 |
# 5. Wait for stable set propagation and certification info garbage collection. |
| 17 |
# 6. Check that stable set is properly updated after stable set propagation and |
| 18 |
# certification info garbage collection. |
| 19 |
# 7. Clean up. |
| 20 |
################################################################################ |
| 21 |
--source include/big_test.inc |
| 22 |
--source include/have_group_replication_plugin.inc |
| 23 |
--let $rpl_skip_group_replication_start= 1 |
| 24 |
--source include/group_replication.inc |
| 25 |
|
| 26 |
|
| 27 |
--echo |
| 28 |
--echo ################################################################ |
| 29 |
--echo # 1. Generate a huge GTID_EXECUTED with 70043 characters length. |
| 30 |
--echo # It will be like: |
| 31 |
--echo # aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:10000:10002:...:120000 |
| 32 |
--let $gno= 100000 |
| 33 |
--let $gno_number= 10000 |
| 34 |
--let $gtid_executed_huge= aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:$gno |
| 35 |
while ($gno_number > 0) |
| 36 |
{ |
| 37 |
--let $gno= `SELECT $gno + 2` |
| 38 |
--let $gtid_executed_huge= $gtid_executed_huge:$gno |
| 39 |
--dec $gno_number |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
--echo |
| 44 |
--echo ################################################################ |
| 45 |
--echo # 2. Set huge GTID_EXECUTED on both servers. |
| 46 |
--let $rpl_connection_name= server2 |
| 47 |
--source include/rpl_connection.inc |
| 48 |
--echo Set GTID_PURGED to huge gtid executed |
| 49 |
--disable_query_log |
| 50 |
--eval SET GLOBAL GTID_PURGED= "$gtid_executed_huge" |
| 51 |
--enable_query_log |
| 52 |
|
| 53 |
--let $assert_text= GTID_EXECUTED must contain all 70043 characters |
| 54 |
--let $assert_cond= [SELECT CHAR_LENGTH(@@GLOBAL.GTID_EXECUTED)] = 70043 |
| 55 |
--source include/assert.inc |
| 56 |
|
| 57 |
|
| 58 |
--let $rpl_connection_name= server1 |
| 59 |
--source include/rpl_connection.inc |
| 60 |
--echo Set GTID_PURGED to huge gtid executed |
| 61 |
--disable_query_log |
| 62 |
--eval SET GLOBAL GTID_PURGED= "$gtid_executed_huge" |
| 63 |
--enable_query_log |
| 64 |
|
| 65 |
--let $assert_text= GTID_EXECUTED must contain all 70043 characters |
| 66 |
--let $assert_cond= [SELECT CHAR_LENGTH(@@GLOBAL.GTID_EXECUTED)] = 70043 |
| 67 |
--source include/assert.inc |
| 68 |
|
| 69 |
|
| 70 |
--echo |
| 71 |
--echo ################################################################ |
| 72 |
--echo # 3. Start Group Replication. |
| 73 |
--echo # The huge GTID_EXECUTED will be exchanged on distributed |
| 74 |
--echo # recovery process on server1. |
| 75 |
--let $rpl_connection_name= server2 |
| 76 |
--source include/rpl_connection.inc |
| 77 |
--source include/start_and_bootstrap_group_replication.inc |
| 78 |
|
| 79 |
--let $rpl_connection_name= server1 |
| 80 |
--source include/rpl_connection.inc |
| 81 |
--source include/start_group_replication.inc |
| 82 |
|
| 83 |
|
| 84 |
--echo |
| 85 |
--echo ################################################################ |
| 86 |
--echo # 4. Execute some transactions and check that nothing bad happens. |
| 87 |
--echo # Validate that data is delivered to both members. |
| 88 |
--let $rpl_connection_name= server2 |
| 89 |
--source include/rpl_connection.inc |
| 90 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 91 |
INSERT INTO t1 VALUES (1); |
| 92 |
--source include/rpl_sync.inc |
| 93 |
|
| 94 |
--let $rpl_connection_name= server2 |
| 95 |
--source include/rpl_connection.inc |
| 96 |
--let $assert_text= 'There is a value 1 in table t1' |
| 97 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1 |
| 98 |
--source include/assert.inc |
| 99 |
|
| 100 |
--let $rpl_connection_name= server1 |
| 101 |
--source include/rpl_connection.inc |
| 102 |
--let $assert_text= 'There is a value 1 in table t1' |
| 103 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1 |
| 104 |
--source include/assert.inc |
| 105 |
|
| 106 |
|
| 107 |
--echo |
| 108 |
--echo ############################################################ |
| 109 |
--echo # 5. Wait for stable set propagation and certification info |
| 110 |
--echo # garbage collection. |
| 111 |
--let $rpl_connection_name= server2 |
| 112 |
--source include/rpl_connection.inc |
| 113 |
--let $_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` |
| 114 |
--let $wait_timeout= 240 |
| 115 |
--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) |
| 116 |
--source include/wait_condition.inc |
| 117 |
|
| 118 |
--let $rpl_connection_name= server1 |
| 119 |
--source include/rpl_connection.inc |
| 120 |
--let $wait_timeout= 240 |
| 121 |
--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) |
| 122 |
--source include/wait_condition.inc |
| 123 |
|
| 124 |
|
| 125 |
--echo |
| 126 |
--echo ############################################################ |
| 127 |
--echo # 6. Check that stable set is properly updated after stable |
| 128 |
--echo # set propagation and certification info garbage |
| 129 |
--echo # collection. |
| 130 |
--let $rpl_connection_name= server2 |
| 131 |
--source include/rpl_connection.inc |
| 132 |
--let $assert_text= 'Transactions_committed_all_members must be equal to GTID_EXECUTED' |
| 133 |
--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)]" |
| 134 |
--source include/assert.inc |
| 135 |
|
| 136 |
--let $rpl_connection_name= server1 |
| 137 |
--source include/rpl_connection.inc |
| 138 |
--let $assert_text= 'Transactions_committed_all_members must be equal to GTID_EXECUTED' |
| 139 |
--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)]" |
| 140 |
--source include/assert.inc |
| 141 |
|
| 142 |
|
| 143 |
--echo |
| 144 |
--echo ############################################################ |
| 145 |
--echo # 7. Clean up. |
| 146 |
DROP TABLE t1; |
| 147 |
|
| 148 |
--source include/group_replication_end.inc |