1
###################################
3
# Test of replicating user variables
5
###################################
7
-- source include/master-slave.inc
8
# Disable PS as the log positions differs
12
# Clean up old slave's binlogs.
13
# The slave is started with --log-slave-updates
14
# and this test does SHOW BINLOG EVENTS on the slave's
15
# binlog. But previous tests can influence the current test's
16
# binlog (e.g. a temporary table in the previous test has not
17
# been explicitly deleted, or it has but the slave hasn't had
18
# enough time to catch it before STOP SLAVE,
19
# and at the beginning of the current
20
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
21
# We wait for the slave to have written all he wants to the binlog
22
# (otherwise RESET MASTER may come too early).
29
create table t1(n char(30));
30
set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
31
set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
33
set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
34
insert into t1 values (@i1), (@i2), (@i3), (@i4);
35
insert into t1 values (@r1), (@r2);
36
insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
37
insert into t1 values (@n1);
38
insert into t1 values (@n2); # not explicitely set before
39
insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
40
insert into t1 values (@a+(@b:=@a+1));
42
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
44
insert into t1 values (@a),(@a);
45
# To flush the pending event, we add the following statement. RBR can
46
# concatenate the result of several statements, which SBR cannot.
47
select * from t1 where n = '<nonexistant>';
48
connection master1; # see if variable is reset in binlog when thread changes
49
insert into t1 values (@a),(@a),(@a*5);
50
SELECT * FROM t1 ORDER BY n;
51
sync_slave_with_master;
52
SELECT * FROM t1 ORDER BY n;
54
insert into t1 select * FROM (select @var1 union select @var2) AS t2;
56
sync_slave_with_master;