Debian Codegraph @

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

raw
1 #
2 # Test engine logging options for ndb
3 #
4 --source include/have_ndb.inc
5 --source include/have_binlog_format_mixed_or_row.inc
6 --source suite/ndb_rpl/ndb_master-slave.inc
7
8 --disable_warnings
9 --disable_query_log
10 --connection master
11 # default settings for the mysqld
12 set global ndb_log_update_as_write=1;
13 set global ndb_log_updated_only=1;
14 # create the ndb_replication table
15 drop table if exists mysql.ndb_replication;
16 CREATE TABLE mysql.ndb_replication
17 (db VARBINARY(63),
18 table_name VARBINARY(63),
19 server_id INT UNSIGNED,
20 binlog_type INT UNSIGNED,
21 conflict_fn VARBINARY(128),
22 PRIMARY KEY USING HASH (db,table_name,server_id))
23 ENGINE=NDB PARTITION BY KEY(db,table_name);
24 --enable_warnings
25 --enable_query_log
26
27 ##
28 # no logging option = 1
29 #
30 --echo **** Test 1 ****
31 --connection master
32 delete from mysql.ndb_replication;
33 insert into mysql.ndb_replication values ("test", "t1", 0, 1, NULL);
34 create table t1 (a int key, b varchar(32), c varchar(32)) engine ndb;
35 create table t2 (a int key, b varchar(32), c varchar(32)) engine ndb;
36 insert into t1 values (1,"t1.b from master", "t1.c from master");
37 insert into t2 values (1,"t2.b from master", "t2.c from master");
38 #
39 # connect to slave and ensure data it there from t2 but not from t1
40 #
41 --sync_slave_with_master
42 --connection slave
43 select * from t1;
44 select * from t2;
45 --connection master
46 drop table t1;
47 drop table t2;
48
49 ##
50 # updated logging option = 2
51 #
52 --echo **** Test 2 ****
53 --connection master
54 delete from mysql.ndb_replication;
55 insert into mysql.ndb_replication values ("test", "t1", 0, 2, NULL);
56 #
57 # table t1 should get the opption from the table overriding the setting
58 # in the server, t2 will get full row updates as it is the server setting
59 #
60 set global ndb_log_updated_only=0;
61 create table t1 (a int key, b varchar(32), c varchar(32)) engine ndb;
62 create table t2 (a int key, b varchar(32), c varchar(32)) engine ndb;
63 insert into t1 values (1,"t1.b from master", "t1.c from master");
64 insert into t2 values (1,"t2.b from master", "t2.c from master");
65 #
66 # connect to slave and ensure data it there
67 #
68 --sync_slave_with_master
69 --connection slave
70 select * from t1;
71 select * from t2;
72 #
73 # now make an update on the slave
74 #
75 update t1 set c="t1.c from slave";
76 update t2 set c="t2.c from slave";
77 #
78 # and back to the master to update difffrent columns there
79 #
80 --connection master
81 update t1 set b="updated t1.b from master";
82 update t2 set b="updated t2.b from master";
83 #
84 # connect to slave and ensure data it there, but a mix of slave/master
85 # updates
86 #
87 --sync_slave_with_master
88 --connection slave
89 select * from t1;
90 select * from t2;
91 --connection master
92 drop table t1;
93 drop table t2;
94
95 ##
96 # full logging option = 3
97 #
98 --echo **** Test 3 ****
99 --connection master
100 delete from mysql.ndb_replication;
101 insert into mysql.ndb_replication values ("test", "t1", 0, 3, NULL);
102 # back to default
103 set global ndb_log_updated_only=1;
104 create table t1 (a int key, b varchar(32), c varchar(32)) engine ndb;
105 create table t2 (a int key, b varchar(32), c varchar(32)) engine ndb;
106 insert into t1 values (1,"t1.b from master", "t1.c from master");
107 insert into t2 values (1,"t2.b from master", "t2.c from master");
108 #
109 # connect to slave and ensure data it there
110 #
111 --sync_slave_with_master
112 --connection slave
113 select * from t1;
114 select * from t2;
115 #
116 # now make an update on the slave
117 #
118 update t1 set c="t1.c from slave";
119 update t2 set c="t2.c from slave";
120 #
121 # and back to the master to update difffrent columns there
122 #
123 --connection master
124 update t1 set b="updated t1.b from master";
125 update t2 set b="updated t2.b from master";
126 #
127 # connect to slave and ensure data it there, but a mix of slave/master
128 # updates for t2 but not for t1
129 #
130 --sync_slave_with_master
131 --connection slave
132 select * from t1;
133 select * from t2;
134 --connection master
135 drop table t1;
136 drop table t2;
137 drop table mysql.ndb_replication;
138
139 --source include/rpl_end.inc