mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
fix for BUG#1331: "Unexistent user variable is not replicated".
When an update query is to be written to the binlog, and it reads unset user variables (example: INSERT INTO t VALUEs(@a) where @a does not exist), we create the variable like if it had been set with SET before, and we loop (i.e. we redo the steps of logging, now that the variable exists). mysql-test/r/rpl_user_variables.result: result update. mysql-test/t/rpl_user_variables.test: test to see if unset user variables are written to the binlog sql/item_func.cc: When an update query is to be written to the binlog, and it reads unset user variables (example: INSERT INTO t VALUEs(@a) where @a does not exist), we create the variable like if it had been set with SET before, and we loop (i.e. we redo the steps of logging, now that the variable exists).
This commit is contained in:
@ -29,13 +29,16 @@ 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 (@n2); # not explicitely set before
|
||||
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);
|
||||
connection master1; # see if variable is reset in binlog when thread changes
|
||||
insert into t1 values (@a),(@a),(@a*5);
|
||||
select * from t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
Reference in New Issue
Block a user