Commit 28dba4c6 authored by jmiller@mysql.com's avatar jmiller@mysql.com

Merge jmiller@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/home/ndbdev/jmiller/clones/mysql-5.1-new
parents ebe0b0b8 400bc0ca
# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
# exist.
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
connection slave;
stop slave; # don't need slave for this test
# Test logging on master
connection master;
# 'test' is the current database
create database mysqltest;
use mysqltest;
create table t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
# Starting from 5.0.3 LOAD DATA is replicated much in the same way as ordinary
# query so "show binlog ..." should show two events (before 5.0.3 no events
# were returned).
--replace_column 2 # 5 #
show binlog events from 102;
drop database mysqltest;
...@@ -5,13 +5,19 @@ reset slave; ...@@ -5,13 +5,19 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
create table t1 (a int primary key); create table t1 (a int primary key);
create table t4 (a int primary key);
insert into t1 values (1),(1); insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1 ERROR 23000: Duplicate entry '1' for key 1
show slave status; insert into t4 values (1),(2);
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 292 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 292 # None 0 No #
show tables like 't1'; show tables like 't1';
Tables_in_test (t1) Tables_in_test (t1)
show tables like 't4';
Tables_in_test (t4)
t4
SELECT * FROM test.t4;
a
1
2
drop table t1; drop table t1;
select get_lock('crash_lock%20C', 10); select get_lock('crash_lock%20C', 10);
get_lock('crash_lock%20C', 10) get_lock('crash_lock%20C', 10)
...@@ -26,14 +32,11 @@ select (@id := id) - id from t3; ...@@ -26,14 +32,11 @@ select (@id := id) - id from t3;
0 0
kill @id; kill @id;
drop table t2,t3; drop table t2,t3;
show binlog events from 102; insert into t4 values (3),(4);
Log_name Pos Event_type Server_id End_log_pos Info SELECT * FROM test.t4;
master-bin.000001 # Query 1 # use `test`; create table t1 (a int primary key) a
master-bin.000001 # Query 1 # use `test`; insert into t1 values (1),(1) 1
master-bin.000001 # Query 1 # use `test`; drop table t1 2
master-bin.000001 # Query 1 # use `test`; create table t2 (a int primary key) 3
master-bin.000001 # Query 1 # use `test`; insert into t2 values(1) 4
master-bin.000001 # Query 1 # use `test`; create table t3 (id int) DROP TABLE test.t4;
master-bin.000001 # Query 1 # use `test`; insert into t3 values(connection_id())
master-bin.000001 # Query 1 # use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
master-bin.000001 # Query 1 # use `test`; drop table t2,t3
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists mysqltest;
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
2
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
SHOW DATABASES;
Database
information_schema
mysql
mysqltest
test
USE test;
SHOW TABLES;
Tables_in_test
USE mysqltest;
SHOW TABLES;
Tables_in_mysqltest
t1
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
DROP DATABASE mysqltest;
DROP TABLE test.t1;
This diff is collapsed.
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists mysqltest;
stop slave;
create database mysqltest;
use mysqltest;
create table t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest
master-bin.000001 # Query 1 # create database mysqltest
master-bin.000001 # Query 1 # use `mysqltest`; create table t1(a int, b int, unique(b))
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=12
master-bin.000001 # Execute_load_query 1 # use `mysqltest`; load data infile '../../std_data/rpl_loaddata.dat' into table t1 ;file_id=1
drop database mysqltest;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
create table t1 (a int);
insert into t1 values(9);
select * from mysqltest1.t1;
a
9
show databases like 'mysqltest1';
Database (mysqltest1)
mysqltest1
select * from test.t1;
a
9
drop table t1;
drop database mysqltest1;
drop database if exists rewrite;
create database rewrite;
use test;
create table t1 (a date, b date, c date not null, d date);
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
select * from rewrite.t1;
a b c d
0000-00-00 NULL 0000-00-00 0000-00-00
0000-00-00 0000-00-00 0000-00-00 0000-00-00
2003-03-03 2003-03-03 2003-03-03 NULL
2003-03-03 2003-03-03 2003-03-03 NULL
truncate table t1;
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
select * from rewrite.t1;
a b c d
NULL NULL 0000-00-00 0000-00-00
NULL 0000-00-00 0000-00-00 0000-00-00
NULL 2003-03-03 2003-03-03 NULL
drop table t1;
create table t1 (a text, b text);
load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
concat('|',a,'|') concat('|',b,'|')
|Field A| |Field B|
|Field 1| |Field 2'
Field 3,'Field 4|
|Field 5' ,'Field 6| NULL
|Field 6| | 'Field 7'|
drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
Warning 1264 Out of range value for column 'a' at row 3
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
Warning 1264 Out of range value for column 'a' at row 5
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from rewrite.t1;
a b
1 row 1
2 row 2
0 1234567890
3 row 3
0 1234567890
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings:
Warning 1264 Out of range value for column 'a' at row 4
Warning 1261 Row 4 doesn't contain data for all columns
select * from rewrite.t1;
a b
1 row 1
2 row 2
3 row 3
0
drop database rewrite;
drop table t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
set timestamp=100000000;
create table t1 (t timestamp);
create table t2 (t char(32));
select @@time_zone;
@@time_zone
Japan
select @@time_zone;
@@time_zone
Europe/Moscow
insert into t1 values ('20050101000000'), ('20050611093902');
set time_zone='UTC';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
t
2004-12-31 21:00:00
2005-06-11 05:39:02
2004-01-01 00:00:00
2004-06-11 09:39:02
set time_zone='UTC';
select * from t1;
t
2004-12-31 21:00:00
2005-06-11 05:39:02
2004-01-01 00:00:00
2004-06-11 09:39:02
delete from t1;
set time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
set time_zone='Europe/Moscow';
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
use test;
SET TIMESTAMP=100000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (t timestamp);
SET TIMESTAMP=100000000;
create table t2 (t char(32));
SET TIMESTAMP=100000000;
SET @@session.time_zone='Europe/Moscow';
insert into t1 values ('20050101000000'), ('20050611093902');
SET TIMESTAMP=100000000;
SET @@session.time_zone='UTC';
insert into t1 values ('20040101000000'), ('20040611093902');
SET TIMESTAMP=100000000;
delete from t1;
SET TIMESTAMP=100000000;
SET @@session.time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
delete from t1;
set time_zone='UTC';
load data infile '../../std_data/rpl_timezone.dat' into table t1;
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
set time_zone='UTC';
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
set time_zone='Europe/Moscow';
set time_zone='Europe/Moscow';
delete from t1;
insert into t1 values ('20040101000000'), ('20040611093902');
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
t
2003-12-31 22:00:00
2004-06-11 07:39:02
select * from t2;
t
2003-12-31 22:00:00
2004-06-11 07:39:02
delete from t2;
set timestamp=1000072000;
insert into t2 values (current_timestamp), (current_date), (current_time);
select * from t2;
t
2001-09-09 23:46:40
2001-09-09
23:46:40
delete from t2;
insert into t2 values (from_unixtime(1000000000)),
(unix_timestamp('2001-09-09 03:46:40'));
select * from t2;
t
2001-09-09 03:46:40
1000000000
select * from t2;
t
2001-09-09 03:46:40
1000000000
set global time_zone='MET';
delete from t2;
set time_zone='UTC';
insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone));
insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'));
select * from t2;
t
2003-12-31 23:00:00
2005-01-01 08:00:00
select * from t2;
t
2003-12-31 23:00:00
2005-01-01 08:00:00
drop table t1, t2;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
create table t1(n char(30));
set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
set @n1:=null;
set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
insert into t1 values (@i1), (@i2), (@i3), (@i4);
insert into t1 values (@r1), (@r2);
insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
insert into t1 values (@n1);
insert into t1 values (@n2);
insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
insert into t1 values (@a+(@b:=@a+1));
set @q:='abc';
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
set @a:=5;
insert into t1 values (@a),(@a);
select * from t1 where n = '<nonexistant>';
n
insert into t1 values (@a),(@a),(@a*5);
select * from t1;
n
12345678901234
-12345678901234
0
-1
12.5
-12.5
This is a test
abc'def
abc\def
abc'def
NULL
NULL
0
1
2
5
abc
abcn1
abcn1n2
5
5
NULL
NULL
NULL
select * from t1;
n
12345678901234
-12345678901234
0
-1
12.5
-12.5
This is a test
abc'def
abc\def
abc'def
NULL
NULL
0
1
2
5
abc
abcn1
abcn1n2
5
5
NULL
NULL
NULL
drop table t1;
stop slave;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop table if exists t1,v1;
drop view if exists t1,v1;
reset master;
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
insert into v1 values (2);
select * from v1 order by a;
a
1
2
select * from v1 order by a;
a
1
2
update v1 set a=3 where a=1;
select * from v1 order by a;
a
2
3
select * from v1 order by a;
a
2
3
delete from v1 where a=2;
select * from v1 order by a;
a
3
select * from v1 order by a;
a
3
alter view v1 as select a as b from t1;
select * from v1 order by 1;
b
3
drop view v1;
select * from v1 order by a;
ERROR 42S02: Table 'test.v1' doesn't exist
drop table t1;
show binlog events limit 1,100;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Query 1 # use `test`; create table t1 (a int)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (1)
slave-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECURITY DEFINER VIEW v1 AS select a from t1
slave-bin.000001 # Query 1 # use `test`; insert into v1 values (2)
slave-bin.000001 # Query 1 # use `test`; update v1 set a=3 where a=1
slave-bin.000001 # Query 1 # use `test`; delete from v1 where a=2
slave-bin.000001 # Query 1 # use `test`; ALTER ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECURITY DEFINER VIEW v1 AS select a as b from t1
slave-bin.000001 # Query 1 # use `test`; drop view v1
slave-bin.000001 # Query 1 # use `test`; drop table t1
...@@ -9,7 +9,7 @@ create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n)); ...@@ -9,7 +9,7 @@ create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n)); create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
select @@time_zone; select @@time_zone;
@@time_zone @@time_zone
Europe/Moscow Japan
select @@time_zone; select @@time_zone;
@@time_zone @@time_zone
Europe/Moscow Europe/Moscow
...@@ -23,10 +23,10 @@ t n ...@@ -23,10 +23,10 @@ t n
2004-06-11 09:39:02 4 2004-06-11 09:39:02 4
select * from t1; select * from t1;
t n t n
2005-01-01 00:00:00 1 2005-01-01 06:00:00 1
2005-06-11 09:39:02 2 2005-06-11 14:39:02 2
2004-01-01 00:00:00 3 2004-01-01 06:00:00 3
2004-06-11 09:39:02 4 2004-06-11 14:39:02 4
delete from t1; delete from t1;
set time_zone='Europe/Moscow'; set time_zone='Europe/Moscow';
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL); insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
...@@ -39,22 +39,6 @@ select * from t1; ...@@ -39,22 +39,6 @@ select * from t1;
t n t n
2004-01-01 00:00:00 5 2004-01-01 00:00:00 5
2004-06-11 09:39:02 6 2004-06-11 09:39:02 6
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
use test;
SET TIMESTAMP=100000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
SET TIMESTAMP=100000000;
create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
SET TIMESTAMP=100000000;
delete from t1;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
delete from t1; delete from t1;
set time_zone='UTC'; set time_zone='UTC';
load data infile '../../std_data/rpl_timezone2.dat' into table t1; load data infile '../../std_data/rpl_timezone2.dat' into table t1;
......
...@@ -6,6 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; ...@@ -6,6 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
drop table if exists t1,v1; drop table if exists t1,v1;
drop view if exists t1,v1; drop view if exists t1,v1;
reset master;
create table t1 (a int); create table t1 (a int);
insert into t1 values (1); insert into t1 values (1);
create view v1 as select a from t1; create view v1 as select a from t1;
......
...@@ -23,6 +23,4 @@ subselect : Bug#15706 ...@@ -23,6 +23,4 @@ subselect : Bug#15706
type_time : Bug#15805 type_time : Bug#15805
#rpl000002 : Bug#15920 Temporary tables are not binlogged in SBR #rpl000002 : Bug#15920 Temporary tables are not binlogged in SBR
ps_7ndb : Bug#15923 Core dump in RBR mode when executing test suite ps_7ndb : Bug#15923 Core dump in RBR mode when executing test suite
#sp_trans : Bug#15924 Code dump in RBR mode when executing test suite rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
mysqlslap : Bug#16167
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
# #
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc --source include/master-slave.inc
let $engine_type= "InnoDB"; let $engine_type= "InnoDB";
-- source extra/rpl_tests/rpl_ddl.test -- source extra/rpl_tests/rpl_ddl.test
...@@ -7,20 +7,19 @@ ...@@ -7,20 +7,19 @@
connection master; connection master;
create table t1 (a int primary key); create table t1 (a int primary key);
create table t4 (a int primary key);
# generate an error that goes to the binlog # generate an error that goes to the binlog
--error 1062 --error 1062
insert into t1 values (1),(1); insert into t1 values (1),(1);
insert into t4 values (1),(2);
save_master_pos; save_master_pos;
connection slave; connection slave;
# as the t1 table is ignored on the slave, the slave should be able to sync # as the t1 table is ignored on the slave, the slave should be able to sync
sync_with_master; sync_with_master;
# The port number is different when doing the release build with
# Do-compile, hence we have to replace the port number here accordingly
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
# check that the table has been ignored, because otherwise the test is nonsense # check that the table has been ignored, because otherwise the test is nonsense
show tables like 't1'; show tables like 't1';
show tables like 't4';
SELECT * FROM test.t4;
connection master; connection master;
drop table t1; drop table t1;
save_master_pos; save_master_pos;
...@@ -46,17 +45,20 @@ real_sleep 2; ...@@ -46,17 +45,20 @@ real_sleep 2;
select (@id := id) - id from t3; select (@id := id) - id from t3;
kill @id; kill @id;
drop table t2,t3; drop table t2,t3;
insert into t4 values (3),(4);
connection master; connection master;
--error 0,1053,2013 --error 0,1053,2013
reap; reap;
connection master1; connection master1;
--replace_column 2 # 5 #
show binlog events from 102;
save_master_pos; save_master_pos;
connection slave; connection slave;
# SQL slave thread should not have stopped (because table of the killed
# query is in the ignore list).
sync_with_master; sync_with_master;
SELECT * FROM test.t4;
connection master1;
DROP TABLE test.t4;
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests # End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed # Adding comment for force manual merge 5.0 -> wl1012. delete me if needed
# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
# exist.
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
######################################################
# Change Author: JBM
# Change Date: 2005-12-22
# Change: Test rewritten to remove show binlog events
# and to test the option better + Cleanup
######################################################
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
connection master;
# 'test' database should be ignored by the slave
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
SELECT COUNT(*) FROM test.t1;
# 'mysqltest' database should NOT be ignored by the slave
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
# Now lets check the slave to see what we have :-)
save_master_pos;
connection slave;
sync_with_master;
SHOW DATABASES;
USE test;
SHOW TABLES;
USE mysqltest;
SHOW TABLES;
SELECT COUNT(*) FROM mysqltest.t1;
#show binlog events;
connection master;
DROP DATABASE mysqltest;
DROP TABLE test.t1;
# End of test
# Requires statement logging # Requires row base logging
-- source include/have_binlog_format_row.inc -- source include/have_binlog_format_row.inc
-- source extra/rpl_tests/rpl_log.test -- source extra/rpl_tests/rpl_log.test
# TBF - difference in row level logging
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest1;
--enable_warnings
create database mysqltest1;
use mysqltest1;
create table t1 (a int);
insert into t1 values(9);
select * from mysqltest1.t1;
sync_slave_with_master;
show databases like 'mysqltest1'; # should be empty
select * from test.t1;
# cleanup
connection master;
drop table t1;
drop database mysqltest1;
sync_slave_with_master;
#
# BUG#6353:
# Option --replicate-rewrite-db should work together with LOAD DATA INFILE
#
connection slave;
--disable_warnings
drop database if exists rewrite;
--enable_warnings
create database rewrite;
connection master;
use test;
create table t1 (a date, b date, c date not null, d date);
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
sync_slave_with_master;
connection slave;
select * from rewrite.t1;
connection master;
truncate table t1;
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
sync_slave_with_master;
connection slave;
select * from rewrite.t1;
connection master;
drop table t1;
create table t1 (a text, b text);
load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
sync_slave_with_master;
connection slave;
select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
connection master;
drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
sync_slave_with_master;
connection slave;
select * from rewrite.t1;
connection master;
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
sync_slave_with_master;
connection slave;
# The empty line last comes from the end line field in the file
select * from rewrite.t1;
drop database rewrite;
connection master;
drop table t1;
--default-time-zone=Europe/Moscow
# row-based and statement binlog difference in result files
-- source include/have_binlog_format_row.inc
-- source extra/rpl_tests/rpl_user_variables.test
# NYI - row-based cannot use CREATE ... SELECT
--source include/have_binlog_format_row.inc
source include/master-slave.inc;
--disable_warnings
drop table if exists t1,v1;
drop view if exists t1,v1;
sync_slave_with_master;
--enable_warnings
#
# Check that createion drop of view is replicated, also check replication of
# updating of view
#
connection master;
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
insert into v1 values (2);
select * from v1 order by a;
sync_slave_with_master;
# view already have to be on slave
select * from v1 order by a;
connection master;
update v1 set a=3 where a=1;
select * from v1 order by a;
sync_slave_with_master;
select * from v1 order by a;
connection master;
delete from v1 where a=2;
select * from v1 order by a;
sync_slave_with_master;
select * from v1 order by a;
connection master;
# 'alter view' internally maped to creation, but still check that it works
alter view v1 as select a as b from t1;
sync_slave_with_master;
select * from v1 order by 1;
connection master;
drop view v1;
sync_slave_with_master;
#error, because view have to be removed from slave
-- error 1146
select * from v1 order by a;
connection master;
drop table t1;
sync_slave_with_master;
######################## rpl_ddl.test ########################
# #
# DDL statements (sometimes with implicit COMMIT) executed #
# by the master and it's propagation into the slave #
# #
##############################################################
#
# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
#
# 1. !All! objects to be dropped, renamed, altered ... must be created
# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test
# sequences start.
#
# 2. Never use a test object, which was direct or indirect affected by a
# preceeding test sequence again.
# Except table d1.t1 where ONLY DML is allowed.
#
# If one preceeding test sequence hits a (sometimes not good visible,
# because the sql error code of the statement might be 0) bug
# and these rules are ignored, a following test sequence might earn ugly
# effects like failing 'sync_slave_with_master', crashes of the slave or
# abort of the test case etc..
#
# 3. The assignment of the DDL command to be tested to $my_stmt can
# be a bit difficult. "'" must be avoided, because the test
# routine "include/rpl_stmt_seq.inc" performs a
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
#
--source include/have_innodb.inc
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
let $engine_type= "InnoDB";
-- source extra/rpl_tests/rpl_ddl.test
# Test for
# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave
# still checks that it has the same error as on the master.
# Requires statement logging
-- source include/have_binlog_format_statement.inc
-- source extra/rpl_tests/rpl_err_ignoredtable.test
"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test"
# TBF - difference in row level logging
-- source include/have_binlog_format_statement.inc
# Test of replication of time zones.
# There is currently some bug possibly in prepared statements (this
# test fails with --ps-protocol): sys_var_thd_time_zone::value_ptr()
# is called only at prepare time, not at execution time. So,
# thd->time_zone_used is not equal to 1 (it is back to 0, because of
# reset_thd_for_next_command called at execution time), so the
# timezone used in CONVERT_TZ is not binlogged. To debug (by Guilhem
# and possibly Konstantin).
--disable_ps_protocol
source include/master-slave.inc;
# Some preparations
let $VERSION=`select version()`;
set timestamp=100000000; # for fixed output of mysqlbinlog
create table t1 (t timestamp);
create table t2 (t char(32));
connection slave;
select @@time_zone;
#
# Let us check how well replication works when we are saving datetime
# value in TIMESTAMP field.
#
connection master;
select @@time_zone;
insert into t1 values ('20050101000000'), ('20050611093902');
set time_zone='UTC';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
sync_slave_with_master;
set time_zone='UTC';
select * from t1;
# Let us check also that setting of time_zone back to default also works
# well
connection master;
delete from t1;
set time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
sync_slave_with_master;
set time_zone='Europe/Moscow';
select * from t1;
connection master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
# Let us check with LOAD DATA INFILE
# (we do it after mysqlbinlog because the temp files names are not constant)
connection master;
delete from t1;
set time_zone='UTC';
load data infile '../../std_data/rpl_timezone.dat' into table t1;
select * from t1;
sync_slave_with_master;
set time_zone='UTC';
select * from t1;
set time_zone='Europe/Moscow';
# Put back values of before the LOAD
connection master;
set time_zone='Europe/Moscow';
delete from t1;
insert into t1 values ('20040101000000'), ('20040611093902');
#
# Now let us check how well we replicate statments reading TIMESTAMP fields
# (We should see the same data on master and on slave but it should differ
# from originally inserted)
#
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
sync_slave_with_master;
select * from t2;
#
# Now let us check how well we replicate various CURRENT_* functions
#
connection master;
delete from t2;
set timestamp=1000072000;
insert into t2 values (current_timestamp), (current_date), (current_time);
sync_slave_with_master;
select * from t2;
#
# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions.
#
connection master;
delete from t2;
insert into t2 values (from_unixtime(1000000000)),
(unix_timestamp('2001-09-09 03:46:40'));
select * from t2;
sync_slave_with_master;
# We should get same result on slave as on master
select * from t2;
#
# Let us check that we are allowing to set global time_zone with
# replication
#
connection master;
set global time_zone='MET';
#
# Let us see if CONVERT_TZ(@@time_zone) replicates
#
delete from t2;
set time_zone='UTC';
insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone));
insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'));
select * from t2;
sync_slave_with_master;
select * from t2;
# Clean up
connection master;
drop table t1, t2;
sync_slave_with_master;
# End of 4.1 tests
# row-based and statement binlog difference in result files
-- source include/have_binlog_format_statement.inc
-- source extra/rpl_tests/rpl_user_variables.test
# End of 4.1 tests
# TBF - difference in row level logging
-- source include/have_binlog_format_row.inc
# Test of replication of time zones. # Test of replication of time zones.
# There is currently some bug possibly in prepared statements (this # There is currently some bug possibly in prepared statements (this
...@@ -51,8 +48,11 @@ sync_slave_with_master; ...@@ -51,8 +48,11 @@ sync_slave_with_master;
set time_zone='Europe/Moscow'; set time_zone='Europe/Moscow';
select * from t1; select * from t1;
connection master; connection master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR # Change Author: JBM
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001 # Change Date: 2005-12-22
# Change: Comment out the exec of the binlog so test works for both SBR and RBR
#--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
#--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
# Let us check with LOAD DATA INFILE # Let us check with LOAD DATA INFILE
# (we do it after mysqlbinlog because the temp files names are not constant) # (we do it after mysqlbinlog because the temp files names are not constant)
...@@ -127,3 +127,4 @@ select * from t2; ...@@ -127,3 +127,4 @@ select * from t2;
connection master; connection master;
drop table t1, t2; drop table t1, t2;
sync_slave_with_master; sync_slave_with_master;
# row-based and statement binlog difference in result files
# #
# Test of replicating user variables # Test of replicating user variables
# #
......
# NYI - row-based cannot use CREATE ... SELECT # NYI - row-based cannot use CREATE ... SELECT
--source include/have_binlog_format_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
--disable_warnings --disable_warnings
...@@ -10,7 +9,7 @@ reset master; ...@@ -10,7 +9,7 @@ reset master;
--enable_warnings --enable_warnings
# #
# Check that createion drop of view is replicated, also check replication of # Check that creation drop of view is replicated, also check replication of
# updating of view # updating of view
# #
connection master; connection master;
...@@ -46,5 +45,8 @@ select * from v1 order by a; ...@@ -46,5 +45,8 @@ select * from v1 order by a;
connection master; connection master;
drop table t1; drop table t1;
sync_slave_with_master; sync_slave_with_master;
--replace_column 2 # 5 # # Change Author: JBM
show binlog events limit 1,100; # Change Date: 2005-12-22
# Change: Commented out binlog events to work with SBR and RBR
#--replace_column 2 # 5 #
# show binlog events limit 1,100;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment