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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
30376d28
Commit
30376d28
authored
Nov 28, 2010
by
Browse files
Options
Browse Files
Download
Plain Diff
Manual merge
parents
d695e392
abb201c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
179 additions
and
0 deletions
+179
-0
mysql-test/extra/binlog_tests/binlog.test
mysql-test/extra/binlog_tests/binlog.test
+53
-0
mysql-test/suite/binlog/r/binlog_row_binlog.result
mysql-test/suite/binlog/r/binlog_row_binlog.result
+59
-0
mysql-test/suite/binlog/r/binlog_stm_binlog.result
mysql-test/suite/binlog/r/binlog_stm_binlog.result
+59
-0
sql/sql_binlog.cc
sql/sql_binlog.cc
+8
-0
No files found.
mysql-test/extra/binlog_tests/binlog.test
View file @
30376d28
...
...
@@ -304,5 +304,58 @@ BINLOG '
SHOW
BINLOG
EVENTS
;
DROP
TABLE
t1
;
--
echo
--
echo
# BUG#54903 BINLOG statement toggles session variables
--
echo
# ----------------------------------------------------------------------
--
echo
# This test verify that BINLOG statement doesn't change current session's
--
echo
# variables foreign_key_checks and unique_checks.
--
echo
CREATE
TABLE
t1
(
c1
INT
KEY
);
SET
@@
SESSION
.
foreign_key_checks
=
ON
;
SET
@@
SESSION
.
unique_checks
=
ON
;
--
echo
# INSERT INTO t1 VALUES (1)
--
echo
# foreign_key_checks=0 and unique_checks=0
BINLOG
'
dfLtTBMBAAAAKQAAANcAAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA==
'
;
SELECT
*
FROM
t1
;
--
echo
# Their values should be ON
SHOW
SESSION
VARIABLES
LIKE
"%_checks"
;
--
echo
SET
@@
SESSION
.
foreign_key_checks
=
OFF
;
SET
@@
SESSION
.
unique_checks
=
OFF
;
--
echo
# INSERT INTO t1 VALUES(2)
--
echo
# foreign_key_checks=1 and unique_checks=1
BINLOG
'
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
'
;
SELECT
*
FROM
t1
;
--
echo
# Their values should be OFF
SHOW
SESSION
VARIABLES
LIKE
"%_checks"
;
--
echo
# INSERT INTO t1 VALUES(2)
--
echo
# foreign_key_checks=1 and unique_checks=1
--
echo
# It should not change current session's variables, even error happens
--
error
1062
BINLOG
'
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
'
;
SELECT
*
FROM
t1
;
--
echo
# Their values should be OFF
SHOW
SESSION
VARIABLES
LIKE
"%_checks"
;
DROP
TABLE
t1
;
disconnect
fresh
;
mysql-test/suite/binlog/r/binlog_row_binlog.result
View file @
30376d28
...
...
@@ -1330,3 +1330,62 @@ Log_name Pos Event_type Server_id End_log_pos Info
# # Write_rows 1 # table_id: # flags: STMT_END_F
# # Query 1 # COMMIT
DROP TABLE t1;
# BUG#54903 BINLOG statement toggles session variables
# ----------------------------------------------------------------------
# This test verify that BINLOG statement doesn't change current session's
# variables foreign_key_checks and unique_checks.
CREATE TABLE t1 (c1 INT KEY);
SET @@SESSION.foreign_key_checks= ON;
SET @@SESSION.unique_checks= ON;
# INSERT INTO t1 VALUES (1)
# foreign_key_checks=0 and unique_checks=0
BINLOG '
dfLtTBMBAAAAKQAAANcAAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA==
';
SELECT * FROM t1;
c1
1
# Their values should be ON
SHOW SESSION VARIABLES LIKE "%_checks";
Variable_name Value
foreign_key_checks ON
unique_checks ON
SET @@SESSION.foreign_key_checks= OFF;
SET @@SESSION.unique_checks= OFF;
# INSERT INTO t1 VALUES(2)
# foreign_key_checks=1 and unique_checks=1
BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
';
SELECT * FROM t1;
c1
1
2
# Their values should be OFF
SHOW SESSION VARIABLES LIKE "%_checks";
Variable_name Value
foreign_key_checks OFF
unique_checks OFF
# INSERT INTO t1 VALUES(2)
# foreign_key_checks=1 and unique_checks=1
# It should not change current session's variables, even error happens
BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
';
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
SELECT * FROM t1;
c1
1
2
# Their values should be OFF
SHOW SESSION VARIABLES LIKE "%_checks";
Variable_name Value
foreign_key_checks OFF
unique_checks OFF
DROP TABLE t1;
mysql-test/suite/binlog/r/binlog_stm_binlog.result
View file @
30376d28
...
...
@@ -820,3 +820,62 @@ Log_name Pos Event_type Server_id End_log_pos Info
# # Write_rows 1 # table_id: # flags: STMT_END_F
# # Query 1 # COMMIT
DROP TABLE t1;
# BUG#54903 BINLOG statement toggles session variables
# ----------------------------------------------------------------------
# This test verify that BINLOG statement doesn't change current session's
# variables foreign_key_checks and unique_checks.
CREATE TABLE t1 (c1 INT KEY);
SET @@SESSION.foreign_key_checks= ON;
SET @@SESSION.unique_checks= ON;
# INSERT INTO t1 VALUES (1)
# foreign_key_checks=0 and unique_checks=0
BINLOG '
dfLtTBMBAAAAKQAAANcAAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA==
';
SELECT * FROM t1;
c1
1
# Their values should be ON
SHOW SESSION VARIABLES LIKE "%_checks";
Variable_name Value
foreign_key_checks ON
unique_checks ON
SET @@SESSION.foreign_key_checks= OFF;
SET @@SESSION.unique_checks= OFF;
# INSERT INTO t1 VALUES(2)
# foreign_key_checks=1 and unique_checks=1
BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
';
SELECT * FROM t1;
c1
1
2
# Their values should be OFF
SHOW SESSION VARIABLES LIKE "%_checks";
Variable_name Value
foreign_key_checks OFF
unique_checks OFF
# INSERT INTO t1 VALUES(2)
# foreign_key_checks=1 and unique_checks=1
# It should not change current session's variables, even error happens
BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
';
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
SELECT * FROM t1;
c1
1
2
# Their values should be OFF
SHOW SESSION VARIABLES LIKE "%_checks";
Variable_name Value
foreign_key_checks OFF
unique_checks OFF
DROP TABLE t1;
sql/sql_binlog.cc
View file @
30376d28
...
...
@@ -60,6 +60,13 @@ void mysql_client_binlog_statement(THD* thd)
}
size_t
decoded_len
=
base64_needed_decoded_length
(
coded_len
);
/*
option_bits will be changed when applying the event. But we don't expect
it be changed permanently after BINLOG statement, so backup it first.
It will be restored at the end of this function.
*/
ulonglong
thd_options
=
thd
->
variables
.
option_bits
;
/*
Allocation
*/
...
...
@@ -246,6 +253,7 @@ void mysql_client_binlog_statement(THD* thd)
my_ok
(
thd
);
end:
thd
->
variables
.
option_bits
=
thd_options
;
rli
->
slave_close_thread_tables
(
thd
);
my_free
(
buf
);
DBUG_VOID_RETURN
;
...
...
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