ndb_binlog_ddl_multi.test 3.69 KB
Newer Older
1 2 3 4 5 6
-- source include/have_multi_ndb.inc
-- source include/have_binlog_format_row.inc

--disable_warnings
connection server2;
drop database if exists mysqltest;
7
drop table if exists t1,t2,t3;
unknown's avatar
unknown committed
8
connection server1;
9
drop database if exists mysqltest;
10
drop table if exists t1,t2,t3;
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
--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;
33
--source include/show_binlog_events2.inc
34 35

--connection server1
36
--source include/show_binlog_events2.inc
37 38 39 40 41 42 43 44 45 46

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

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

unknown's avatar
unknown committed
47
--connection server1
48
--source include/show_binlog_events2.inc
49 50 51 52 53 54 55 56 57 58 59

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

--connection server2
ALTER DATABASE mysqltest CHARACTER SET latin1;


unknown's avatar
unknown committed
60 61
# having drop here instead of below sometimes triggers bug#18976
## drop table and drop should come after data events
62 63
--connection server2
drop table mysqltest.t1;
64 65

--connection server1
66
--source include/show_binlog_events2.inc
67 68
# to track down bug#18976
--real_sleep 10
69
--source include/show_binlog_events2.inc
70

71 72
#--connection server2
#drop table mysqltest.t1;
unknown's avatar
unknown committed
73

74 75 76 77 78 79 80
# drop database and drop should come after data events
--connection server1
reset master;
--connection server2
reset master;

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

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

89 90 91
--connection server2
drop table t2;

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
# 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;

unknown's avatar
unknown committed
135 136
# having drop here instead of below sometimes triggers bug#18976
#drop table t1;
137 138

--connection server2
139
--source include/show_binlog_events2.inc
140 141
# to track down bug#18976
--real_sleep 10
142
--source include/show_binlog_events2.inc
143

unknown's avatar
unknown committed
144 145
drop table t1;

146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
#
# 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
163
--source include/show_binlog_events2.inc
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

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
189
drop table t2;
190
--source include/show_binlog_events2.inc