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
56af9edf
Commit
56af9edf
authored
Oct 16, 2009
by
Alexander Ivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MWL#36: Add a mysqlbinlog option to change the used database.
Add test-suite.
parent
c26749b4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
320 additions
and
0 deletions
+320
-0
mysql-test/std_data/loaddata7.dat
mysql-test/std_data/loaddata7.dat
+5
-0
mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
...test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
+255
-0
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test
...l-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test
+60
-0
No files found.
mysql-test/std_data/loaddata7.dat
0 → 100644
View file @
56af9edf
2,2
3,3
4,4
5,5
6,6
\ No newline at end of file
mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
0 → 100644
View file @
56af9edf
DROP DATABASE IF EXISTS test1;
DROP DATABASE IF EXISTS test2;
DROP DATABASE IF EXISTS test3;
CREATE DATABASE test1;
CREATE DATABASE test2;
CREATE DATABASE test3;
SET timestamp=1000000000;
RESET MASTER;
USE test1;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(2,2);
USE test2;
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (1),(2);
DELETE FROM test1.t1 WHERE a=1;
USE test3;
CREATE TABLE t3 (a INT);
INSERT INTO t3 VALUES (1),(2);
INSERT INTO test1.t1 VALUES (3,3);
USE test1;
LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE t1
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n';
DELETE FROM test3.t3 WHERE a=1;
flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
BINLOG '
AMqaOw8BAAAAZgAAAGoAAAAAAAQANS4xLjM4LU1hcmlhREItYmV0YTEtZGVidWctbG9nAAAAAAAA
AAAAAAAAAAAAAAAAAAAAypo7EzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
'/*!*/;
# at #
use new_test1/*!*/;
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
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/*!*/;
CREATE TABLE t1 (a INT, b INT)
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
BINLOG '
AMqaOxMBAAAALwAAADgBAAAAABcAAAAAAAAACW5ld190ZXN0MQACdDEAAgMDAAM=
AMqaOxcBAAAALwAAAGcBAAAQABcAAAAAAAEAAv/8AQAAAAEAAAD8AgAAAAIAAAA=
'/*!*/;
### INSERT INTO new_test1.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2=1 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO new_test1.t1
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2=2 /* INT meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
use test2/*!*/;
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t2 (a INT)
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
BINLOG '
AMqaOxMBAAAAKgAAAHMCAAAAABgAAAAAAAAABXRlc3QyAAJ0MgABAwAB
AMqaOxcBAAAAJwAAAJoCAAAQABgAAAAAAAEAAf/+AQAAAP4CAAAA
'/*!*/;
### INSERT INTO test2.t2
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test2.t2
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
BINLOG '
AMqaOxMBAAAALwAAAFADAAAAABcAAAAAAAAACW5ld190ZXN0MQACdDEAAgMDAAM=
AMqaOxkBAAAAJgAAAHYDAAAQABcAAAAAAAEAAv/8AQAAAAEAAAA=
'/*!*/;
### DELETE FROM new_test1.t1
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2=1 /* INT meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
use new_test3/*!*/;
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t3 (a INT)
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `new_test3`.`t3` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
BINLOG '
AMqaOxMBAAAALgAAAIIEAAAAABkAAAAAAAAACW5ld190ZXN0MwACdDMAAQMAAQ==
AMqaOxcBAAAAJwAAAKkEAAAQABkAAAAAAAEAAf/+AQAAAP4CAAAA
'/*!*/;
### INSERT INTO new_test3.t3
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO new_test3.t3
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
BINLOG '
AMqaOxMBAAAALwAAAF8FAAAAABcAAAAAAAAACW5ld190ZXN0MQACdDEAAgMDAAM=
AMqaOxcBAAAAJgAAAIUFAAAQABcAAAAAAAEAAv/8AwAAAAMAAAA=
'/*!*/;
### INSERT INTO new_test1.t1
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
use new_test1/*!*/;
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
BINLOG '
AMqaOxMBAAAALwAAADsGAAAAABcAAAAAAAAACW5ld190ZXN0MQACdDEAAgMDAAM=
AMqaOxcBAAAASgAAAIUGAAAQABcAAAAAAAEAAv/8AgAAAAIAAAD8AwAAAAMAAAD8BAAAAAQAAAD8
BQAAAAUAAAD8BgAAAAYAAAA=
'/*!*/;
### INSERT INTO new_test1.t1
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2=2 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO new_test1.t1
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2=3 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO new_test1.t1
### SET
### @1=4 /* INT meta=0 nullable=1 is_null=0 */
### @2=4 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO new_test1.t1
### SET
### @1=5 /* INT meta=0 nullable=1 is_null=0 */
### @2=5 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO new_test1.t1
### SET
### @1=6 /* INT meta=0 nullable=1 is_null=0 */
### @2=6 /* INT meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `new_test3`.`t3` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
BINLOG '
AMqaOxMBAAAALgAAADoHAAAAABkAAAAAAAAACW5ld190ZXN0MwACdDMAAQMAAQ==
AMqaOxkBAAAAIgAAAFwHAAAQABkAAAAAAAEAAf/+AQAAAA==
'/*!*/;
### DELETE FROM new_test3.t3
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
DROP DATABASE test1;
DROP DATABASE test2;
DROP DATABASE test3;
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test
0 → 100644
View file @
56af9edf
--
source
include
/
have_log_bin
.
inc
--
source
include
/
have_binlog_format_row
.
inc
#
# MWL36: Add a mysqlbinlog option to change the used database
# (Adding --rewrite-db option)
#
--
disable_warnings
DROP
DATABASE
IF
EXISTS
test1
;
DROP
DATABASE
IF
EXISTS
test2
;
DROP
DATABASE
IF
EXISTS
test3
;
--
enable_warnings
# For SBR --rewrite-db affects only default database and doesn't affect
# a query (specifically CREATE DATABASE) itself. Hence (for testing
# purpose) we start binary logging after all databases have been created.
CREATE
DATABASE
test1
;
CREATE
DATABASE
test2
;
CREATE
DATABASE
test3
;
# Fix timestamp to avoid varying results.
SET
timestamp
=
1000000000
;
# Delete all existing binary logs.
RESET
MASTER
;
# Whe'll call mysqlbinlog with two rewrite rules:
# --rewrite-db="test1->new_test1"
# --rewrite-db="test3->new_test3"
USE
test1
;
CREATE
TABLE
t1
(
a
INT
,
b
INT
);
INSERT
INTO
t1
VALUES
(
1
,
1
),(
2
,
2
);
USE
test2
;
CREATE
TABLE
t2
(
a
INT
);
INSERT
INTO
t2
VALUES
(
1
),(
2
);
DELETE
FROM
test1
.
t1
WHERE
a
=
1
;
USE
test3
;
CREATE
TABLE
t3
(
a
INT
);
INSERT
INTO
t3
VALUES
(
1
),(
2
);
INSERT
INTO
test1
.
t1
VALUES
(
3
,
3
);
USE
test1
;
LOAD
DATA
INFILE
'../../std_data/loaddata7.dat'
INTO
TABLE
t1
FIELDS
TERMINATED
BY
','
LINES
TERMINATED
BY
'\r\n'
;
DELETE
FROM
test3
.
t3
WHERE
a
=
1
;
flush
logs
;
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
--
replace_regex
/
server
v
[
^
]
*/
server
v
#.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
--
exec
$MYSQL_BINLOG
--
rewrite
-
db
=
"test1->new_test1"
--
rewrite
-
db
=
"test3->new_test3"
-
v
-
v
$MYSQLD_DATADIR
/
master
-
bin
.
000001
DROP
DATABASE
test1
;
DROP
DATABASE
test2
;
DROP
DATABASE
test3
;
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