rpl_user_variables.test 1.88 KB
Newer Older
1 2 3
#
# Test of replicating user variables
#
4
-- source include/master-slave.inc
5 6 7
# Disable PS as the log positions differs
--disable_ps_protocol

8

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# Clean up old slave's binlogs.
# The slave is started with --log-slave-updates
# and this test does SHOW BINLOG EVENTS on the slave's
# binlog. But previous tests can influence the current test's
# binlog (e.g. a temporary table in the previous test has not
# been explicitly deleted, or it has but the slave hasn't had
# enough time to catch it before STOP SLAVE, 
# and at the beginning of the current
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
# We wait for the slave to have written all he wants to the binlog
# (otherwise RESET MASTER may come too early).
save_master_pos;
connection slave;
sync_with_master;
reset master;
connection master;

26 27 28 29 30 31 32 33 34
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);
35
insert into t1 values (@n2); # not explicitely set before
36 37 38 39 40 41
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);
42 43 44
# To flush the pending event, we add the following statement. RBR can
# concatenate the result of several statements, which SBR cannot.
select * from t1 where n = '<nonexistant>';
45 46 47
connection master1; # see if variable is reset in binlog when thread changes
insert into t1 values (@a),(@a),(@a*5);
select * from t1;
48
sync_slave_with_master;
49 50 51
select * from t1;
connection master;
drop table t1;
52
sync_slave_with_master;
53
stop slave;