| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT'); |
| 4 |
create table t1(id int, i int, r1 int, r2 int, p varchar(100)); |
| 5 |
insert into t1 values(1, connection_id(), 0, 0, ""); |
| 6 |
insert into t1 values(2, 0, rand()*1000, rand()*1000, ""); |
| 7 |
set sql_log_bin=0; |
| 8 |
insert into t1 values(6, 0, rand(), rand(), ""); |
| 9 |
delete from t1 where id=6; |
| 10 |
set sql_log_bin=1; |
| 11 |
insert into t1 values(3, 0, 0, 0, password('does_this_work?')); |
| 12 |
insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?')); |
| 13 |
select * into outfile 'rpl_misc_functions.outfile' from t1; |
| 14 |
connection slave; |
| 15 |
create temporary table t2 like t1; |
| 16 |
load data local infile 'MYSQLD_DATADIR/test/rpl_misc_functions.outfile' into table t2; |
| 17 |
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p); |
| 18 |
id i r1 r2 p id i r1 r2 p |
| 19 |
connection master; |
| 20 |
drop table t1; |
| 21 |
DROP TABLE IF EXISTS t1; |
| 22 |
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, |
| 23 |
col_a DOUBLE DEFAULT NULL); |
| 24 |
CREATE PROCEDURE test_replication_sp1() |
| 25 |
BEGIN |
| 26 |
INSERT INTO t1 (col_a) VALUES (rand()), (rand()); |
| 27 |
INSERT INTO t1 (col_a) VALUES (rand()); |
| 28 |
END| |
| 29 |
CREATE PROCEDURE test_replication_sp2() |
| 30 |
BEGIN |
| 31 |
CALL test_replication_sp1(); |
| 32 |
CALL test_replication_sp1(); |
| 33 |
END| |
| 34 |
CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC |
| 35 |
BEGIN |
| 36 |
RETURN (rand() + rand()); |
| 37 |
END| |
| 38 |
CALL test_replication_sp1(); |
| 39 |
CALL test_replication_sp2(); |
| 40 |
INSERT INTO t1 (col_a) VALUES (test_replication_sf()); |
| 41 |
INSERT INTO t1 (col_a) VALUES (test_replication_sf()); |
| 42 |
INSERT INTO t1 (col_a) VALUES (test_replication_sf()); |
| 43 |
connection slave; |
| 44 |
select * from t1 into outfile "../../tmp/t1_slave.txt"; |
| 45 |
connection master; |
| 46 |
create temporary table t1_slave select * from t1 where 1=0; |
| 47 |
load data infile '../../tmp/t1_slave.txt' into table t1_slave; |
| 48 |
select count(*) into @aux from t1 join t1_slave using (id) |
| 49 |
where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; |
| 50 |
SELECT @aux; |
| 51 |
@aux |
| 52 |
12 |
| 53 |
connection master; |
| 54 |
DROP TABLE t1, t1_slave; |
| 55 |
DROP PROCEDURE test_replication_sp1; |
| 56 |
DROP PROCEDURE test_replication_sp2; |
| 57 |
DROP FUNCTION test_replication_sf; |
| 58 |
connection slave; |
| 59 |
include/rpl_end.inc |