Debian Codegraph @

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

raw
1 #
2 # Test engine native conflict resolution for
3 # NDB$MAX_INS algorithm for UPDATE and DELETE operations
4 #
5
6 --source include/have_ndb.inc
7 --source include/have_binlog_format_mixed_or_row.inc
8 --source suite/ndb_rpl/ndb_master-slave.inc
9
10 --disable_query_log
11 --connection master
12 CREATE TABLE mysql.ndb_replication
13 (db VARBINARY(63),
14 table_name VARBINARY(63),
15 server_id INT UNSIGNED,
16 binlog_type INT UNSIGNED,
17 conflict_fn VARBINARY(128),
18 PRIMARY KEY USING HASH (db,table_name,server_id))
19 ENGINE=NDB PARTITION BY KEY(db,table_name);
20 create table `test`.`t1$EX`
21 (server_id int unsigned,
22 master_server_id int unsigned,
23 master_epoch bigint unsigned,
24 count int unsigned,
25 a int not null,
26 d varchar(9) not null,
27 primary key(server_id, master_server_id, master_epoch, count)) engine ndb;
28 --enable_query_log
29
30 --echo *** Test 1 ********************************************************
31 --echo * test native NDB\$MAX_INS() conflict resolution
32 --echo * test with both allowed "conflict column" types, uint32 and uint64
33 --echo *******************************************************************
34 --connection master
35 set @save_luaw = @@global.ndb_log_update_as_write;
36 set @save_luo = @@global.ndb_log_updated_only;
37 set global ndb_log_update_as_write=0;
38 set global ndb_log_updated_only=0;
39 # Option 0 for binlog_type means use server defaults, above.
40 insert into mysql.ndb_replication values ("test", "t1", 0, 0, "NDB$MAX_INS(X)");
41 --let col_type = int unsigned
42 --source suite/ndb_rpl/t/ndb_rpl_conflict_1.inc
43
44 --echo *** Test 2 ********************************************************
45 --echo * test native NDB\$MAX_INS() conflict resolution
46 --echo * test with both allowed "conflict column" types, uint32 and uint64
47 --echo *******************************************************************
48 --connection master
49 --let col_type = bigint unsigned
50 --source suite/ndb_rpl/t/ndb_rpl_conflict_1.inc
51
52 --echo *** Test 3 ********************************************************
53 --echo * test native NDB\$MAX_INS() conflict resolution
54 --echo * test that setting binlog update option via table works equally well
55 --echo *******************************************************************
56 --connection master
57 set global ndb_log_update_as_write=1;
58 set global ndb_log_updated_only=1;
59 update mysql.ndb_replication set binlog_type=7; # Full, Use Update
60 --let col_type = bigint unsigned
61 --source suite/ndb_rpl/t/ndb_rpl_conflict_1.inc
62
63 --echo *** Test 4 ***********************************************************
64 --echo * test behaviour with updates logged as writes, but all columns present
65 --echo * Should succeed since the NDB\$MAX_INS() supports conflict detection
66 --echo * and resolution for INSERTS.
67 --echo * ********************************************************************
68 --connection master
69 update mysql.ndb_replication set binlog_type=3; # Full, Use Write
70 --let col_type = int unsigned
71 --source suite/ndb_rpl/t/ndb_rpl_conflict_1.inc
72
73 --echo *** Test 5 ***********************************************************
74 --echo * test that missing timestamp column in after-image for update, or
75 --echo * test before image for delete results in slave stopping
76 --echo **********************************************************************
77 --connection master
78 update mysql.ndb_replication set binlog_type=6; # Updated only, Use Update
79
80 create table t1 (a int, b varchar(32), X bigint unsigned, d varchar(9), primary key (a, d)) engine ndb;
81
82 insert into t1 values (1, "Master row 1 at X=1", 1, "1:1");
83 insert into t1 values (2, "Master row 2 at X=1", 1, "2:1");
84 insert into t1 values (3, "Master row 3 at X=1", 1, "3:1");
85
86 --sync_slave_with_master
87
88 --connection master
89 --echo Show update missing timestamp column causes slave failure
90
91 update t1 set b='Blah' where a=1 and d="1:1";
92
93 --connection slave
94 # Add suppressions to avoid MTR complaints...
95 call mtr.add_suppression(".*missing info necessary for conflict detection.*");
96 call mtr.add_suppression(".Could not execute.*rows event on table.*");
97 call mtr.add_suppression(".*error 1610.*");
98 call mtr.add_suppression(".*coordinator and worker threads are stopped.*");
99
100 --echo Wait for slave to choke on that event.
101 --let $slave_sql_errno=1296
102 --source include/wait_for_slave_sql_error.inc
103
104 # Recover sync
105 --source include/stop_slave_io.inc
106 RESET REPLICA;
107 --let $rpl_only_running_threads= 1
108 --source include/rpl_reset.inc
109
110 --connection master
111 --echo Show delete missing timestamp column (in before image) causes
112 --echo slave failure
113
114 delete from t1 where a=3 and d="3:1";
115
116 --connection slave
117 --echo Wait for slave to choke on that event.
118 --let $slave_sql_errno=1296
119 --source include/wait_for_slave_sql_error.inc
120
121 # Recover sync
122 --source include/stop_slave_io.inc
123 RESET REPLICA;
124 --let $rpl_only_running_threads= 1
125 --source include/rpl_reset.inc
126
127 --connection master
128 drop table t1;
129
130 --echo *** test cleanup
131 set global ndb_log_update_as_write= @save_luaw;
132 set global ndb_log_updated_only = @save_luo;
133 --disable_query_log
134 --connection master
135 drop table mysql.ndb_replication;
136 drop table `test`.`t1$EX`;
137 --sync_slave_with_master
138 --enable_query_log
139
140 --source include/rpl_end.inc