diff options
author | Shivji Kumar Jha <shivji.jha@oracle.com> | 2012-10-30 10:41:25 +0530 |
---|---|---|
committer | Shivji Kumar Jha <shivji.jha@oracle.com> | 2012-10-30 10:41:25 +0530 |
commit | 055763e0db38d1df332232a61a0b7845c0e16aea (patch) | |
tree | dc75dcdbf2fd44c7cab5b011ddb4376204dd0e3f /mysql-test/suite/binlog/t | |
parent | 1bd0cb4c4027c098ac6fe1dd82d82bb55966a7ce (diff) | |
parent | 068478fbbf06b750250383514a210175e708c717 (diff) | |
download | mariadb-git-055763e0db38d1df332232a61a0b7845c0e16aea.tar.gz |
BUG#14659685: main.mysqlbinlog_row_myisam.test main.mysqlbinlog_row_innodb.test are skipped
merge from 5.1 into 5.5
Diffstat (limited to 'mysql-test/suite/binlog/t')
8 files changed, 958 insertions, 0 deletions
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt new file mode 100644 index 00000000000..bb0cda4519a --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt @@ -0,0 +1 @@ +--max-binlog-size=8192 diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test new file mode 100644 index 00000000000..2a210bea0e0 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test @@ -0,0 +1,26 @@ +# disabled in embedded until tools running is fixed with embedded +--source include/not_embedded.inc + +-- source include/have_binlog_format_mixed_or_statement.inc +-- source include/have_cp932.inc +-- source include/have_log_bin.inc + +RESET MASTER; + +# Bug#16217 (mysql client did not know how not switch its internal charset) +create table t3 (f text character set utf8); +create table t4 (f text character set cp932); +--exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')" +--exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');" +flush logs; +rename table t3 to t03, t4 to t04; +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8 +# original and recovered data must be equal +select HEX(f) from t03; +select HEX(f) from t3; +select HEX(f) from t04; +select HEX(f) from t4; + +drop table t3, t4, t03, t04; +--echo End of 5.0 tests diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test new file mode 100644 index 00000000000..dcd92262a83 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test @@ -0,0 +1,175 @@ +# Test for the new options --start-datetime, stop-datetime, +# and a few others. + +# TODO: Need to look at making row based version once new binlog client is complete. +-- source include/have_binlog_format_mixed_or_statement.inc + + +--disable_warnings +drop table if exists t1; +--enable_warnings +reset master; + +# We need this for getting fixed timestamps inside of this test. +# I use a date in the future to keep a growing timestamp along the +# binlog (including the Start_log_event). This test will work +# unchanged everywhere, because mysql-test-run has fixed TZ, which it +# exports (so mysqlbinlog has same fixed TZ). +set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22"); +set timestamp=@a; +create table t1 (a int auto_increment not null primary key, b char(3)); +insert into t1 values(null, "a"); +insert into t1 values(null, "b"); +set timestamp=@a+2; +--let $binlog_pos_760=query_get_value(SHOW MASTER STATUS, Position, 1) +insert into t1 values(null, "c"); +--let $binlog_pos_951=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000001' from $binlog_pos_760, Pos, 4) +set timestamp=@a+4; +insert into t1 values(null, "d"); +insert into t1 values(null, "e"); + +flush logs; +set timestamp=@a+1; # this could happen on a slave +insert into t1 values(null, "f"); +--let $binlog_pos_135=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 3) +--let $binlog_pos_203=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 4) + +# delimiters are for easier debugging in future + +--disable_query_log +select "--- Local --" as ""; +--enable_query_log + +# +# We should use --short-form everywhere because in other case output will +# be time dependent (the Start events). Better than nothing. +# +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLD_DATADIR/master-bin.000001 + +--disable_query_log +select "--- offset --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001 +--disable_query_log +select "--- start-position --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 +--disable_query_log +select "--- stop-position --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 +--disable_query_log +select "--- start and stop positions ---" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951 $MYSQLD_DATADIR/master-bin.000001 +--disable_query_log +select "--- start-datetime --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 +--disable_query_log +select "--- stop-datetime --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 + +--disable_query_log +select "--- Local with 2 binlogs on command line --" as ""; +--enable_query_log + +# This is to verify that some options apply only to first, or last binlog + +flush logs; +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 + +--disable_query_log +select "--- offset --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--disable_query_log +select "--- start-position --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--disable_query_log +select "--- stop-position --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_203 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--disable_query_log +select "--- start-datetime --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--disable_query_log +select "--- stop-datetime --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 + +--disable_query_log +select "--- Remote --" as ""; +--enable_query_log + +--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 + +--disable_query_log +select "--- offset --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--disable_query_log +select "--- start-position --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--disable_query_log +select "--- stop-position --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--disable_query_log +select "--- start and stop positions ---" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--disable_query_log +select "--- start-datetime --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--disable_query_log +select "--- stop-datetime --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 + +--disable_query_log +select "--- Remote with 2 binlogs on command line --" as ""; +--enable_query_log + +--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 + +--disable_query_log +select "--- offset --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--disable_query_log +select "--- start-position --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--disable_query_log +select "--- stop-position --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--disable_query_log +select "--- start-datetime --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form "--start-datetime=20200121153224" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--disable_query_log +select "--- stop-datetime --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020/01/21 15@32@24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 + +--disable_query_log +select "--- to-last-log --" as ""; +--enable_query_log + +--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001 + +# clean up +--disable_query_log +select "--- end of test --" as ""; +--enable_query_log +drop table t1; + +# End of 4.1 tests diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test new file mode 100644 index 00000000000..3d3444cea1c --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test @@ -0,0 +1,102 @@ +-- source include/have_binlog_format_row.inc +# +# Reset master to cleanup binlog +# +reset master; + +# +# 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)); +load data infile '../../std_data/words.dat' into table t2; + +# +# Save binlog +# +let $MYSQLD_DATADIR=`select @@datadir`; +flush logs; +--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql + +# +# Clear database and restore from binlog +# +drop table t1; +drop table t2; +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql + +# +# Verify that all binlog events have been executed +# +select * from t1; +select * from t2; + +# +# 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)); +load data infile '../../std_data/words.dat' into table 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; +insert into t2 select * from t2; +select count(*) from t2; + +flush logs; +--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql + +# +# Verify that all binlog events have been executed +# +select count(*) from t2; + +# +# Test cleanup +# +--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql +drop table t1; +drop table t2; + +# +# 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; diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test new file mode 100644 index 00000000000..9b41c63d195 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test @@ -0,0 +1,446 @@ +--source include/have_log_bin.inc +--source include/have_binlog_format_row.inc +--source include/have_ucs2.inc + +--echo # +--echo # Preparatory cleanup. +--echo # +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +--echo # +--echo # We need a fixed timestamp to avoid varying results. +--echo # +SET timestamp=1000000000; + +--echo # +--echo # Delete all existing binary logs. +--echo # +RESET MASTER; + + +CREATE TABLE t1 (c01 BIT); +INSERT INTO t1 VALUES (0); +INSERT INTO t1 VALUES (1); +DROP TABLE t1; + +CREATE TABLE t1 (c01 BIT(7)); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (8); +INSERT INTO t1 VALUES (16); +INSERT INTO t1 VALUES (32); +INSERT INTO t1 VALUES (64); +INSERT INTO t1 VALUES (127); +DELETE FROM t1 WHERE c01=127; +UPDATE t1 SET c01=15 WHERE c01=16; +DROP TABLE t1; + +CREATE TABLE t1 (a BIT(20), b CHAR(2)); +INSERT INTO t1 VALUES (b'00010010010010001001', 'ab'); +DROP TABLE t1; + +CREATE TABLE t1 (c02 BIT(64)); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (128); +INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111'); +DROP TABLE t1; + + +CREATE TABLE t1 (c03 TINYINT); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t1 VALUES (-128); +UPDATE t1 SET c03=2 WHERE c03=1; +DELETE FROM t1 WHERE c03=-128; +DROP TABLE t1; + +CREATE TABLE t1 (c04 TINYINT UNSIGNED); +INSERT INTO t1 VALUES (128), (255); +UPDATE t1 SET c04=2 WHERE c04=1; +DELETE FROM t1 WHERE c04=255; +DROP TABLE t1; + +CREATE TABLE t1 (c06 BOOL); +INSERT INTO t1 VALUES (TRUE); +DELETE FROM t1 WHERE c06=TRUE; +DROP TABLE t1; + +CREATE TABLE t1 (c07 SMALLINT); +INSERT INTO t1 VALUES (1234); +DELETE FROM t1 WHERE c07=1234; +DROP TABLE t1; + +CREATE TABLE t1 (c08 SMALLINT UNSIGNED); +INSERT INTO t1 VALUES (32768), (65535); +UPDATE t1 SET c08=2 WHERE c08=32768; +DELETE FROM t1 WHERE c08=65535; +DROP TABLE t1; + +CREATE TABLE t1 (c10 MEDIUMINT); +INSERT INTO t1 VALUES (12345); +DELETE FROM t1 WHERE c10=12345; +DROP TABLE t1; + +CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED); +INSERT INTO t1 VALUES (8388608), (16777215); +UPDATE t1 SET c11=2 WHERE c11=8388608; +DELETE FROM t1 WHERE c11=16777215; +DROP TABLE t1; + +CREATE TABLE t1 (c13 INT); +INSERT INTO t1 VALUES (123456); +DELETE FROM t1 WHERE c13=123456; +DROP TABLE t1; + +CREATE TABLE t1 (c14 INT UNSIGNED); +INSERT INTO t1 VALUES (2147483648), (4294967295); +UPDATE t1 SET c14=2 WHERE c14=2147483648; +DELETE FROM t1 WHERE c14=4294967295; +DROP TABLE t1; + +CREATE TABLE t1 (c16 BIGINT); +INSERT INTO t1 VALUES (1234567890); +DELETE FROM t1 WHERE c16=1234567890; +DROP TABLE t1; + +CREATE TABLE t1 (c17 BIGINT UNSIGNED); +INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615); +UPDATE t1 SET c17=2 WHERE c17=9223372036854775808; +DELETE FROM t1 WHERE c17=18446744073709551615; +DROP TABLE t1; + +CREATE TABLE t1 (c19 FLOAT); +INSERT INTO t1 VALUES (123.2234); +DELETE FROM t1 WHERE c19>123; +DROP TABLE t1; + +CREATE TABLE t1 (c22 DOUBLE); +INSERT INTO t1 VALUES (123434.22344545); +DELETE FROM t1 WHERE c22>123434; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c25 DECIMAL(10,5)); +INSERT INTO t1 VALUES (124.45); +INSERT INTO t1 VALUES (-543.21); +DELETE FROM t1 WHERE c25=124.45; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c28 DATE); +INSERT INTO t1 VALUES ('2001-02-03'); +DELETE FROM t1 WHERE c28='2001-02-03'; +DROP TABLE t1; + +CREATE TABLE t1 (c29 DATETIME); +INSERT INTO t1 VALUES ('2001-02-03 10:20:30'); +DELETE FROM t1 WHERE c29='2001-02-03 10:20:30'; +DROP TABLE t1; + +CREATE TABLE t1 (c30 TIMESTAMP); +INSERT INTO t1 VALUES ('2001-02-03 10:20:30'); +DELETE FROM t1 WHERE c30='2001-02-03 10:20:30'; +DROP TABLE t1; + +CREATE TABLE t1 (c31 TIME); +INSERT INTO t1 VALUES ('11:22:33'); +DELETE FROM t1 WHERE c31='11:22:33'; +DROP TABLE t1; + +CREATE TABLE t1 (c32 YEAR); +INSERT INTO t1 VALUES ('2001'); +DELETE FROM t1 WHERE c32=2001; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c33 CHAR); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c33='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c34 CHAR(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c34=''; +DROP TABLE t1; + +CREATE TABLE t1 (c35 CHAR(1)); +INSERT INTO t1 VALUES ('b'); +DELETE FROM t1 WHERE c35='b'; +DROP TABLE t1; + +CREATE TABLE t1 (c36 CHAR(255)); +INSERT INTO t1 VALUES (repeat('c',255)); +DELETE FROM t1 WHERE c36>'c'; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c37 NATIONAL CHAR); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c37='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c38 NATIONAL CHAR(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c38=''; +DROP TABLE t1; + +CREATE TABLE t1 (c39 NATIONAL CHAR(1)); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c39='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c40 NATIONAL CHAR(255)); +INSERT INTO t1 VALUES (repeat('a', 255)); +INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255)); +DELETE FROM t1 WHERE c40>'a'; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c41 CHAR CHARACTER SET UCS2); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c41='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c42 CHAR(0) CHARACTER SET UCS2); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c42=''; +DROP TABLE t1; + +CREATE TABLE t1 (c43 CHAR(1) CHARACTER SET UCS2); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c43='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c44 CHAR(255) CHARACTER SET UCS2); +INSERT INTO t1 VALUES (repeat('a', 255)); +INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255)); +DELETE FROM t1 WHERE c44>'a'; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c45 VARCHAR(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c45=''; +DROP TABLE t1; + +CREATE TABLE t1 (c46 VARCHAR(1)); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c46='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c47 VARCHAR(255)); +INSERT INTO t1 VALUES (repeat('a',255)); +DELETE FROM t1 WHERE c47>'a'; +DROP TABLE t1; + +CREATE TABLE t1 (c48 VARCHAR(261)); +INSERT INTO t1 VALUES (repeat('a',261)); +DELETE FROM t1 WHERE c48>'a'; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c49 NATIONAL VARCHAR(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c49=''; +DROP TABLE t1; + +CREATE TABLE t1 (c50 NATIONAL VARCHAR(1)); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c50='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c51 NATIONAL VARCHAR(255)); +INSERT INTO t1 VALUES (repeat('a',255)); +INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255)); +DELETE FROM t1 WHERE c51>'a'; +DROP TABLE t1; + +CREATE TABLE t1 (c52 NATIONAL VARCHAR(261)); +INSERT INTO t1 VALUES (repeat('a',261)); +INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261)); +DELETE FROM t1 WHERE c52>'a'; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c53 VARCHAR(0) CHARACTER SET ucs2); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c53=''; +DROP TABLE t1; + +CREATE TABLE t1 (c54 VARCHAR(1) CHARACTER SET ucs2); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c54='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c55 VARCHAR(255) CHARACTER SET ucs2); +INSERT INTO t1 VALUES (repeat('ab', 127)); +DELETE FROM t1 WHERE c55>'a'; +DROP TABLE t1; + +CREATE TABLE t1 (c56 VARCHAR(261) CHARACTER SET ucs2); +INSERT INTO t1 VALUES (repeat('ab', 130)); +DELETE FROM t1 WHERE c56>'a'; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c57 BINARY); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c57='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c58 BINARY(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c58=''; +DROP TABLE t1; + +CREATE TABLE t1 (c59 BINARY(1)); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c59='a'; +DROP TABLE t1; + +CREATE TABLE t1 (c60 BINARY(255)); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES (repeat('a\0',120)); +DELETE FROM t1 WHERE c60<0x02; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c61 VARBINARY(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c61=''; +DROP TABLE t1; + +CREATE TABLE t1 (c62 VARBINARY(1)); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c62=0x02; +DROP TABLE t1; + +CREATE TABLE t1 (c63 VARBINARY(255)); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES (repeat('a\0',120)); +DELETE FROM t1 WHERE c63=0x02; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c65 TINYBLOB); +INSERT INTO t1 VALUES ('tinyblob1'); +DELETE FROM t1 WHERE c65='tinyblob1'; +DROP TABLE t1; + +CREATE TABLE t1 (c68 BLOB); +INSERT INTO t1 VALUES ('blob1'); +DELETE FROM t1 WHERE c68='blob1'; +DROP TABLE t1; + +CREATE TABLE t1 (c71 MEDIUMBLOB); +INSERT INTO t1 VALUES ('mediumblob1'); +DELETE FROM t1 WHERE c71='mediumblob1'; +DROP TABLE t1; + +CREATE TABLE t1 (c74 LONGBLOB); +INSERT INTO t1 VALUES ('longblob1'); +DELETE FROM t1 WHERE c74='longblob1'; +DROP TABLE t1; + +CREATE TABLE t1 (c66 TINYTEXT); +INSERT INTO t1 VALUES ('tinytext1'); +DELETE FROM t1 WHERE c66='tinytext1'; +DROP TABLE t1; + +CREATE TABLE t1 (c69 TEXT); +INSERT INTO t1 VALUES ('text1'); +DELETE FROM t1 WHERE c69='text1'; +DROP TABLE t1; + +CREATE TABLE t1 (c72 MEDIUMTEXT); +INSERT INTO t1 VALUES ('mediumtext1'); +DELETE FROM t1 WHERE c72='mediumtext1'; +DROP TABLE t1; + +CREATE TABLE t1 (c75 LONGTEXT); +INSERT INTO t1 VALUES ('longtext1'); +DELETE FROM t1 WHERE c75='longtext1'; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c67 TINYTEXT CHARACTER SET UCS2); +INSERT INTO t1 VALUES ('tinytext1'); +DELETE FROM t1 WHERE c67='tinytext1'; +DROP TABLE t1; + +CREATE TABLE t1 (c70 TEXT CHARACTER SET UCS2); +INSERT INTO t1 VALUES ('text1'); +DELETE FROM t1 WHERE c70='text1'; +DROP TABLE t1; + +CREATE TABLE t1 (c73 MEDIUMTEXT CHARACTER SET UCS2); +INSERT INTO t1 VALUES ('mediumtext1'); +DELETE FROM t1 WHERE c73='mediumtext1'; +DROP TABLE t1; + +CREATE TABLE t1 (c76 LONGTEXT CHARACTER SET UCS2); +INSERT INTO t1 VALUES ('longtext1'); +DELETE FROM t1 WHERE c76='longtext1'; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c77 ENUM('a','b','c')); +INSERT INTO t1 VALUES ('b'); +DELETE FROM t1 WHERE c77='b'; +DROP TABLE t1; + +# + +CREATE TABLE t1 (c78 SET('a','b','c','d','e','f')); +INSERT INTO t1 VALUES ('a,b'); +INSERT INTO t1 VALUES ('a,c'); +INSERT INTO t1 VALUES ('b,c'); +INSERT INTO t1 VALUES ('a,b,c'); +INSERT INTO t1 VALUES ('a,b,c,d'); +INSERT INTO t1 VALUES ('a,b,c,d,e'); +INSERT INTO t1 VALUES ('a,b,c,d,e,f'); +DELETE FROM t1 WHERE c78='a,b'; +DROP TABLE t1; + +# +# Check multi-table update +# +CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0); +CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0); +INSERT INTO t1 SET a=1; +INSERT INTO t1 SET b=1; +INSERT INTO t2 SET a=1; +INSERT INTO t2 SET b=1; +UPDATE t1, t2 SET t1.a=10, t2.a=20; +DROP TABLE t1,t2; + +flush logs; + +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test new file mode 100644 index 00000000000..e8ba283807b --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test @@ -0,0 +1,24 @@ +# mysqlbinlog_row_innodb.test +# +# Show that mysqlbinlog displays human readable comments to +# row-based log events. +# +# Main module for the InnoDB storage engine. +# +# Calls include/mysqlbinlog_row.inc +# See there for more informaton. +# + +--source include/have_innodb.inc +let $engine_type=InnoDB; + +# +# The test case would also work with statement based or mixed mode logging. +# But this would require different result files. To handle this with the +# current test suite, new main test cases are required. +# +--source include/have_binlog_format_row.inc +--source include/have_ucs2.inc + +--source extra/binlog_tests/mysqlbinlog_row_engine.inc + diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test new file mode 100644 index 00000000000..9b941282399 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test @@ -0,0 +1,23 @@ +# mysqlbinlog_row.test +# +# Show that mysqlbinlog displays human readable comments to +# row-based log events. +# +# Main module for the MyISAM storage engine. +# +# Calls include/mysqlbinlog_row.inc +# See there for more informaton. +# + +#--source include/have_myisam.inc +let $engine_type=MyISAM; + +# +# The test case would also work with statement based or mixed mode logging. +# But this would require different result files. To handle this with the +# current test suite, new main test cases are required. +# +--source include/have_binlog_format_row.inc +--source include/have_ucs2.inc + +--source extra/binlog_tests/mysqlbinlog_row_engine.inc diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test new file mode 100644 index 00000000000..24abc441c4c --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test @@ -0,0 +1,161 @@ +# mysqlbinlog_trans.test +# +# Show that mysqlbinlog work correctly with transactions. +# + +#--source include/have_myisam.inc +--let $engine_type_nontrans= MyISAM +--source include/have_innodb.inc +--let $engine_type= InnoDB + +# +# The test case would also work with statement based or mixed mode logging. +# But this would require different result files. To handle this with the +# current test suite, new main test cases are required. +# +--source include/have_binlog_format_row.inc + +--source include/have_log_bin.inc + +--echo # +--echo # Preparatory cleanup. +--echo # +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +--echo # +--echo # We need a fixed timestamp to avoid varying results. +--echo # +SET timestamp=1000000000; + +--echo # +--echo # Delete all existing binary logs. +--echo # +RESET MASTER; + +--echo # +--echo # Create test tables. +--echo # +eval CREATE TABLE t1 ( + c1 INT, + c2 VARCHAR(20) + ) ENGINE=$engine_type DEFAULT CHARSET latin1; +eval CREATE TABLE t2 ( + c1 INT, + c2 VARCHAR(20) + ) ENGINE=$engine_type_nontrans DEFAULT CHARSET latin1; + +--echo # +--echo # Start transaction #1, transactional table only, commit. +--echo # +START TRANSACTION; + +--echo # +--echo # Do some statements. +--echo # +INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); +UPDATE t1 SET c1 = c1 + 10; +DELETE FROM t1 WHERE c1 = 12; + +--echo # +--echo # Commit transaction. +--echo # +COMMIT; +SELECT * FROM t1; +TRUNCATE TABLE t1; + +--echo # +--echo # Start transaction #2, transactional table only, rollback. +--echo # +START TRANSACTION; + +--echo # +--echo # Do some statements. +--echo # +INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); +UPDATE t1 SET c1 = c1 + 10; +DELETE FROM t1 WHERE c1 = 12; + +--echo # +--echo # Rollback transaction. +--echo # +ROLLBACK; +SELECT * FROM t1; +TRUNCATE TABLE t1; + +--echo # +--echo # Start transaction #3, both tables, commit. +--echo # +START TRANSACTION; + +--echo # +--echo # Do some statements on the transactional table. +--echo # +INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); +UPDATE t1 SET c1 = c1 + 10; +DELETE FROM t1 WHERE c1 = 12; + +--echo # +--echo # Do some statements on the non-transactional table. +--echo # +INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); +UPDATE t2 SET c1 = c1 + 10; +DELETE FROM t2 WHERE c1 = 12; + +--echo # +--echo # Commit transaction. +--echo # +COMMIT; +SELECT * FROM t1; +SELECT * FROM t2; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; + +--echo # +--echo # Start transaction #4, both tables, rollback. +--echo # +START TRANSACTION; + +--echo # +--echo # Do some statements on the transactional table. +--echo # +INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); +UPDATE t1 SET c1 = c1 + 10; +DELETE FROM t1 WHERE c1 = 12; + +--echo # +--echo # Do some statements on the non-transactional table. +--echo # +INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3'); +UPDATE t2 SET c1 = c1 + 10; +DELETE FROM t2 WHERE c1 = 12; + +--echo # +--echo # Rollback transaction. +--echo # +ROLLBACK; +SELECT * FROM t1; +SELECT * FROM t2; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; + +--echo # +--echo # Flush all log buffers to the log file. +--echo # +FLUSH LOGS; + +--echo # +--echo # Call mysqlbinlog to display the log file contents. +--echo # +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 + +--echo # +--echo # Cleanup. +--echo # +DROP TABLE t1, t2; + + |