| 1 |
|
| 2 |
-- source include/have_binlog_format_row.inc |
| 3 |
-- source include/no_valgrind_without_big.inc |
| 4 |
# |
| 5 |
# Reset master to cleanup binlog |
| 6 |
# |
| 7 |
reset master; |
| 8 |
|
| 9 |
# |
| 10 |
# Write different events to binlog |
| 11 |
# |
| 12 |
create table t1 (a int); |
| 13 |
insert into t1 values (1); |
| 14 |
insert into t1 values (2); |
| 15 |
insert into t1 values (3); |
| 16 |
update t1 set a=a+2 where a=2; |
| 17 |
update t1 set a=a+2 where a=3; |
| 18 |
|
| 19 |
create table t2 (word varchar(20)); |
| 20 |
load data infile '../../std_data/words.dat' into table t2; |
| 21 |
|
| 22 |
# |
| 23 |
# Save binlog |
| 24 |
# |
| 25 |
let $MYSQLD_DATADIR=`select @@datadir`; |
| 26 |
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); |
| 27 |
flush logs; |
| 28 |
--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql |
| 29 |
|
| 30 |
# |
| 31 |
# Clear database and restore from binlog |
| 32 |
# |
| 33 |
drop table t1; |
| 34 |
drop table t2; |
| 35 |
RESET MASTER; |
| 36 |
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql |
| 37 |
|
| 38 |
# |
| 39 |
# Verify that all binlog events have been executed |
| 40 |
# |
| 41 |
select * from t1; |
| 42 |
select * from t2; |
| 43 |
|
| 44 |
# |
| 45 |
# Verify that events larger than the default IO_CACHE buffer |
| 46 |
# are handled correctly (BUG#25628). |
| 47 |
# |
| 48 |
flush logs; |
| 49 |
drop table t2; |
| 50 |
create table t2 (word varchar(20)); |
| 51 |
load data infile '../../std_data/words.dat' into table t2; |
| 52 |
insert into t2 select * from t2; |
| 53 |
insert into t2 select * from t2; |
| 54 |
insert into t2 select * from t2; |
| 55 |
insert into t2 select * from t2; |
| 56 |
insert into t2 select * from t2; |
| 57 |
insert into t2 select * from t2; |
| 58 |
insert into t2 select * from t2; |
| 59 |
insert into t2 select * from t2; |
| 60 |
insert into t2 select * from t2; |
| 61 |
select count(*) from t2; |
| 62 |
|
| 63 |
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); |
| 64 |
flush logs; |
| 65 |
--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql |
| 66 |
RESET MASTER; |
| 67 |
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql |
| 68 |
|
| 69 |
# |
| 70 |
# Verify that all binlog events have been executed |
| 71 |
# |
| 72 |
select count(*) from t2; |
| 73 |
|
| 74 |
# |
| 75 |
# Test cleanup |
| 76 |
# |
| 77 |
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql |
| 78 |
drop table t1; |
| 79 |
drop table t2; |
| 80 |
|
| 81 |
# |
| 82 |
# BUG#12354268 |
| 83 |
# |
| 84 |
# This test verifies that using --start-position with DECODE-ROWS |
| 85 |
# does not make mysqlbinlog to output an error stating that it |
| 86 |
# does not contain any FD event. |
| 87 |
# |
| 88 |
|
| 89 |
RESET MASTER; |
| 90 |
USE test; |
| 91 |
SET @old_binlog_format= @@binlog_format; |
| 92 |
SET SESSION binlog_format='ROW'; |
| 93 |
CREATE TABLE t1(c1 INT); |
| 94 |
--let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1) |
| 95 |
--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1) |
| 96 |
--let $MYSQLD_DATADIR= `SELECT @@datadir` |
| 97 |
|
| 98 |
INSERT INTO t1 VALUES (1); |
| 99 |
|
| 100 |
FLUSH LOGS; |
| 101 |
|
| 102 |
--disable_result_log |
| 103 |
--exec $MYSQL_BINLOG --base64-output=DECODE-ROWS --start-position=$master_pos -v $MYSQLD_DATADIR/$master_binlog |
| 104 |
--enable_result_log |
| 105 |
|
| 106 |
DROP TABLE t1; |
| 107 |
SET SESSION binlog_format= @old_binlog_format; |
| 108 |
RESET MASTER; |