diff options
Diffstat (limited to 'mysql-test/t/mysqlbinlog.test')
-rw-r--r-- | mysql-test/t/mysqlbinlog.test | 99 |
1 files changed, 78 insertions, 21 deletions
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 98ee18b554e..6a73a170d12 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -3,10 +3,18 @@ -- source include/have_binlog_format_statement.inc -- source include/have_log_bin.inc +-- source include/binlog_start_pos.inc # Deletes all the binary logs reset master; +# We need small binlog size to break the last LOAD DATA INFILE below so that +# the corresponding Begin_load_query will be written to master-bin.000001 +# while the Execute_load_query will be written to master-bin.000002. + +SET @save_binlog_size= @@global.max_binlog_size; +SET @@global.max_binlog_size= 4096; + # we need this for getting fixed timestamps inside of this test set timestamp=1000000000; @@ -26,13 +34,15 @@ insert into t2 values (); # test for load data and load data distributed among the several # files (we need to fill up first binlog) -load data infile '../../std_data/words.dat' into table t1; -load data infile '../../std_data/words.dat' into table t1; -load data infile '../../std_data/words.dat' into table t1; -load data infile '../../std_data/words.dat' into table t1; -load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words3.dat' into table t1; +load data infile '../../std_data/words3.dat' into table t1; +load data infile '../../std_data/words3.dat' into table t1; +load data infile '../../std_data/words3.dat' into table t1; +load data infile '../../std_data/words3.dat' into table t1; # simple query to show more in second binlog insert into t1 values ("Alas"); + +### Starting master-bin.000003 flush logs; # delimiters are for easier debugging in future @@ -46,7 +56,7 @@ select "--- Local --" as ""; # let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001 # this should not fail but shouldn't produce any working statements @@ -54,7 +64,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; select "--- Broken LOAD DATA --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null # this should show almost nothing @@ -62,17 +72,17 @@ select "--- Broken LOAD DATA --" as ""; select "--- --database --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null # this test for position option --disable_query_log select "--- --position --" as ""; --enable_query_log +let $start_pos= `select @binlog_start_pos + 227`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=332 $MYSQLD_DATADIR/master-bin.000002 - +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos $MYSQLD_DATADIR/master-bin.000002 # These are tests for remote binlog. # They should return the same as previous test. @@ -83,7 +93,7 @@ select "--- Remote --" as ""; # This is broken now --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 # This is broken too @@ -91,7 +101,7 @@ select "--- Remote --" as ""; select "--- Broken LOAD DATA --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 2> /dev/null # And this too ! (altough it is documented) @@ -99,34 +109,39 @@ select "--- Broken LOAD DATA --" as ""; select "--- --database --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001 2> /dev/null # Strangely but this works --disable_query_log select "--- --position --" as ""; --enable_query_log +let $start_pos= `select @binlog_start_pos + 227`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=332 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=$start_pos --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 # Bug#7853 mysqlbinlog does not accept input from stdin --disable_query_log select "--- reading stdin --" as ""; --enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 drop table t1,t2; +SET @@global.max_binlog_size= @save_binlog_size; + # # Bug#14157 utf8 encoding in binlog without set character_set_client # +### Starting master-bin.000004 flush logs; + --write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql create table if not exists t5 (a int); set names latin1; @@ -140,6 +155,8 @@ EOF # resulted binlog, parly consisting of multi-byte utf8 chars, # must be digestable for both client and server. In 4.1 the client # should use default-character-set same as the server. + +### Starting master-bin.000005 flush logs; --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL select * from t5 /* must be (1),(1) */; @@ -150,6 +167,8 @@ drop table t5; # Check that a dump created by mysqlbinlog reproduces # lc_time_names dependent values correctly # + +### Starting master-bin.000006 flush logs; create table t5 (c1 int, c2 varchar(128) character set latin1 not null); insert into t5 values (1, date_format('2001-01-01','%W')); @@ -158,7 +177,10 @@ insert into t5 values (2, date_format('2001-01-01','%W')); set lc_time_names=en_US; insert into t5 values (3, date_format('2001-01-01','%W')); select * from t5 order by c1; + +### Starting master-bin.000007 flush logs; + drop table t5; --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL select * from t5 order by c1; @@ -170,7 +192,10 @@ drop table t5; --disable_warnings drop procedure if exists p1; --enable_warnings + +### Starting master-bin.000008 flush logs; + delimiter //; create procedure p1() begin @@ -178,12 +203,15 @@ select 1; end; // delimiter ;// + +### Starting master-bin.000009 flush logs; + call p1(); drop procedure p1; --error ER_SP_DOES_NOT_EXIST call p1(); ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL call p1(); @@ -202,7 +230,9 @@ drop procedure p1; # (LOAD DATA INFILE need it) # +### Starting master-bin.000010 flush logs; + create table t1 (a varchar(64) character set utf8); load data infile '../../std_data/loaddata6.dat' into table t1; set character_set_database=koi8r; @@ -217,9 +247,12 @@ load data infile '../../std_data/loaddata6.dat' into table t1; load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r; select hex(a) from t1; drop table t1; + +### Starting master-bin.000011 flush logs; + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ +--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010 # @@ -229,9 +262,14 @@ flush logs; CREATE TABLE t1 (c1 CHAR(10)); # we need this for getting fixed timestamps inside of this test +### Starting master-bin.000012 FLUSH LOGS; + INSERT INTO t1 VALUES ('0123456789'); + +### Starting master-bin.000013 FLUSH LOGS; + DROP TABLE t1; # We create a table, patch, and load the output into it @@ -257,11 +295,16 @@ DROP TABLE patch; # # Bug#29928 incorrect connection_id() restoring from mysqlbinlog out # +### Starting master-bin.000014 FLUSH LOGS; + CREATE TABLE t1(a INT); INSERT INTO t1 VALUES(connection_id()); let $a= `SELECT a FROM t1`; + +### Starting master-bin.000015 FLUSH LOGS; + let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql; --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $outfile DROP TABLE t1; @@ -281,11 +324,12 @@ error 1; exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql; --remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql - # # Test --disable-force-if-open and --force-if-open # +### Starting master-bin.000016 FLUSH LOGS; + --error 1 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null --exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null @@ -300,9 +344,15 @@ GRANT SELECT ON mysqltest1.* TO untrusted@localhost; SHOW GRANTS FOR untrusted@localhost; USE mysqltest1; CREATE TABLE t1 (a INT, b CHAR(64)); + +### Starting master-bin.000017 flush logs; + INSERT INTO t1 VALUES (1,USER()); + +### Starting master-bin.000018 flush logs; + echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql; exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql; connect (unsecure,localhost,untrusted,,mysqltest1); @@ -326,14 +376,20 @@ DROP USER untrusted@localhost; connection default; USE test; SET BINLOG_FORMAT = STATEMENT; + +### Starting master-bin.000019 FLUSH LOGS; + CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32)); SET @a_real = rand(20) * 1000; SET @an_int = 1000; SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2)); SET @a_string = 'Just a test'; INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string); + +### Starting master-bin.000020 FLUSH LOGS; + query_vertical SELECT * FROM t1; DROP TABLE t1; @@ -357,6 +413,7 @@ eval SET @@global.server_id= $s_id_max; RESET MASTER; FLUSH LOGS; + --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $binlog_file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval SELECT |