Debian Codegraph @

mysql-test/suite/ndb_rpl/t/ndb_rpl_temp_error_retry.test

raw
1 --source include/have_ndb.inc
2 --source suite/ndb_rpl/ndb_master-slave.inc
3
4 --echo ##################################################################
5 --echo #
6 --echo # Check that applier retries temporary errors
7 --echo # - first show that applier stops when no retries are allowed.
8 --echo # - then reconfigure to allow transaction retries and show how
9 --echo # applier is retrying until the provoked error is cleared
10 --echo #
11
12 --source include/rpl_connection_slave.inc
13 # Supress warnings caused by provoked temporary error retries
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
18 --source include/rpl_connection_master.inc
19 CREATE TABLE t1 (
20 nid int NOT NULL,
21 nom char(4) default NULL,
22 prenom char(4) default NULL,
23 PRIMARY KEY USING HASH (nid)
24 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
25 INSERT INTO t1 VALUES (1,"XYZ1","ABC1");
26
27 --source include/sync_slave_sql_with_master.inc
28
29 --source include/rpl_connection_slave.inc
30 --echo # Lock the row on replica
31 BEGIN;
32 UPDATE t1 SET nom="LOCK" WHERE nid=1;
33
34 --echo # Set number of retries low so retries are not allowed
35 SET GLOBAL replica_transaction_retries=1;
36
37 --source include/rpl_connection_master.inc
38 --echo # Change the row on source, this will cause lock wait timeout when
39 --echo # applying on replica
40 UPDATE t1 SET nom="DEAD" WHERE nid=1;
41
42 --source include/rpl_connection_slave1.inc
43 --echo # Wait for deadlock to be detected and applier to stop since
44 --echo # retries where not allowed. Use different connection.
45 --let $slave_sql_errno= convert_error(ER_LOCK_WAIT_TIMEOUT)
46 --let $show_slave_sql_error= 0
47 --source include/wait_for_slave_sql_error.inc
48
49 --echo # Reconfigure retries high enough to allow retries, start replication
50 SET GLOBAL replica_transaction_retries=10;
51 --source include/start_slave.inc
52
53 --echo # Wait for deadlock to be detected and retried at least two times.
54 let $wait_condition=
55 SELECT APPLYING_TRANSACTION_RETRIES_COUNT >= 2 FROM
56 performance_schema.replication_applier_status_by_worker
57 WHERE CHANNEL_NAME = "";
58 --source include/wait_condition.inc
59
60 --source include/rpl_connection_slave.inc
61 --echo # Switch back to the connection holding lock on replica, commit the
62 --echo # transaction to release lock and thus let the currently retrying
63 --echo # applier succeed
64 select * from t1 order by nid;
65 COMMIT;
66
67 --source include/rpl_connection_master.inc
68 --source include/sync_slave_sql_with_master.inc
69
70 --source include/rpl_connection_slave.inc
71 --echo # Verify that the row was applied sucessfully on replica
72 SELECT * FROM t1;
73
74 --source include/rpl_connection_master.inc
75 --echo # Cleanup
76 DROP TABLE t1;
77
78 --source include/rpl_end.inc