2005-12-22 06:39:02 +01:00
|
|
|
-- source include/have_binlog_format_row.inc
|
2008-07-28 09:15:20 +02:00
|
|
|
#
|
|
|
|
# Reset master to cleanup binlog
|
|
|
|
#
|
|
|
|
reset master;
|
|
|
|
|
2005-12-22 06:39:02 +01:00
|
|
|
#
|
|
|
|
# Write different events to binlog
|
|
|
|
#
|
|
|
|
create table t1 (a int);
|
|
|
|
insert into t1 values (1);
|
|
|
|
insert into t1 values (2);
|
|
|
|
insert into t1 values (3);
|
|
|
|
update t1 set a=a+2 where a=2;
|
|
|
|
update t1 set a=a+2 where a=3;
|
|
|
|
|
|
|
|
create table t2 (word varchar(20));
|
2007-12-12 18:19:24 +01:00
|
|
|
load data infile '../../std_data/words.dat' into table t2;
|
2005-12-22 06:39:02 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Save binlog
|
|
|
|
#
|
2007-12-19 17:26:43 +01:00
|
|
|
let $MYSQLD_DATADIR=`select @@datadir`;
|
2006-12-14 11:05:25 +01:00
|
|
|
flush logs;
|
2007-12-19 17:26:43 +01:00
|
|
|
--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
2005-12-22 06:39:02 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Clear database and restore from binlog
|
|
|
|
#
|
|
|
|
drop table t1;
|
|
|
|
drop table t2;
|
2006-02-22 10:07:54 +01:00
|
|
|
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
2005-12-22 06:39:02 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Verify that all binlog events have been executed
|
|
|
|
#
|
|
|
|
select * from t1;
|
|
|
|
select * from t2;
|
|
|
|
|
2007-02-23 22:23:54 +01:00
|
|
|
#
|
|
|
|
# Verify that events larger than the default IO_CACHE buffer
|
|
|
|
# are handled correctly (BUG#25628).
|
|
|
|
#
|
|
|
|
flush logs;
|
|
|
|
drop table t2;
|
|
|
|
create table t2 (word varchar(20));
|
2007-12-12 18:19:24 +01:00
|
|
|
load data infile '../../std_data/words.dat' into table t2;
|
2007-02-23 22:23:54 +01:00
|
|
|
insert into t2 select * from t2;
|
|
|
|
insert into t2 select * from t2;
|
|
|
|
insert into t2 select * from t2;
|
|
|
|
insert into t2 select * from t2;
|
|
|
|
insert into t2 select * from t2;
|
|
|
|
insert into t2 select * from t2;
|
|
|
|
insert into t2 select * from t2;
|
|
|
|
insert into t2 select * from t2;
|
|
|
|
insert into t2 select * from t2;
|
|
|
|
select count(*) from t2;
|
|
|
|
|
|
|
|
flush logs;
|
2007-12-19 17:26:43 +01:00
|
|
|
--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
2007-02-23 22:23:54 +01:00
|
|
|
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
|
|
|
|
|
|
|
#
|
|
|
|
# Verify that all binlog events have been executed
|
|
|
|
#
|
|
|
|
select count(*) from t2;
|
|
|
|
|
2005-12-22 06:39:02 +01:00
|
|
|
#
|
|
|
|
# Test cleanup
|
|
|
|
#
|
2007-12-19 17:26:43 +01:00
|
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
2005-12-22 06:39:02 +01:00
|
|
|
drop table t1;
|
|
|
|
drop table t2;
|
2011-05-06 00:48:15 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# BUG#12354268
|
|
|
|
#
|
|
|
|
# This test verifies that using --start-position with DECODE-ROWS
|
|
|
|
# does not make mysqlbinlog to output an error stating that it
|
|
|
|
# does not contain any FD event.
|
|
|
|
#
|
|
|
|
|
|
|
|
RESET MASTER;
|
|
|
|
USE test;
|
|
|
|
SET @old_binlog_format= @@binlog_format;
|
|
|
|
SET SESSION binlog_format=ROW;
|
|
|
|
CREATE TABLE t1(c1 INT);
|
|
|
|
--let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
|
|
|
|
--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
|
|
|
|
--let $MYSQLD_DATADIR= `SELECT @@datadir`
|
|
|
|
|
|
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
|
|
|
|
FLUSH LOGS;
|
|
|
|
|
|
|
|
--disable_result_log
|
|
|
|
--exec $MYSQL_BINLOG --base64-output=DECODE-ROWS --start-position=$master_pos -v $MYSQLD_DATADIR/$master_binlog
|
|
|
|
--enable_result_log
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
SET SESSION binlog_format= @old_binlog_format;
|
|
|
|
RESET MASTER;
|