| 1 |
# TBF - difference in row level logging |
| 2 |
-- source include/have_binlog_format_mixed_or_statement.inc |
| 3 |
-- source include/master-slave.inc |
| 4 |
|
| 5 |
--connection slave |
| 6 |
set sql_log_bin=0; |
| 7 |
create database y; |
| 8 |
set sql_log_bin=1; |
| 9 |
|
| 10 |
--connection master |
| 11 |
--disable_warnings |
| 12 |
drop database if exists mysqltest1; |
| 13 |
drop database if exists x; |
| 14 |
--enable_warnings |
| 15 |
create database mysqltest1; |
| 16 |
set sql_log_bin=0; |
| 17 |
create database x; |
| 18 |
set sql_log_bin=1; |
| 19 |
|
| 20 |
use mysqltest1; |
| 21 |
create table t1 (a int); |
| 22 |
insert into t1 values(9); |
| 23 |
use x; |
| 24 |
create table t1 (a int); |
| 25 |
insert into t1 values(9); |
| 26 |
select * from mysqltest1.t1; |
| 27 |
select * from x.t1; |
| 28 |
sync_slave_with_master; |
| 29 |
#TODO no it is no empty |
| 30 |
show databases like 'mysqltest1'; # should be empty |
| 31 |
select * from test.t1; |
| 32 |
select * from y.t1; |
| 33 |
# cleanup |
| 34 |
connection master; |
| 35 |
use mysqltest1; |
| 36 |
drop table t1; |
| 37 |
drop database mysqltest1; |
| 38 |
sync_slave_with_master; |
| 39 |
|
| 40 |
# |
| 41 |
# BUG#6353: |
| 42 |
# Option --replicate-rewrite-db should work together with LOAD DATA INFILE |
| 43 |
# |
| 44 |
|
| 45 |
connection slave; |
| 46 |
--disable_warnings |
| 47 |
drop database if exists rewrite; |
| 48 |
--enable_warnings |
| 49 |
create database rewrite; |
| 50 |
|
| 51 |
connection master; |
| 52 |
use test; |
| 53 |
create table t1 (a date, b date, c date not null, d date); |
| 54 |
load data infile '../../std_data/loaddata1.dat' ignore into table t1 character set latin1 fields terminated by ','; |
| 55 |
load data infile '../../std_data/loaddata1.dat' into table t1 character set latin1 fields terminated by ',' IGNORE 2 LINES; |
| 56 |
sync_slave_with_master; |
| 57 |
|
| 58 |
connection slave; |
| 59 |
select * from rewrite.t1; |
| 60 |
|
| 61 |
connection master; |
| 62 |
truncate table t1; |
| 63 |
load data infile '../../std_data/loaddata1.dat' ignore into table t1 character set latin1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); |
| 64 |
sync_slave_with_master; |
| 65 |
|
| 66 |
connection slave; |
| 67 |
select * from rewrite.t1; |
| 68 |
|
| 69 |
connection master; |
| 70 |
drop table t1; |
| 71 |
create table t1 (a text, b text) character set latin1; |
| 72 |
load data infile '../../std_data/loaddata2.dat' into table t1 character set latin1 fields terminated by ',' enclosed by ''''; |
| 73 |
sync_slave_with_master; |
| 74 |
|
| 75 |
connection slave; |
| 76 |
select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1; |
| 77 |
|
| 78 |
connection master; |
| 79 |
drop table t1; |
| 80 |
create table t1 (a int, b char(10)) character set latin1; |
| 81 |
load data infile '../../std_data/loaddata3.dat' into table t1 character set latin1 fields terminated by '' enclosed by '' ignore 1 lines; |
| 82 |
sync_slave_with_master; |
| 83 |
|
| 84 |
connection slave; |
| 85 |
select * from rewrite.t1; |
| 86 |
|
| 87 |
connection master; |
| 88 |
truncate table t1; |
| 89 |
load data infile '../../std_data/loaddata4.dat' into table t1 character set latin1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; |
| 90 |
sync_slave_with_master; |
| 91 |
|
| 92 |
connection slave; |
| 93 |
# The empty line last comes from the end line field in the file |
| 94 |
select * from rewrite.t1; |
| 95 |
|
| 96 |
set sql_log_bin= 0; |
| 97 |
drop database rewrite; |
| 98 |
set sql_log_bin= 1; |
| 99 |
|
| 100 |
connection master; |
| 101 |
set sql_log_bin= 0; |
| 102 |
drop table t1; |
| 103 |
set sql_log_bin= 1; |
| 104 |
|
| 105 |
# End of 4.1 tests |
| 106 |
|
| 107 |
--echo |
| 108 |
--echo **** |
| 109 |
--echo **** Bug #46861 Auto-closing of temporary tables broken by replicate-rewrite-db |
| 110 |
--echo **** |
| 111 |
--echo |
| 112 |
|
| 113 |
--echo **** |
| 114 |
--echo **** Preparing the environment |
| 115 |
--echo **** |
| 116 |
connection master; |
| 117 |
|
| 118 |
connect (con_temp_03,127.0.0.1,root,,test,$MASTER_MYPORT,); |
| 119 |
connect (con_temp_02,127.0.0.1,root,,test,$MASTER_MYPORT,); |
| 120 |
connect (con_temp_01,127.0.0.1,root,,test,$MASTER_MYPORT,); |
| 121 |
|
| 122 |
connection master; |
| 123 |
SET sql_log_bin= 0; |
| 124 |
CREATE DATABASE database_master_temp_01; |
| 125 |
CREATE DATABASE database_master_temp_02; |
| 126 |
CREATE DATABASE database_master_temp_03; |
| 127 |
SET sql_log_bin= 1; |
| 128 |
|
| 129 |
connection slave; |
| 130 |
SET sql_log_bin= 0; |
| 131 |
CREATE DATABASE database_slave_temp_01; |
| 132 |
CREATE DATABASE database_slave_temp_02; |
| 133 |
CREATE DATABASE database_slave_temp_03; |
| 134 |
SET sql_log_bin= 1; |
| 135 |
|
| 136 |
--echo |
| 137 |
--echo **** |
| 138 |
--echo **** Creating temporary tables on different databases with different connections |
| 139 |
--echo **** |
| 140 |
--echo **** con_temp_01 --> creates |
| 141 |
--echo **** t_01_01_temp on database_master_temp_01 |
| 142 |
--echo **** |
| 143 |
--echo **** con_temp_02 --> creates |
| 144 |
--echo **** t_01_01_temp on database_master_temp_01 |
| 145 |
--echo **** t_02_01_temp, t_02_02_temp on database_master_temp_02 |
| 146 |
--echo **** |
| 147 |
--echo **** con_temp_02 --> creates |
| 148 |
--echo **** t_01_01_temp on database_master_temp_01 |
| 149 |
--echo **** t_02_01_temp, t_02_02_temp on database_master_temp_02 |
| 150 |
--echo **** t_03_01_temp, t_03_02_temp, t_03_03_temp on database_master_temp_03 |
| 151 |
--echo **** |
| 152 |
|
| 153 |
connection con_temp_01; |
| 154 |
USE database_master_temp_01; |
| 155 |
CREATE TEMPORARY TABLE t_01_01_temp(a int); |
| 156 |
INSERT INTO t_01_01_temp VALUES(1); |
| 157 |
|
| 158 |
connection con_temp_02; |
| 159 |
USE database_master_temp_01; |
| 160 |
CREATE TEMPORARY TABLE t_01_01_temp(a int); |
| 161 |
INSERT INTO t_01_01_temp VALUES(1); |
| 162 |
USE database_master_temp_02; |
| 163 |
CREATE TEMPORARY TABLE t_02_01_temp(a int); |
| 164 |
INSERT INTO t_02_01_temp VALUES(1); |
| 165 |
CREATE TEMPORARY TABLE t_02_02_temp(a int); |
| 166 |
INSERT INTO t_02_02_temp VALUES(1); |
| 167 |
|
| 168 |
connection con_temp_03; |
| 169 |
USE database_master_temp_01; |
| 170 |
CREATE TEMPORARY TABLE t_01_01_temp(a int); |
| 171 |
INSERT INTO t_01_01_temp VALUES(1); |
| 172 |
USE database_master_temp_02; |
| 173 |
CREATE TEMPORARY TABLE t_02_01_temp(a int); |
| 174 |
INSERT INTO t_02_01_temp VALUES(1); |
| 175 |
CREATE TEMPORARY TABLE t_02_02_temp(a int); |
| 176 |
INSERT INTO t_02_02_temp VALUES(1); |
| 177 |
USE database_master_temp_03; |
| 178 |
CREATE TEMPORARY TABLE t_03_01_temp(a int); |
| 179 |
INSERT INTO t_03_01_temp VALUES(1); |
| 180 |
CREATE TEMPORARY TABLE t_03_02_temp(a int); |
| 181 |
INSERT INTO t_03_02_temp VALUES(1); |
| 182 |
CREATE TEMPORARY TABLE t_03_03_temp(a int); |
| 183 |
INSERT INTO t_03_03_temp VALUES(1); |
| 184 |
|
| 185 |
--echo |
| 186 |
--echo **** Dropping the connections |
| 187 |
--echo **** We want to SHOW BINLOG EVENTS, to know what was logged. But there is no |
| 188 |
--echo **** guarantee that logging of the terminated con1 has been done yet.a To be |
| 189 |
--echo **** sure that logging has been done, we use a user lock. |
| 190 |
--echo |
| 191 |
connection master; |
| 192 |
sync_slave_with_master; |
| 193 |
connection slave; |
| 194 |
show status like 'Slave_open_temp_tables'; |
| 195 |
|
| 196 |
connection master; |
| 197 |
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); |
| 198 |
connection con_temp_01; |
| 199 |
select get_lock("con_01",10); |
| 200 |
connection master; |
| 201 |
disconnect con_temp_01; |
| 202 |
select get_lock("con_01",10); |
| 203 |
|
| 204 |
connection con_temp_02; |
| 205 |
select get_lock("con_02",10); |
| 206 |
connection master; |
| 207 |
disconnect con_temp_02; |
| 208 |
select get_lock("con_02",10); |
| 209 |
|
| 210 |
connection con_temp_03; |
| 211 |
select get_lock("con_03",10); |
| 212 |
connection master; |
| 213 |
disconnect con_temp_03; |
| 214 |
select get_lock("con_03",10); |
| 215 |
|
| 216 |
--echo |
| 217 |
--echo **** Checking the binary log and temporary tables |
| 218 |
--echo |
| 219 |
connection master; |
| 220 |
sync_slave_with_master; |
| 221 |
connection slave; |
| 222 |
show status like 'Slave_open_temp_tables'; |
| 223 |
|
| 224 |
connection master; |
| 225 |
--source include/show_binlog_events.inc |
| 226 |
|
| 227 |
--echo **** |
| 228 |
--echo **** Cleaning up the test case |
| 229 |
--echo **** |
| 230 |
connection master; |
| 231 |
SET sql_log_bin= 0; |
| 232 |
DROP DATABASE database_master_temp_01; |
| 233 |
DROP DATABASE database_master_temp_02; |
| 234 |
DROP DATABASE database_master_temp_03; |
| 235 |
DROP DATABASE x; |
| 236 |
SET sql_log_bin= 1; |
| 237 |
|
| 238 |
connection slave; |
| 239 |
SET sql_log_bin= 0; |
| 240 |
DROP DATABASE database_slave_temp_01; |
| 241 |
DROP DATABASE database_slave_temp_02; |
| 242 |
DROP DATABASE database_slave_temp_03; |
| 243 |
DROP DATABASE y; |
| 244 |
SET sql_log_bin= 1; |
| 245 |
|
| 246 |
connection master; |
| 247 |
sync_slave_with_master; |
| 248 |
|
| 249 |
# end of 5.0 tests |
| 250 |
--source include/rpl_end.inc |