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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
################################################################################
#
# This test checks that recompute of GTIDS intervals work even when
# view_change_uuid is configured.
#
# Test:
# 0. This test works with 2 servers in multi primary mode
# 1. Setup Group Replication on server 1 and 2 with view
# change uuid configured with an valid uuid
# 2. Create a table on server 1 that will add one
# transaction to the group
# 3. Insert data into table on server 2 that will add one
# transaction to the group
# 4. Remove and rejoin server 2, that will generate a new
# view and will recompute intervals
# 5. Insert data into table on server 2 that will add one
# transaction to the group
# 6. Transactions are added to the correct intervals and
# views are logged with view uuid
# 7. Stop server 2 and on server 1 set GTID_NEXT to next
# expected view uuid and execute a transaction.
# Start server 2
# 8. Assert the intervals were not used, the new view
# change is correctly logged and the transaction using
# the view uuid is also executed.
# 9. Cleanup
#
################################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
--echo
--echo ############################################################
--echo # 1. Setup Group Replication on server 1 and 2 with view
--echo # change uuid configured with an valid uuid
SET @group_replication_view_change_uuid_save= @@GLOBAL.group_replication_view_change_uuid;
--let $view_change_uuid = aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
--eval SET GLOBAL group_replication_view_change_uuid = "$view_change_uuid"
--source include/start_and_bootstrap_group_replication.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET @group_replication_view_change_uuid_save= @@GLOBAL.group_replication_view_change_uuid;
--eval SET GLOBAL group_replication_view_change_uuid = "$view_change_uuid"
--source include/start_group_replication.inc
--echo
--echo ############################################################
--echo # 2. Create a table on server 1 that will add one
--echo # transaction to 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 # 3. Insert data into table on server 2 that will add one
--echo # transaction to the group
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
INSERT INTO t1 VALUES (0);
--source include/rpl_sync.inc
--echo
--echo ############################################################
--echo # 4. Remove and rejoin server 2, that will generate a new
--echo # view and will recompute intervals
--source include/stop_group_replication.inc
--let $gtid_assignment_block_size= `SELECT @@GLOBAL.group_replication_gtid_assignment_block_size;`
--let $expected_gtid_set= $group_replication_group_name:1:1000001
if ($gtid_assignment_block_size == 1)
{
--let $expected_gtid_set= $group_replication_group_name:1-2
}
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 2 transactions
--let $assert_cond= [SELECT GTID_SUBSET("$expected_gtid_set", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 2 view changes
--let $assert_cond= [SELECT GTID_SUBSET("$view_change_uuid:1-2", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--source include/start_group_replication.inc
--echo
--echo ############################################################
--echo # 5. Insert data into table on server 2 that will add one
--echo # transaction to the group
INSERT INTO t1 VALUES (1);
--source include/rpl_sync.inc
--echo
--echo ############################################################
--echo # 6. Transactions are added to the correct intervals and
--echo # views are logged with view uuid
--let $gtid_assignment_block_size= `SELECT @@GLOBAL.group_replication_gtid_assignment_block_size;`
--let $expected_gtid_set= $group_replication_group_name:1-2:1000001
if ($gtid_assignment_block_size == 1)
{
--let $expected_gtid_set= $group_replication_group_name:1-3
}
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 3 transactions, two on first interval
--let $assert_cond= [SELECT GTID_SUBSET("$expected_gtid_set", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 3 view changes
--let $assert_cond= [SELECT GTID_SUBSET("$view_change_uuid:1-3", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 3 transactions, two on first interval
--let $assert_cond= [SELECT GTID_SUBSET("$expected_gtid_set", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 3 view changes
--let $assert_cond= [SELECT GTID_SUBSET("$view_change_uuid:1-3", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--echo
--echo ############################################################
--echo # 7. Stop server 2 and on server 1 set GTID_NEXT to next
--echo # expected view uuid and execute a transaction.
--echo # Start server 2
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--eval SET GTID_NEXT= '$view_change_uuid:4';
INSERT INTO t1 VALUES (2);
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--echo
--echo ############################################################
--echo # 8. Assert the intervals were not used, the new view
--echo # change is correctly logged and the transaction using
--echo # the view uuid is also executed.
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 3 transactions, two on first interval
--let $assert_cond= [SELECT GTID_SUBSET("$expected_gtid_set", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 4 view changes plus 1 transaction
--let $assert_cond= [SELECT GTID_SUBSET("$view_change_uuid:1-5", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 3 transactions, two on first interval
--let $assert_cond= [SELECT GTID_SUBSET("$expected_gtid_set", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--let $assert_text= GTID_EXECUTED must contain GTID_EXECUTED 4 view changes plus 1 transaction
--let $assert_cond= [SELECT GTID_SUBSET("$view_change_uuid:1-5", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--echo
--echo ############################################################
--echo # 9. Cleanup
SET GTID_NEXT= 'AUTOMATIC';
DROP TABLE t1;
--source include/stop_group_replication.inc
SET @@GLOBAL.group_replication_view_change_uuid= @group_replication_view_change_uuid_save;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
SET @@GLOBAL.group_replication_view_change_uuid= @group_replication_view_change_uuid_save;
--source include/group_replication_end.inc
|