| 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 |
# |
| 8 |
# Check that applier retries temporary errors |
| 9 |
# - first show that applier stops when no retries are allowed. |
| 10 |
# - then reconfigure to allow transaction retries and show how |
| 11 |
# applier is retrying until the provoked error is cleared |
| 12 |
# |
| 13 |
[connection slave] |
| 14 |
call mtr.add_suppression(".*Lock timed out; Retry transaction.*"); |
| 15 |
call mtr.add_suppression(".*worker thread retried transaction 1 time.*"); |
| 16 |
call mtr.add_suppression(".*coordinator and worker threads are stopped.*"); |
| 17 |
[connection master] |
| 18 |
CREATE TABLE t1 ( |
| 19 |
nid int NOT NULL, |
| 20 |
nom char(4) default NULL, |
| 21 |
prenom char(4) default NULL, |
| 22 |
PRIMARY KEY USING HASH (nid) |
| 23 |
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; |
| 24 |
INSERT INTO t1 VALUES (1,"XYZ1","ABC1"); |
| 25 |
include/sync_slave_sql_with_master.inc |
| 26 |
[connection slave] |
| 27 |
# Lock the row on replica |
| 28 |
BEGIN; |
| 29 |
UPDATE t1 SET nom="LOCK" WHERE nid=1; |
| 30 |
# Set number of retries low so retries are not allowed |
| 31 |
SET GLOBAL replica_transaction_retries=1; |
| 32 |
[connection master] |
| 33 |
# Change the row on source, this will cause lock wait timeout when |
| 34 |
# applying on replica |
| 35 |
UPDATE t1 SET nom="DEAD" WHERE nid=1; |
| 36 |
[connection slave1] |
| 37 |
# Wait for deadlock to be detected and applier to stop since |
| 38 |
# retries where not allowed. Use different connection. |
| 39 |
include/wait_for_slave_sql_error.inc [errno=1205] |
| 40 |
# Reconfigure retries high enough to allow retries, start replication |
| 41 |
SET GLOBAL replica_transaction_retries=10; |
| 42 |
include/start_slave.inc |
| 43 |
# Wait for deadlock to be detected and retried at least two times. |
| 44 |
[connection slave] |
| 45 |
# Switch back to the connection holding lock on replica, commit the |
| 46 |
# transaction to release lock and thus let the currently retrying |
| 47 |
# applier succeed |
| 48 |
select * from t1 order by nid; |
| 49 |
nid nom prenom |
| 50 |
1 LOCK ABC1 |
| 51 |
COMMIT; |
| 52 |
[connection master] |
| 53 |
include/sync_slave_sql_with_master.inc |
| 54 |
[connection slave] |
| 55 |
# Verify that the row was applied sucessfully on replica |
| 56 |
SELECT * FROM t1; |
| 57 |
nid nom prenom |
| 58 |
1 DEAD ABC1 |
| 59 |
[connection master] |
| 60 |
# Cleanup |
| 61 |
DROP TABLE t1; |
| 62 |
include/rpl_end.inc |