| 1 |
################################################################################ |
| 2 |
# WL#6833: GCS Replication: Read-set free Certification |
| 3 |
# Module (DBSM Snapshot Isolation) |
| 4 |
# |
| 5 |
# Scenario 1: Set GTID_NEXT on a client session |
| 6 |
# |
| 7 |
# Verify Group Replication behaviour when a GTID_NEXT is |
| 8 |
# specified on a transaction. |
| 9 |
# |
| 10 |
# Test: |
| 11 |
# 0. The test requires two servers: M1 and M2. |
| 12 |
# 1. With both members ONLINE. Execute some transactions on M1 with and without |
| 13 |
# GTID_NEXT specified. |
| 14 |
# 2. Execute some transactions on M2 with and without GTID_NEXT specified. |
| 15 |
# 3. Check that GTID_EXECUTED on M1 contains all transactions. Also check that |
| 16 |
# data is on tables. |
| 17 |
# 4. Check that GTID_EXECUTED on M2 contains all transactions. Also check that |
| 18 |
# data is on tables. |
| 19 |
# 5. Wait for stable set propagation and certification info garbage collection. |
| 20 |
# 6. Check that stable set and certification info size are properly updated |
| 21 |
# after stable set propagation and certification info garbage collection on |
| 22 |
# M1. |
| 23 |
# 7. Check that stable set and certification info size are properly updated |
| 24 |
# after stable set propagation and certification info garbage collection on |
| 25 |
# M2. |
| 26 |
# 8. Clean up. |
| 27 |
################################################################################ |
| 28 |
|
| 29 |
--source include/big_test.inc |
| 30 |
--source include/have_group_replication_gtid_assignment_block_size_1.inc |
| 31 |
--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429489 |
| 32 |
--source include/have_group_replication_plugin.inc |
| 33 |
--source include/group_replication.inc |
| 34 |
|
| 35 |
# Keep binary logs with only GTIDs from test. |
| 36 |
--connection server1 |
| 37 |
SET SESSION sql_log_bin= 0; |
| 38 |
--source include/gtid_utils.inc |
| 39 |
SET SESSION sql_log_bin= 1; |
| 40 |
--connection server2 |
| 41 |
SET SESSION sql_log_bin= 0; |
| 42 |
--source include/gtid_utils.inc |
| 43 |
SET SESSION sql_log_bin= 1; |
| 44 |
|
| 45 |
--let $expected_gtid_set= "8a94f357-aab4-11df-86ab-c80aa9429489:1-6,aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1-2,bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb:1-3" |
| 46 |
|
| 47 |
|
| 48 |
--echo |
| 49 |
--echo ############################################################ |
| 50 |
--echo # 1. Execute some transactions on server 1 with and without |
| 51 |
--echo # GTID specified. |
| 52 |
--connection server1 |
| 53 |
--eval SET GTID_NEXT= '$uuida:1' |
| 54 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 55 |
SET GTID_NEXT= 'AUTOMATIC'; |
| 56 |
|
| 57 |
INSERT INTO t1 VALUES (1); |
| 58 |
|
| 59 |
|
| 60 |
--echo |
| 61 |
--echo ############################################################ |
| 62 |
--echo # 2. Execute some transactions on server 2 with and without |
| 63 |
--echo # GTID specified (including empty transactions). |
| 64 |
--connection server2 |
| 65 |
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 66 |
|
| 67 |
--source include/rpl_sync.inc |
| 68 |
--eval SET GTID_NEXT= '$uuida:2' |
| 69 |
INSERT INTO t1 VALUES (2); |
| 70 |
SET GTID_NEXT= 'AUTOMATIC'; |
| 71 |
|
| 72 |
--eval SET GTID_NEXT= '$uuidb:1' |
| 73 |
INSERT INTO t2 VALUES (1); |
| 74 |
SET GTID_NEXT= 'AUTOMATIC'; |
| 75 |
|
| 76 |
--eval SET GTID_NEXT= '$uuidb:2' |
| 77 |
INSERT INTO t2 VALUES (2); |
| 78 |
SET GTID_NEXT= 'AUTOMATIC'; |
| 79 |
|
| 80 |
--eval SET GTID_NEXT= '$uuidb:3' |
| 81 |
BEGIN; |
| 82 |
COMMIT; |
| 83 |
SET GTID_NEXT= 'AUTOMATIC'; |
| 84 |
|
| 85 |
INSERT INTO t1 VALUES (3); |
| 86 |
INSERT INTO t2 VALUES (3); |
| 87 |
|
| 88 |
--source include/rpl_sync.inc |
| 89 |
|
| 90 |
|
| 91 |
--echo |
| 92 |
--echo ############################################################ |
| 93 |
--echo # 3. Check that GTID_EXECUTED on server 1 contains all |
| 94 |
--echo # transactions. |
| 95 |
--echo # Also check that data is on tables. |
| 96 |
--connection server1 |
| 97 |
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs |
| 98 |
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, $expected_gtid_set) |
| 99 |
--source include/assert.inc |
| 100 |
|
| 101 |
--let $assert_text= 'There is a value 1 in table t1' |
| 102 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1 |
| 103 |
--source include/assert.inc |
| 104 |
--let $assert_text= 'There is a value 2 in table t1' |
| 105 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 1 |
| 106 |
--source include/assert.inc |
| 107 |
--let $assert_text= 'There is a value 3 in table t1' |
| 108 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 3, count, 1] = 1 |
| 109 |
--source include/assert.inc |
| 110 |
|
| 111 |
--let $assert_text= 'There is a value 1 in table t2' |
| 112 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 1, count, 1] = 1 |
| 113 |
--source include/assert.inc |
| 114 |
--let $assert_text= 'There is a value 2 in table t2' |
| 115 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 2, count, 1] = 1 |
| 116 |
--source include/assert.inc |
| 117 |
--let $assert_text= 'There is a value 3 in table t2' |
| 118 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 3, count, 1] = 1 |
| 119 |
--source include/assert.inc |
| 120 |
|
| 121 |
|
| 122 |
--echo |
| 123 |
--echo ############################################################ |
| 124 |
--echo # 4. Check that GTID_EXECUTED on server 2 contains all |
| 125 |
--echo # transactions. |
| 126 |
--echo # Also check that data is on tables. |
| 127 |
--connection server2 |
| 128 |
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs |
| 129 |
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, $expected_gtid_set) |
| 130 |
--source include/assert.inc |
| 131 |
|
| 132 |
--let $assert_text= 'There is a value 1 in table t1' |
| 133 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1 |
| 134 |
--source include/assert.inc |
| 135 |
--let $assert_text= 'There is a value 2 in table t1' |
| 136 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 1 |
| 137 |
--source include/assert.inc |
| 138 |
--let $assert_text= 'There is a value 3 in table t1' |
| 139 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 3, count, 1] = 1 |
| 140 |
--source include/assert.inc |
| 141 |
|
| 142 |
--let $assert_text= 'There is a value 1 in table t2' |
| 143 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 1, count, 1] = 1 |
| 144 |
--source include/assert.inc |
| 145 |
--let $assert_text= 'There is a value 2 in table t2' |
| 146 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 2, count, 1] = 1 |
| 147 |
--source include/assert.inc |
| 148 |
--let $assert_text= 'There is a value 3 in table t2' |
| 149 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 3, count, 1] = 1 |
| 150 |
--source include/assert.inc |
| 151 |
|
| 152 |
|
| 153 |
--echo |
| 154 |
--echo ############################################################ |
| 155 |
--echo # 5. Wait for stable set propagation and certification info |
| 156 |
--echo # garbage collection. |
| 157 |
--connection server1 |
| 158 |
--let $wait_timeout= 65 |
| 159 |
--let $wait_condition= SELECT Transactions_committed_all_members<>"" FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid) |
| 160 |
--source include/wait_condition.inc |
| 161 |
|
| 162 |
|
| 163 |
--echo |
| 164 |
--echo ############################################################ |
| 165 |
--echo # 6. Check that stable set and certification info size are |
| 166 |
--echo # properly updated after stable set propagation and |
| 167 |
--echo # certification info garbage collection on server 1. |
| 168 |
--connection server1 |
| 169 |
|
| 170 |
--let $count_transactions_validating= query_get_value(SELECT Count_transactions_rows_validating from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Count_transactions_rows_validating, 1) |
| 171 |
--let $assert_text= 'Count_transactions_rows_validating must be 1' |
| 172 |
--let $assert_cond= $count_transactions_validating = 1 |
| 173 |
--source include/assert.inc |
| 174 |
|
| 175 |
--let $transactions_committed_all_members= query_get_value(SELECT Transactions_committed_all_members from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Transactions_committed_all_members, 1) |
| 176 |
--let $assert_text= 'Transactions_committed_all_members must be equal to GTID_EXECUTED' |
| 177 |
--let $assert_cond= GTID_IS_EQUAL("$transactions_committed_all_members", $expected_gtid_set) |
| 178 |
--source include/assert.inc |
| 179 |
|
| 180 |
|
| 181 |
--echo |
| 182 |
--echo ############################################################ |
| 183 |
--echo # 7. Check that stable set and certification info size are |
| 184 |
--echo # properly updated after stable set propagation and |
| 185 |
--echo # certification info garbage collection on server 2. |
| 186 |
--connection server2 |
| 187 |
|
| 188 |
--let $count_transactions_validating= query_get_value(SELECT Count_transactions_rows_validating from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Count_transactions_rows_validating, 1) |
| 189 |
--let $assert_text= 'Count_transactions_rows_validating must be 1' |
| 190 |
--let $assert_cond= $count_transactions_validating = 1 |
| 191 |
--source include/assert.inc |
| 192 |
|
| 193 |
--let $transactions_committed_all_members= query_get_value(SELECT Transactions_committed_all_members from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Transactions_committed_all_members, 1) |
| 194 |
--let $assert_text= 'Transactions_committed_all_members must be equal to GTID_EXECUTED' |
| 195 |
--let $assert_cond= GTID_IS_EQUAL("$transactions_committed_all_members", $expected_gtid_set) |
| 196 |
--source include/assert.inc |
| 197 |
|
| 198 |
|
| 199 |
--echo |
| 200 |
--echo ############################################################ |
| 201 |
--echo # 8. Shutdown. |
| 202 |
DROP TABLE t1; |
| 203 |
DROP TABLE t2; |
| 204 |
|
| 205 |
--connection server1 |
| 206 |
SET SESSION sql_log_bin= 0; |
| 207 |
--source include/gtid_utils_end.inc |
| 208 |
SET SESSION sql_log_bin= 1; |
| 209 |
--connection server2 |
| 210 |
SET SESSION sql_log_bin= 0; |
| 211 |
--source include/gtid_utils_end.inc |
| 212 |
SET SESSION sql_log_bin= 1; |
| 213 |
|
| 214 |
--source include/group_replication_end.inc |