| 1 |
--source include/have_binlog_format_row.inc |
| 2 |
|
| 3 |
# |
| 4 |
# BUG#30578764: MYSQLBINLOG DOESN'T WORK PROPERLY FOR COMPRESS TRANS WITH REWRITE-DB, RAW OPTION |
| 5 |
# |
| 6 |
# This test creates a database, creates a table in that databse and |
| 7 |
# populates the table. Then it launches mysqlbinlog with --raw that |
| 8 |
# will copy the binary logs and rewrite the database name as it |
| 9 |
# stores them on disk. For compressed events it will do it as well. |
| 10 |
# |
| 11 |
# Then it reapplies the changes on disk against the server again. |
| 12 |
# |
| 13 |
# If this success the test case ends with success. |
| 14 |
# |
| 15 |
|
| 16 |
--let $from_db = db1 |
| 17 |
--let $to_db = db2222222222222222 |
| 18 |
--let $random_string = `SELECT UUID()` |
| 19 |
--let $output_dir = $MYSQLTEST_VARDIR/tmp/ |
| 20 |
--let $mysqlbinlog_file = $output_dir/mysqlbinlog_output.sql |
| 21 |
|
| 22 |
--eval CREATE DATABASE $from_db |
| 23 |
--eval USE $from_db |
| 24 |
RESET MASTER; |
| 25 |
|
| 26 |
--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1) |
| 27 |
--let $binlog_file = $output_dir/$binlog |
| 28 |
|
| 29 |
CREATE TABLE t1 (i LONGTEXT); |
| 30 |
|
| 31 |
--let $i = 100 |
| 32 |
BEGIN; |
| 33 |
while($i) { |
| 34 |
--replace_result $random_string RANDOM_STRING |
| 35 |
--eval INSERT INTO t1 VALUES(REPEAT("$random_string", 100)) |
| 36 |
--dec $i |
| 37 |
} |
| 38 |
COMMIT; |
| 39 |
|
| 40 |
--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 |
| 41 |
--exec $MYSQL_BINLOG $binlog_file > $mysqlbinlog_file |
| 42 |
|
| 43 |
--eval CREATE DATABASE $to_db |
| 44 |
|
| 45 |
RESET MASTER; |
| 46 |
--exec $MYSQL --local-infile=1 < $mysqlbinlog_file |
| 47 |
|
| 48 |
--remove_file $binlog_file |
| 49 |
--remove_file $mysqlbinlog_file |
| 50 |
|
| 51 |
--let $diff_tables=$from_db.t1,$to_db.t1 |
| 52 |
--source include/diff_tables.inc |
| 53 |
|
| 54 |
--eval DROP DATABASE $from_db |
| 55 |
--eval DROP DATABASE $to_db |
| 56 |
|
| 57 |
RESET MASTER; |