Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
18d22472
Commit
18d22472
authored
Dec 23, 2009
by
Alfranio Correia
Browse files
Options
Browse Files
Download
Plain Diff
merge mysql-5.1-rep+3 --> mysql-5.1-rep+2-delivery1
parents
02f79830
4b615ca9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
198 additions
and
0 deletions
+198
-0
mysql-test/suite/binlog/r/binlog_format_switch_inside_trans.result
...t/suite/binlog/r/binlog_format_switch_inside_trans.result
+90
-0
mysql-test/suite/binlog/t/binlog_format_switch_inside_trans.test
...est/suite/binlog/t/binlog_format_switch_inside_trans.test
+98
-0
sql/set_var.cc
sql/set_var.cc
+8
-0
sql/share/errmsg.txt
sql/share/errmsg.txt
+2
-0
No files found.
mysql-test/suite/binlog/r/binlog_format_switch_inside_trans.result
0 → 100644
View file @
18d22472
set @save_binlog_format= @@global.binlog_format;
create table t1 (a int) engine= myisam;
create table t2 (a int) engine= innodb;
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
SET AUTOCOMMIT=1;
# Test that the session variable 'binlog_format'
# is writable outside a transaction.
set @@session.binlog_format= statement;
SELECT @@session.binlog_format;
@@session.binlog_format
STATEMENT
begin;
# Test that the session variable 'binlog_format' is read-only
# inside a transaction with no preceding updates.
set @@session.binlog_format= mixed;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
insert into t2 values (1);
# Test that the session variable 'binlog_format' is read-only
# inside a transaction with preceding transactional updates.
set @@session.binlog_format= row;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
commit;
begin;
insert into t1 values (2);
# Test that the session variable 'binlog_format' is read-only
# inside a transaction with preceding non-transactional updates.
set @@session.binlog_format= statement;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
commit;
# Test that the session variable 'binlog_format' is writable
# when AUTOCOMMIT=0, before a transaction has started.
set AUTOCOMMIT=0;
set @@session.binlog_format= row;
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
insert into t1 values (4);
# Test that the session variable 'binlog_format' is read-only inside an
# AUTOCOMMIT=0 transaction with preceding non-transactional updates.
set @@session.binlog_format= statement;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
commit;
insert into t2 values (5);
# Test that the session variable 'binlog_format' is read-only inside an
# AUTOCOMMIT=0 transaction with preceding transactional updates.
set @@session.binlog_format= row;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
commit;
begin;
insert into t2 values (6);
# Test that the global variable 'binlog_format' is writable
# inside a transaction.
SELECT @@global.binlog_format;
@@global.binlog_format
ROW
set @@global.binlog_format= statement;
SELECT @@global.binlog_format;
@@global.binlog_format
STATEMENT
commit;
set @@global.binlog_format= @save_binlog_format;
create table t3(a int, b int) engine= innodb;
create table t4(a int) engine= innodb;
create table t5(a int) engine= innodb;
create trigger tr2 after insert on t3 for each row begin
insert into t4(a) values(1);
set @@session.binlog_format= statement;
insert into t4(a) values(2);
insert into t5(a) values(3);
end |
# Test that the session variable 'binlog_format' is read-only
# in sub-statements.
insert into t3(a,b) values(1,1);
ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
drop table t1;
drop table t2;
drop table t3;
drop table t4;
drop table t5;
mysql-test/suite/binlog/t/binlog_format_switch_inside_trans.test
0 → 100644
View file @
18d22472
#
# BUG#47863
# This test verifies if the session variable 'binlog_format'
# is read-only inside a transaction and in sub-statements.
#
source
include
/
have_innodb
.
inc
;
source
include
/
have_binlog_format_row
.
inc
;
set
@
save_binlog_format
=
@@
global
.
binlog_format
;
create
table
t1
(
a
int
)
engine
=
myisam
;
create
table
t2
(
a
int
)
engine
=
innodb
;
SELECT
@@
session
.
binlog_format
;
SET
AUTOCOMMIT
=
1
;
--
echo
# Test that the session variable 'binlog_format'
--
echo
# is writable outside a transaction.
set
@@
session
.
binlog_format
=
statement
;
SELECT
@@
session
.
binlog_format
;
begin
;
--
echo
# Test that the session variable 'binlog_format' is read-only
--
echo
# inside a transaction with no preceding updates.
--
error
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set
@@
session
.
binlog_format
=
mixed
;
insert
into
t2
values
(
1
);
--
echo
# Test that the session variable 'binlog_format' is read-only
--
echo
# inside a transaction with preceding transactional updates.
--
error
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set
@@
session
.
binlog_format
=
row
;
commit
;
begin
;
insert
into
t1
values
(
2
);
--
echo
# Test that the session variable 'binlog_format' is read-only
--
echo
# inside a transaction with preceding non-transactional updates.
--
error
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set
@@
session
.
binlog_format
=
statement
;
commit
;
--
echo
# Test that the session variable 'binlog_format' is writable
--
echo
# when AUTOCOMMIT=0, before a transaction has started.
set
AUTOCOMMIT
=
0
;
set
@@
session
.
binlog_format
=
row
;
SELECT
@@
session
.
binlog_format
;
insert
into
t1
values
(
4
);
--
echo
# Test that the session variable 'binlog_format' is read-only inside an
--
echo
# AUTOCOMMIT=0 transaction with preceding non-transactional updates.
--
error
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set
@@
session
.
binlog_format
=
statement
;
SELECT
@@
session
.
binlog_format
;
commit
;
insert
into
t2
values
(
5
);
--
echo
# Test that the session variable 'binlog_format' is read-only inside an
--
echo
# AUTOCOMMIT=0 transaction with preceding transactional updates.
--
error
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set
@@
session
.
binlog_format
=
row
;
SELECT
@@
session
.
binlog_format
;
commit
;
begin
;
insert
into
t2
values
(
6
);
--
echo
# Test that the global variable 'binlog_format' is writable
--
echo
# inside a transaction.
SELECT
@@
global
.
binlog_format
;
set
@@
global
.
binlog_format
=
statement
;
SELECT
@@
global
.
binlog_format
;
commit
;
set
@@
global
.
binlog_format
=
@
save_binlog_format
;
create
table
t3
(
a
int
,
b
int
)
engine
=
innodb
;
create
table
t4
(
a
int
)
engine
=
innodb
;
create
table
t5
(
a
int
)
engine
=
innodb
;
delimiter
|
;
eval
create
trigger
tr2
after
insert
on
t3
for
each
row
begin
insert
into
t4
(
a
)
values
(
1
);
set
@@
session
.
binlog_format
=
statement
;
insert
into
t4
(
a
)
values
(
2
);
insert
into
t5
(
a
)
values
(
3
);
end
|
delimiter
;
|
--
echo
# Test that the session variable 'binlog_format' is read-only
--
echo
# in sub-statements.
--
error
ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
insert
into
t3
(
a
,
b
)
values
(
1
,
1
);
SELECT
@@
session
.
binlog_format
;
drop
table
t1
;
drop
table
t2
;
drop
table
t3
;
drop
table
t4
;
drop
table
t5
;
sql/set_var.cc
View file @
18d22472
...
@@ -1277,6 +1277,14 @@ void fix_slave_exec_mode(enum_var_type type)
...
@@ -1277,6 +1277,14 @@ void fix_slave_exec_mode(enum_var_type type)
bool
sys_var_thd_binlog_format
::
check
(
THD
*
thd
,
set_var
*
var
)
{
bool
sys_var_thd_binlog_format
::
check
(
THD
*
thd
,
set_var
*
var
)
{
/*
Make the session variable 'binlog_format' read-only inside a transaction.
*/
if
(
thd
->
active_transaction
()
&&
(
var
->
type
==
OPT_SESSION
))
{
my_error
(
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
,
MYF
(
0
));
return
1
;
}
/*
/*
All variables that affect writing to binary log (either format or
All variables that affect writing to binary log (either format or
turning logging on and off) use the same checking. We call the
turning logging on and off) use the same checking. We call the
...
...
sql/share/errmsg.txt
View file @
18d22472
...
@@ -6254,3 +6254,5 @@ ER_SLAVE_CONVERSION_FAILED
...
@@ -6254,3 +6254,5 @@ ER_SLAVE_CONVERSION_FAILED
eng "Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.32s' to type '%-.32s'"
eng "Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.32s' to type '%-.32s'"
ER_SLAVE_CANT_CREATE_CONVERSION
ER_SLAVE_CANT_CREATE_CONVERSION
eng "Can't create conversion table for table '%-.192s.%-.192s'"
eng "Can't create conversion table for table '%-.192s.%-.192s'"
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
eng "Cannot modify @@session.binlog_format inside a transaction"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment