File: binlog_mysqlbinlog_raw_rewrite_db.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (57 lines) | stat: -rw-r--r-- 1,634 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--source include/have_binlog_format_row.inc

#
# BUG#30578764: MYSQLBINLOG DOESN'T WORK PROPERLY FOR COMPRESS TRANS WITH REWRITE-DB, RAW OPTION
#
# This test creates a database, creates a table in that databse and
# populates the table. Then it launches mysqlbinlog with --raw that
# will copy the binary logs and rewrite the database name as it
# stores them on disk. For compressed events it will do it as well.
#
# Then it reapplies the changes on disk against the server again.
#
# If this success the test case ends with success.
#

--let $from_db = db1
--let $to_db = db2222222222222222
--let $random_string = `SELECT UUID()`
--let $output_dir = $MYSQLTEST_VARDIR/tmp/
--let $mysqlbinlog_file = $output_dir/mysqlbinlog_output.sql

--eval CREATE DATABASE $from_db
--eval USE $from_db
RESET MASTER;

--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_file = $output_dir/$binlog

CREATE TABLE t1 (i LONGTEXT);

--let $i = 100
BEGIN;
while($i) {
  --replace_result $random_string RANDOM_STRING
  --eval INSERT INTO t1 VALUES(REPEAT("$random_string", 100))
  --dec $i
}
COMMIT;

--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --raw --rewrite-db="$from_db->$to_db" $binlog --result-file=$output_dir
--exec $MYSQL_BINLOG $binlog_file > $mysqlbinlog_file

--eval CREATE DATABASE $to_db

RESET MASTER;
--exec $MYSQL --local-infile=1 < $mysqlbinlog_file

--remove_file $binlog_file
--remove_file $mysqlbinlog_file

--let $diff_tables=$from_db.t1,$to_db.t1
--source include/diff_tables.inc

--eval DROP DATABASE $from_db
--eval DROP DATABASE $to_db

RESET MASTER;