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
|
## 0. Start 3 servers with GR
include/group_replication.inc [rpl_server_count=3]
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
[connection server1]
[connection server2]
set session sql_log_bin=0;
call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
call mtr.add_suppression("Error on session .*. Transaction of size .* exceeds specified limit 9. To increase the limit please adjust group_replication_transaction_size_limit option.");
call mtr.add_suppression("Error on session .*. Transaction of size .* exceeds specified limit 808. To increase the limit please adjust group_replication_transaction_size_limit option.");
set session sql_log_bin=1;
[connection server3]
set session sql_log_bin=0;
call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
call mtr.add_suppression("Error on session .*. Transaction of size .* exceeds specified limit 1024. To increase the limit please adjust group_replication_transaction_size_limit option.");
set session sql_log_bin=1;
include/rpl_gr_wait_for_number_of_members.inc
## 1. Connect to server 1, create a table (t1)
## Table t1 will be used later in step 3
[connection server1]
CREATE TABLE t1 (a INT PRIMARY KEY);
include/rpl_sync.inc
## 2.1 Create table t2 on server 1 and t3 on server 2.
[connection server1]
CREATE TABLE t2 (a INT PRIMARY KEY);
include/rpl_sync.inc
[connection server2]
CREATE TABLE t3 (a INT PRIMARY KEY);
include/rpl_sync.inc
## 2.2 Validate tables t2 and t3 are created on each server.
[connection server1]
include/assert.inc ['Check table t2 exist on server 1']
include/assert.inc ['Check table t3 exist on server 1']
[connection server2]
include/assert.inc ['Check table t2 exist on server 2']
include/assert.inc ['Check table t3 exist on server 2']
[connection server3]
include/assert.inc ['Check table t2 exist on server 3']
include/assert.inc ['Check table t3 exist on server 3']
## 2.3 Drop table t2 on server 1 and table t3 on server 2.
[connection server1]
DROP TABLE t2;
include/rpl_sync.inc
[connection server2]
DROP TABLE t3;
include/rpl_sync.inc
## 2.4 Validate tables t2 and t3 are dropped on each server.
[connection server1]
include/assert.inc ['Check table t2 dropped on server 1']
include/assert.inc ['Check table t3 dropped on server 1']
[connection server2]
include/assert.inc ['Check table t2 dropped on server 2']
include/assert.inc ['Check table t3 dropped on server 2']
[connection server3]
include/assert.inc ['Check table t2 dropped on server 3']
include/assert.inc ['Check table t3 dropped on server 3']
## 3.1 Insert some data in table t1 on server 2,
## transaction should be rolledback
[connection server2]
INSERT INTO t1 VALUES (10);
ERROR HY000: Error on observer while running replication hook 'before_commit'.
include/rpl_sync.inc
[connection server1]
include/assert.inc ['Checking the number of records in table t1']
[connection server2]
include/assert.inc ['Checking the number of records in table t1']
[connection server3]
include/assert.inc ['Checking the number of records in table t1']
## 3.2 Insert some data in table t1 on server 1, data should be inserted
[connection server1]
INSERT INTO t1 VALUES (10);
include/rpl_sync.inc
[connection server1]
include/assert.inc ['Checking the number of records in table t1']
[connection server2]
include/assert.inc ['Checking the number of records in table t1']
[connection server3]
include/assert.inc ['Checking the number of records in table t1']
## 3.3 Insert some data in table t1 on server 3, data should be inserted
[connection server3]
INSERT INTO t1 VALUES (20);
include/rpl_sync.inc
[connection server1]
include/assert.inc ['Checking the number of records in table t1']
[connection server2]
include/assert.inc ['Checking the number of records in table t1']
[connection server3]
include/assert.inc ['Checking the number of records in table t1']
DELETE FROM t1;
include/rpl_sync.inc
## 3.4 Insert large sample data in table t1 on server 3,
## transaction should be rolledback
[connection server3]
BEGIN;
COMMIT;
ERROR HY000: Error on observer while running replication hook 'before_commit'.
include/rpl_sync.inc
[connection server1]
include/assert.inc ['Checking the number of records in table t1']
[connection server2]
include/assert.inc ['Checking the number of records in table t1']
[connection server3]
include/assert.inc ['Checking the number of records in table t1']
## 3.5 Insert large sample data in table t1 on server 1,
## data should be inserted
[connection server1]
BEGIN;
COMMIT;
include/rpl_sync.inc
[connection server1]
include/assert.inc ['Checking the number of records in table t1']
[connection server2]
include/assert.inc ['Checking the number of records in table t1']
[connection server3]
include/assert.inc ['Checking the number of records in table t1']
## 3.6 Delete all data from table t1 on server 2,
## transaction should be rolledback
[connection server2]
SET @group_replication_transaction_size_limit_save= @@GLOBAL.group_replication_transaction_size_limit;
SET GLOBAL group_replication_transaction_size_limit= 808;
DELETE FROM t1;
ERROR HY000: Error on observer while running replication hook 'before_commit'.
include/rpl_sync.inc
SET GLOBAL group_replication_transaction_size_limit= @group_replication_transaction_size_limit_save;
[connection server1]
include/assert.inc ['Checking the number of records in table t1']
[connection server2]
include/assert.inc ['Checking the number of records in table t1']
[connection server3]
include/assert.inc ['Checking the number of records in table t1']
## 3.7 Delete all data from table t1 on server 3,
## transaction should be rolledback
[connection server3]
DELETE FROM t1;
ERROR HY000: Error on observer while running replication hook 'before_commit'.
include/rpl_sync.inc
[connection server1]
include/assert.inc ['Checking the number of records in table t1']
[connection server2]
include/assert.inc ['Checking the number of records in table t1']
[connection server3]
include/assert.inc ['Checking the number of records in table t1']
## 3.8 Delete all data from table t1 on server 1, table will be empty
[connection server1]
DELETE FROM t1;
include/rpl_sync.inc
## 4. Validate that server1, server2 and server 3 has same set of data
include/diff_tables.inc [server1:test.t1, server2:test.t1, server3:test.t1]
## 5. Clean-up
DROP TABLE t1;
include/group_replication_end.inc
|