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
108e9ee8
Commit
108e9ee8
authored
Jan 13, 2011
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MBug#702303: Spurious `use` statements in output from mysqlbinlog --rewrite-db="a->b"
parent
acb30953
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
126 additions
and
7 deletions
+126
-7
client/mysqlbinlog.cc
client/mysqlbinlog.cc
+10
-5
mysql-test/r/mysqlbinlog-innodb.result
mysql-test/r/mysqlbinlog-innodb.result
+85
-0
mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
...test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
+0
-2
mysql-test/t/mysqlbinlog-innodb.test
mysql-test/t/mysqlbinlog-innodb.test
+31
-0
No files found.
client/mysqlbinlog.cc
View file @
108e9ee8
...
...
@@ -636,11 +636,16 @@ static bool shall_skip_database(const char *log_dbname)
producing USE statements by corresponding log event print-functions.
*/
void
print_use_stmt
(
PRINT_EVENT_INFO
*
pinfo
,
const
char
*
db
,
size_t
db_len
)
static
void
print_use_stmt
(
PRINT_EVENT_INFO
*
pinfo
,
const
Query_log_event
*
ev
)
{
const
char
*
db
=
ev
->
db
;
const
size_t
db_len
=
ev
->
db_len
;
// pinfo->db is the current db.
// If current db is the same as required db, do nothing.
if
(
!
db
||
!
memcmp
(
pinfo
->
db
,
db
,
db_len
+
1
))
if
((
ev
->
flags
&
LOG_EVENT_SUPPRESS_USE_F
)
||
!
db
||
!
memcmp
(
pinfo
->
db
,
db
,
db_len
+
1
))
return
;
// Current db and required db are different.
...
...
@@ -779,7 +784,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
Query_log_event
*
qe
=
(
Query_log_event
*
)
ev
;
if
(
!
qe
->
is_trans_keyword
()
&&
shall_skip_database
(
qe
->
db
))
goto
end
;
print_use_stmt
(
print_event_info
,
qe
->
db
,
qe
->
db_len
);
print_use_stmt
(
print_event_info
,
qe
);
if
(
opt_base64_output_mode
==
BASE64_OUTPUT_ALWAYS
)
{
if
((
retval
=
write_event_header_and_base64
(
ev
,
result_file
,
...
...
@@ -912,7 +917,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
if
(
!
shall_skip_database
(
exlq
->
db
))
{
print_use_stmt
(
print_event_info
,
exlq
->
db
,
exlq
->
db_len
);
print_use_stmt
(
print_event_info
,
exlq
);
if
(
fname
)
{
convert_path_to_forward_slashes
(
fname
);
...
...
@@ -1491,7 +1496,7 @@ static int parse_args(int *argc, char*** argv)
*/
static
Exit_status
safe_connect
()
{
/* Close an
d
old connections to MySQL */
/* Close an
y
old connections to MySQL */
if
(
mysql
)
mysql_close
(
mysql
);
...
...
mysql-test/r/mysqlbinlog-innodb.result
0 → 100644
View file @
108e9ee8
SET TIMESTAMP=1000000000;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
CREATE DATABASE test2;
RESET MASTER;
USE test2;
BEGIN;
USE test;
INSERT INTO t1 VALUES (1);
USE test2;
COMMIT;
BEGIN;
USE test;
INSERT INTO t1 VALUES (2);
USE test2;
COMMIT;
USE test;
SELECT * FROM t1 ORDER BY a;
a
1
2
FLUSH LOGS;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
INSERT INTO t1 VALUES (1)
/*!*/;
COMMIT/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
INSERT INTO t1 VALUES (2)
/*!*/;
COMMIT/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
use foo/*!*/;
SET TIMESTAMP=1000000000/*!*/;
INSERT INTO t1 VALUES (1)
/*!*/;
COMMIT/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
INSERT INTO t1 VALUES (2)
/*!*/;
COMMIT/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
DROP DATABASE test2;
DROP TABLE t1;
mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
View file @
108e9ee8
...
...
@@ -159,7 +159,6 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
use new_test1/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
...
...
@@ -354,7 +353,6 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
use new_test1/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
...
...
mysql-test/t/mysqlbinlog-innodb.test
0 → 100644
View file @
108e9ee8
--
source
include
/
have_binlog_format_statement
.
inc
--
source
include
/
have_log_bin
.
inc
--
source
include
/
have_innodb
.
inc
#
# MBug#702303: Spurious `use` statements in output from mysqlbinlog --rewrite-db="a->b"
#
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
SET
TIMESTAMP
=
1000000000
;
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
)
ENGINE
=
innodb
;
CREATE
DATABASE
test2
;
RESET
MASTER
;
USE
test2
;
BEGIN
;
USE
test
;
INSERT
INTO
t1
VALUES
(
1
);
USE
test2
;
COMMIT
;
BEGIN
;
USE
test
;
INSERT
INTO
t1
VALUES
(
2
);
USE
test2
;
COMMIT
;
USE
test
;
SELECT
*
FROM
t1
ORDER
BY
a
;
FLUSH
LOGS
;
--
exec
$MYSQL_BINLOG
$MYSQLD_DATADIR
/
master
-
bin
.
000001
--
short
-
form
--
exec
$MYSQL_BINLOG
$MYSQLD_DATADIR
/
master
-
bin
.
000001
--
short
-
form
--
rewrite
-
db
=
"test->foo"
--
rewrite
-
db
=
"test2->bar"
DROP
DATABASE
test2
;
DROP
TABLE
t1
;
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