Debian Codegraph @

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

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