mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 06:22:28 +01:00
19c380aaff
Non-transactional updates that take place inside a transaction present problems for logging because they are visible to other clients before the transaction is committed, and they are not rolled back even if the transaction is rolled back. It is not always possible to log correctly in statement format when both transactional and non-transactional tables are used in the same transaction. In the current patch, we ensure that such scenario is completely safe under the ROW and MIXED modes.
117 lines
2 KiB
Text
117 lines
2 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;
|
|
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
|
create user test;
|
|
create table t1(a int) engine=InnoDB;
|
|
create table t2(a int) engine=MyISAM;
|
|
insert into t1 values(1001);
|
|
insert into t2 values(2001);
|
|
set global read_only=1;
|
|
select @@read_only;
|
|
@@read_only
|
|
1
|
|
select * from t1;
|
|
a
|
|
1001
|
|
select * from t2;
|
|
a
|
|
2001
|
|
select @@read_only;
|
|
@@read_only
|
|
0
|
|
select * from t1;
|
|
a
|
|
1001
|
|
select * from t2;
|
|
a
|
|
2001
|
|
set global read_only=0;
|
|
BEGIN;
|
|
insert into t1 values(1002);
|
|
insert into t2 values(2002);
|
|
BEGIN;
|
|
insert into t1 values(1003);
|
|
insert into t2 values(2003);
|
|
set global read_only=1;
|
|
COMMIT;
|
|
COMMIT;
|
|
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
|
|
set global read_only=0;
|
|
insert into t1 values(1004);
|
|
insert into t2 values(2004);
|
|
select * from t1;
|
|
a
|
|
1001
|
|
1002
|
|
1004
|
|
select * from t2;
|
|
a
|
|
2001
|
|
2002
|
|
2003
|
|
2004
|
|
select * from t1;
|
|
a
|
|
1001
|
|
1002
|
|
1004
|
|
select * from t2;
|
|
a
|
|
2001
|
|
2002
|
|
2003
|
|
2004
|
|
set global read_only=1;
|
|
select @@read_only;
|
|
@@read_only
|
|
1
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
show create table t2;
|
|
Table Create Table
|
|
t2 CREATE TABLE `t2` (
|
|
`a` int(11) DEFAULT NULL
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
insert into t1 values(1005);
|
|
insert into t2 values(2005);
|
|
select * from t1;
|
|
a
|
|
1001
|
|
1002
|
|
1004
|
|
1005
|
|
select * from t2;
|
|
a
|
|
2001
|
|
2002
|
|
2003
|
|
2004
|
|
2005
|
|
select * from t1;
|
|
a
|
|
1001
|
|
1002
|
|
1004
|
|
1005
|
|
select * from t2;
|
|
a
|
|
2001
|
|
2002
|
|
2003
|
|
2004
|
|
2005
|
|
insert into t1 values(1006);
|
|
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
|
|
insert into t2 values(2006);
|
|
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
|
|
drop user test;
|
|
drop table t1;
|
|
drop table t2;
|
|
set global read_only=0;
|