mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
d6f94b062c
of statement breaks binlog. There were two problems discovered by this bug: 1. Default (current) database is not fixed at the creation time. That leads to wrong output of DATABASE() function. 2. Database attributes (@@collation_database) are not fixed at the creation time. That leads to wrong resultset. Binlog breakage and Query Cache wrong output happened because of the first problem. The fix is to remember the current database at the PREPARE-time and set it each time at EXECUTE.
69 lines
1.6 KiB
Text
69 lines
1.6 KiB
Text
stop slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
reset master;
|
|
reset slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
start slave;
|
|
drop table if exists t1;
|
|
create table t1(n char(30));
|
|
prepare stmt1 from 'insert into t1 values (?)';
|
|
set @var1= "from-master-1";
|
|
execute stmt1 using @var1;
|
|
set @var1= "from-master-2-'',";
|
|
execute stmt1 using @var1;
|
|
SELECT * FROM t1 ORDER BY n;
|
|
n
|
|
from-master-1
|
|
from-master-2-'',
|
|
set @var2= 'insert into t1 values (concat("from-var-", ?))';
|
|
prepare stmt2 from @var2;
|
|
set @var1='from-master-3';
|
|
execute stmt2 using @var1;
|
|
SELECT * FROM t1 ORDER BY n;
|
|
n
|
|
from-master-1
|
|
from-master-2-'',
|
|
from-var-from-master-3
|
|
drop table t1;
|
|
stop slave;
|
|
|
|
########################################################################
|
|
#
|
|
# BUG#25843: Changing default database between PREPARE and EXECUTE of
|
|
# statement breaks binlog.
|
|
#
|
|
########################################################################
|
|
|
|
#
|
|
# Check that binlog is filled properly.
|
|
#
|
|
|
|
CREATE DATABASE mysqltest1;
|
|
CREATE TABLE t1(c INT);
|
|
|
|
RESET MASTER;
|
|
RESET SLAVE;
|
|
|
|
PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(1)';
|
|
|
|
EXECUTE stmt_d_1;
|
|
|
|
use mysqltest1;
|
|
|
|
EXECUTE stmt_d_1;
|
|
|
|
FLUSH LOGS;
|
|
|
|
SHOW BINLOG EVENTS FROM 106;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
slave-bin.000001 106 Query 2 193 use `test`; INSERT INTO t1 VALUES(1)
|
|
slave-bin.000001 193 Query 2 280 use `test`; INSERT INTO t1 VALUES(1)
|
|
slave-bin.000001 280 Rotate 2 323 slave-bin.000002;pos=4
|
|
|
|
DROP DATABASE mysqltest1;
|
|
|
|
use test;
|
|
|
|
########################################################################
|
|
reset master;
|
|
reset slave;
|