# name : bug860910.patch # maintainer : Alexey # # Fixes LP bug #860910 / MySQL bug #62557 # --- /dev/null +++ b/mysql-test/suite/rpl/r/percona_bug860910.result @@ -0,0 +1,17 @@ +*** Set up master (server_1) <-> master (server_2) replication *** +include/rpl_init.inc [topology=1->2->1] + +SELECT @@global.log_slave_updates; +@@global.log_slave_updates +1 +SELECT @@global.log_slave_updates; +@@global.log_slave_updates +1 +CREATE TABLE t1(a INT); +SET @var:=0; +INSERT INTO t1 VALUES (@var); +INSERT INTO t1 VALUES (1); +DROP TABLE t1; +include/rpl_sync.inc +include/check_slave_param.inc [Exec_Master_Log_Pos] +include/rpl_end.inc --- /dev/null +++ b/mysql-test/suite/rpl/t/percona_bug860910.cnf @@ -0,0 +1,8 @@ +!include ../my.cnf + +[mysqld.1] +log-slave-updates + +[mysqld.2] +log-slave-updates + --- /dev/null +++ b/mysql-test/suite/rpl/t/percona_bug860910.test @@ -0,0 +1,38 @@ +######################################################################## +# Bug #860910: SHOW SLAVE STATUS gives wrong output with master-master +# and using SET uservars +######################################################################## + +--echo *** Set up master (server_1) <-> master (server_2) replication *** +--let $rpl_topology= 1->2->1 +--source include/rpl_init.inc +--echo + +--connection server_1 +SELECT @@global.log_slave_updates; + +--connection server_2 +SELECT @@global.log_slave_updates; + +--connection server_1 +CREATE TABLE t1(a INT); +SET @var:=0; +INSERT INTO t1 VALUES (@var); +INSERT INTO t1 VALUES (1); + +DROP TABLE t1; + +# The following would hang with the bug not fixed due to incorrect +# Exec_Master_Log_Pos +--source include/rpl_sync.inc + +--connection server_2 +--let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1) + +--connection server_1 +--let $slave_param= Exec_Master_Log_Pos +--let $slave_param_value= $master_log_pos +--source include/check_slave_param.inc + +# Cleanup +--source include/rpl_end.inc --- a/sql/log.cc +++ b/sql/log.cc @@ -5112,6 +5112,12 @@ user_var_event->type, user_var_event->charset_number, flags); + /* + These User_var_log_events must be logged with event_info's + server_id, rather than the current one. + */ + e.server_id= event_info->server_id; + if (e.write(file)) goto err; if (file == &log_file)