| 1 |
# |
| 2 |
# Test replicas ability to retry when failure occurs to open |
| 3 |
# table due to "table definition changed". |
| 4 |
# This is done by introducing an artifical error every second time the |
| 5 |
# replica attempts to open a table while applying a row change, the |
| 6 |
# replica will then back off and retry according to its transaction |
| 7 |
# retry settings. |
| 8 |
# |
| 9 |
include/master-slave.inc |
| 10 |
Warnings: |
| 11 |
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 12 |
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. |
| 13 |
[connection master] |
| 14 |
CREATE TABLE t1 ( |
| 15 |
a INT PRIMARY KEY, |
| 16 |
b VARCHAR(32) |
| 17 |
) engine=ndb; |
| 18 |
include/sync_slave_sql_with_master.inc |
| 19 |
# Adding debug point 'ndb_replica_change_t1_version' to @@GLOBAL.debug |
| 20 |
# Case 1. insert |
| 21 |
[connection master] |
| 22 |
INSERT INTO t1 VALUES (1, "row 1"), (2, "row 2"), |
| 23 |
(3, "row 3"), (4, "row 4"), (5, "row 5"); |
| 24 |
include/sync_slave_sql_with_master.inc |
| 25 |
include/rpl_stop_slaves.inc |
| 26 |
include/rpl_start_slaves.inc |
| 27 |
# Case 2. 2 update transactions |
| 28 |
[connection master] |
| 29 |
UPDATE t1 SET b = "row 2 updated" WHERE a = 2; |
| 30 |
# Wait for ndb_binlog thread... |
| 31 |
UPDATE t1 SET b = "row 4 updated" WHERE a = 4; |
| 32 |
include/sync_slave_sql_with_master.inc |
| 33 |
include/rpl_stop_slaves.inc |
| 34 |
include/rpl_start_slaves.inc |
| 35 |
# Case 3. delete |
| 36 |
[connection master] |
| 37 |
DELETE FROM t1 WHERE a = 5; |
| 38 |
include/sync_slave_sql_with_master.inc |
| 39 |
include/rpl_stop_slaves.inc |
| 40 |
include/rpl_start_slaves.inc |
| 41 |
# Case 4. transaction with more than one change |
| 42 |
[connection master] |
| 43 |
BEGIN; |
| 44 |
UPDATE t1 SET b = "row 3 updated in trans" WHERE a = 3; |
| 45 |
INSERT INTO t1 VALUES (6, "row 6 inserted in trans"); |
| 46 |
COMMIT; |
| 47 |
include/sync_slave_sql_with_master.inc |
| 48 |
include/rpl_stop_slaves.inc |
| 49 |
include/rpl_start_slaves.inc |
| 50 |
# Case 5. alter, not in trans and thus unaffected |
| 51 |
[connection master] |
| 52 |
ALTER TABLE t1 ADD c INT; |
| 53 |
Warnings: |
| 54 |
Warning 1478 Converted FIXED field 'c' to DYNAMIC to enable online ADD COLUMN |
| 55 |
include/sync_slave_sql_with_master.inc |
| 56 |
SELECT * FROM t1 ORDER BY a; |
| 57 |
a b c |
| 58 |
1 row 1 NULL |
| 59 |
2 row 2 updated NULL |
| 60 |
3 row 3 updated in trans NULL |
| 61 |
4 row 4 updated NULL |
| 62 |
6 row 6 inserted in trans NULL |
| 63 |
# Removing debug point 'ndb_replica_change_t1_version' from @@GLOBAL.debug |
| 64 |
[connection master] |
| 65 |
DROP TABLE t1; |
| 66 |
include/sync_slave_sql_with_master.inc |
| 67 |
include/rpl_end.inc |