summaryrefslogtreecommitdiff
path: root/mysql-test/suite/ndb/t/ndb_binlog_ddl_multi.test
blob: 487dfbf16e5866eb86d81a1a635880f51db9bf16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
-- source include/have_ndb.inc
-- source include/have_multi_ndb.inc
-- source include/have_binlog_format_row.inc

--disable_warnings
connection server2;
drop database if exists mysqltest;
drop table if exists t1,t2,t3;
connection server1;
drop database if exists mysqltest;
drop table if exists t1,t2,t3;
--connection server1
reset master;
--connection server2
reset master;
--enable_warnings

#
# basic test to see if ddl distribution works across
# multiple binlogs
#

# create database
--connection server1
create database mysqltest;

# create table
--connection server1
use mysqltest;
create table t1 (a int primary key) engine=ndb;

--connection server2
create table t2 (a int primary key) engine=ndb;
--source include/show_binlog_events2.inc

--connection server1
--source include/show_binlog_events2.inc

# alter table
--connection server1
reset master;
--connection server2
reset master;

--connection server2
alter table t2 add column (b int);

--connection server1
--source include/show_binlog_events2.inc

# alter database
--connection server1
reset master;
--connection server2
reset master;

--connection server2
ALTER DATABASE mysqltest CHARACTER SET latin1;


# having drop here instead of below sometimes triggers bug#18976
## drop table and drop should come after data events
--connection server2
drop table mysqltest.t1;

--connection server1
--source include/show_binlog_events2.inc
# to track down bug#18976
--real_sleep 10
--source include/show_binlog_events2.inc

#--connection server2
#drop table mysqltest.t1;

# drop database and drop should come after data events
--connection server1
reset master;
--connection server2
reset master;

--connection server1
use test;
insert into t2 values (1,2);
drop database mysqltest;
create table t1 (a int primary key) engine=ndb;

--connection server2
--source include/show_binlog_events2.inc

--connection server2
drop table t2;

# logfile groups and table spaces
--connection server1
reset master;
--connection server2
reset master;

--connection server1
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;

ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M 
ENGINE=NDB;

CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;

ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M 
ENGINE=NDB;

ALTER TABLESPACE ts1 
DROP DATAFILE 'datafile.dat' 
ENGINE = NDB;

ALTER TABLESPACE ts1 
DROP DATAFILE 'datafile02.dat' 
ENGINE = NDB;

DROP TABLESPACE ts1 
ENGINE = NDB;

DROP LOGFILE GROUP lg1 
ENGINE =NDB;

# having drop here instead of below sometimes triggers bug#18976
#drop table t1;

--connection server2
--source include/show_binlog_events2.inc
# to track down bug#18976
--real_sleep 10
--source include/show_binlog_events2.inc

drop table t1;

#
# Bug #17827 cluster: rename of several tables in one statement,
# gets multiply logged
#
--connection server1
reset master;
show tables;
--connection server2
reset master;
show tables;

--connection server1
create table t1 (a int key) engine=ndb;
create table t2 (a int key) engine=ndb;
create table t3 (a int key) engine=ndb;
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
--connection server2
--source include/show_binlog_events2.inc

drop table t1;
drop table t2;
drop table t3;

#
# Bug #17838 binlog not setup on seconday master after rename
#
#
--connection server1
reset master;
show tables;
--connection server2
reset master;
show tables;

--connection server1
create table t1 (a int key) engine=ndb;
insert into t1 values(1);
rename table t1 to t2;
insert into t2 values(2);

# now we should see data in table t1 _and_ t2
# prior to bug fix, data was missing for t2
--connection server2
drop table t2;
--source include/show_binlog_events2.inc