| 1 |
include/master-slave.inc |
| 2 |
Warnings: |
| 3 |
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 4 |
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. |
| 5 |
[connection master] |
| 6 |
# |
| 7 |
# Initialization the test |
| 8 |
# |
| 9 |
CREATE DATABASE db1; |
| 10 |
CREATE DATABASE db2; |
| 11 |
CREATE TABLE db1.t1(c1 INT PRIMARY KEY, c2 VARCHAR(4096)) ENGINE=InnoDB; |
| 12 |
CREATE TABLE db1.t2(c1 INT PRIMARY KEY, c2 VARCHAR(4096)) ENGINE=InnoDB; |
| 13 |
CREATE TABLE db2.t1(c1 INT PRIMARY KEY, c2 VARCHAR(4096)) ENGINE=InnoDB; |
| 14 |
INSERT INTO db1.t1 VALUES(1, NULL), (10, NULL), (100, NULL); |
| 15 |
INSERT INTO db1.t2 VALUES(1, NULL), (10, NULL), (100, NULL); |
| 16 |
INSERT INTO db2.t1 VALUES(1, NULL), (10, NULL), (100, NULL); |
| 17 |
include/sync_slave_sql_with_master.inc |
| 18 |
CALL mtr.add_suppression("Replica SQL for channel '':.*Lock wait timeout exceeded.*"); |
| 19 |
CALL mtr.add_suppression("Replica SQL for channel '': Worker . failed executing transaction.*"); |
| 20 |
CALL mtr.add_suppression("Replica SQL for channel '': .*Error_code: MY-001756"); |
| 21 |
CALL mtr.add_suppression("Replica SQL for channel '': worker thread retried transaction.*"); |
| 22 |
SET @saved_innodb_lock_wait_timeout = @@GLOBAL.innodb_lock_wait_timeout; |
| 23 |
SET @saved_replica_parallel_workers = @@GLOBAL.replica_parallel_workers; |
| 24 |
SET @saved_replica_parallel_type = @@GLOBAL.replica_parallel_type; |
| 25 |
Warnings: |
| 26 |
Warning 1287 '@@replica_parallel_type' is deprecated and will be removed in a future release. |
| 27 |
SET @saved_max_relay_log_size = @@GLOBAL.max_relay_log_size; |
| 28 |
SET @saved_replica_transaction_retries = @@GLOBAL.replica_transaction_retries; |
| 29 |
SET GLOBAL innodb_lock_wait_timeout = 1; |
| 30 |
SET GLOBAL replica_parallel_workers = 2; |
| 31 |
SET GLOBAL max_relay_log_size = 4096; |
| 32 |
include/stop_slave_sql.inc |
| 33 |
SET GLOBAL replica_parallel_type = "LOGICAL_CLOCK"; |
| 34 |
Warnings: |
| 35 |
Warning 1287 '@@replica_parallel_type' is deprecated and will be removed in a future release. |
| 36 |
include/start_slave_sql.inc |
| 37 |
# |
| 38 |
# Case 1: slave will stop if replica_transaction_retries is 0 |
| 39 |
# |
| 40 |
SET GLOBAL replica_transaction_retries = 0; |
| 41 |
BEGIN; |
| 42 |
SELECT c1 FROM db1.t1 FOR UPDATE; |
| 43 |
c1 |
| 44 |
1 |
| 45 |
10 |
| 46 |
100 |
| 47 |
[connection master] |
| 48 |
SET DEBUG = "+d,set_commit_parent_100"; |
| 49 |
INSERT INTO db1.t1 VALUES(2, NULL); |
| 50 |
INSERT INTO db2.t1 VALUES(2, NULL); |
| 51 |
include/save_master_pos.inc |
| 52 |
[connection slave] |
| 53 |
include/wait_for_slave_sql_error.inc [errno=1205] |
| 54 |
include/assert.inc [Value 2 is not in db1.t1.] |
| 55 |
ROLLBACK; |
| 56 |
# |
| 57 |
# Case 2: Slave will stop after retrying a transaction |
| 58 |
# replica_transaction_retries times. |
| 59 |
# |
| 60 |
SET GLOBAL replica_transaction_retries = 2; |
| 61 |
include/start_slave_sql.inc |
| 62 |
include/sync_slave_sql.inc |
| 63 |
BEGIN; |
| 64 |
SELECT c1 FROM db1.t2 FOR UPDATE; |
| 65 |
c1 |
| 66 |
1 |
| 67 |
10 |
| 68 |
100 |
| 69 |
[connection master] |
| 70 |
BEGIN; |
| 71 |
INSERT INTO db1.t1 VALUES(20, NULL); |
| 72 |
INSERT INTO db1.t2 VALUES(20, NULL); |
| 73 |
COMMIT; |
| 74 |
INSERT INTO db2.t1 VALUES(20, NULL); |
| 75 |
include/save_master_pos.inc |
| 76 |
[connection slave] |
| 77 |
include/wait_for_slave_sql_error.inc [errno=1205] |
| 78 |
include/assert.inc [Value 20 is not in db1.t1.] |
| 79 |
ROLLBACK; |
| 80 |
# |
| 81 |
# Case 3: Slave worker will not stop after retring a transaction |
| 82 |
# sucessfully. |
| 83 |
# |
| 84 |
SET GLOBAL replica_transaction_retries = 10; |
| 85 |
include/start_slave_sql.inc |
| 86 |
include/sync_slave_sql.inc |
| 87 |
include/check_slave_no_error.inc |
| 88 |
BEGIN; |
| 89 |
SELECT c1 FROM db1.t2 FOR UPDATE; |
| 90 |
c1 |
| 91 |
1 |
| 92 |
10 |
| 93 |
20 |
| 94 |
100 |
| 95 |
[connection master] |
| 96 |
BEGIN; |
| 97 |
# INSERT INTO db1.t1 VALUES(30, 4096'a') |
| 98 |
# INSERT INTO db1.t1 VALUES(31, 4096'a') |
| 99 |
SET @str= 'abc'; |
| 100 |
INSERT INTO db1.t2 VALUES(30, @str); |
| 101 |
COMMIT; |
| 102 |
INSERT INTO db2.t1 VALUES(30, NULL); |
| 103 |
include/save_master_pos.inc |
| 104 |
[connection slave] |
| 105 |
include/check_slave_no_error.inc |
| 106 |
ROLLBACK; |
| 107 |
include/sync_slave_sql.inc |
| 108 |
include/check_slave_no_error.inc |
| 109 |
include/rpl_diff.inc |
| 110 |
include/rpl_diff.inc |
| 111 |
include/rpl_diff.inc |
| 112 |
[connection master] |
| 113 |
INSERT INTO db1.t1 VALUES(40, NULL); |
| 114 |
INSERT INTO db2.t1 VALUES(40, NULL); |
| 115 |
include/sync_slave_sql_with_master.inc |
| 116 |
# |
| 117 |
# Case 4: Non-temporary error will stop slave workers without retrying |
| 118 |
# |
| 119 |
INSERT INTO db1.t1 VALUES(50, NULL); |
| 120 |
[connection master] |
| 121 |
INSERT INTO db1.t1 VALUES(50, NULL); |
| 122 |
include/save_master_pos.inc |
| 123 |
[connection slave] |
| 124 |
include/wait_for_slave_sql_error.inc [errno=1062] |
| 125 |
include/assert.inc [count_transactions_retries should not increase] |
| 126 |
DELETE FROM db1.t1 WHERE c1 = 50; |
| 127 |
include/start_slave_sql.inc |
| 128 |
include/sync_slave_sql.inc |
| 129 |
# |
| 130 |
# Cleanup |
| 131 |
# |
| 132 |
SET GLOBAL innodb_lock_wait_timeout = @saved_innodb_lock_wait_timeout; |
| 133 |
SET GLOBAL replica_parallel_workers = @saved_replica_parallel_workers; |
| 134 |
SET GLOBAL max_relay_log_size = @saved_max_relay_log_size; |
| 135 |
SET GLOBAL replica_transaction_retries = @saved_replica_transaction_retries; |
| 136 |
include/stop_slave_sql.inc |
| 137 |
SET GLOBAL replica_parallel_type= @saved_replica_parallel_type; |
| 138 |
Warnings: |
| 139 |
Warning 1287 '@@replica_parallel_type' is deprecated and will be removed in a future release. |
| 140 |
include/start_slave_sql.inc |
| 141 |
[connection master] |
| 142 |
SET DEBUG = "-d,set_commit_parent_100"; |
| 143 |
DROP DATABASE db1; |
| 144 |
DROP DATABASE db2; |
| 145 |
include/rpl_end.inc |