From 89d572549dc8332097c5777c947cdb63dc88b99b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 22:03:55 +0100 Subject: [PATCH 1/2] New test for wl2321 mysql-test/t/rpl_row_mysqlbinlog.test: New mysqlbinlog test for row based binlogs per lars request for WL#2321 mysql-test/t/rpl_row_mysqlbinlog-master.opt: New mysqlbinlog test for row based binlogs per lars request for WL#2321 mysql-test/r/rpl_row_mysqlbinlog.result: New mysqlbinlog result WL#2321 --- mysql-test/r/rpl_row_mysqlbinlog.result | 250 +++++++++++++++++ mysql-test/t/rpl_row_mysqlbinlog-master.opt | 1 + mysql-test/t/rpl_row_mysqlbinlog.test | 287 ++++++++++++++++++++ 3 files changed, 538 insertions(+) create mode 100644 mysql-test/r/rpl_row_mysqlbinlog.result create mode 100644 mysql-test/t/rpl_row_mysqlbinlog-master.opt create mode 100644 mysql-test/t/rpl_row_mysqlbinlog.test diff --git a/mysql-test/r/rpl_row_mysqlbinlog.result b/mysql-test/r/rpl_row_mysqlbinlog.result new file mode 100644 index 00000000000..6faacf119be --- /dev/null +++ b/mysql-test/r/rpl_row_mysqlbinlog.result @@ -0,0 +1,250 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +set timestamp=1000000000; +DROP TABLE IF EXISTS t1,t2,t3; +CREATE TABLE t1(word VARCHAR(20)); +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +SELECT COUNT(*) from t1; +COUNT(*) +351 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 +SELECT COUNT(*) from t1; +COUNT(*) +351 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 +insert into t1 values ("Alas"); +flush logs; + +--- Dump -- +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +stop slave; +reset master; +reset slave; +start slave; +SELECT COUNT(*) from t1; +COUNT(*) +352 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 +SELECT COUNT(*) from t1; +COUNT(*) +352 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 + +--- --position -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +use test; +SET TIMESTAMP=1000000000; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; +SET @@session.sql_mode=0; +/*!\C latin1 */; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- Remote -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +ROLLBACK; +use test; +SET TIMESTAMP=1000000000; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; +SET @@session.sql_mode=0; +/*!\C latin1 */; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; +DROP TABLE IF EXISTS t1,t2,t3; +SET TIMESTAMP=1000000000; +CREATE TABLE t1(word VARCHAR(20)); +SET TIMESTAMP=1000000000; +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +SET TIMESTAMP=1000000000; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- LOAD DATA -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- reading stdin -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +ROLLBACK; +use test; +SET TIMESTAMP=1000000000; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; +SET @@session.sql_mode=0; +/*!\C latin1 */; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; +DROP TABLE IF EXISTS t1,t2,t3; +SET TIMESTAMP=1000000000; +CREATE TABLE t1(word VARCHAR(20)); +SET TIMESTAMP=1000000000; +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +SET TIMESTAMP=1000000000; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +use test; +SET TIMESTAMP=1000000000; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; +SET @@session.sql_mode=0; +/*!\C latin1 */; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +stop slave; +reset master; +reset slave; +start slave; +create table t4 (f text character set utf8); +create table t5 (f text character set cp932); +flush logs; +rename table t4 to t04, t5 to t05; +select HEX(f) from t04; +HEX(f) +E382BD +select HEX(f) from t4; +HEX(f) +E382BD +select HEX(f) from t05; +HEX(f) +835C +select HEX(f) from t5; +HEX(f) +835C +select HEX(f) from t04; +HEX(f) +E382BD +select HEX(f) from t4; +HEX(f) +E382BD +select HEX(f) from t05; +HEX(f) +835C +select HEX(f) from t5; +HEX(f) +835C +DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; diff --git a/mysql-test/t/rpl_row_mysqlbinlog-master.opt b/mysql-test/t/rpl_row_mysqlbinlog-master.opt new file mode 100644 index 00000000000..07d12817f5f --- /dev/null +++ b/mysql-test/t/rpl_row_mysqlbinlog-master.opt @@ -0,0 +1 @@ +--max-binlog-size=1040384 diff --git a/mysql-test/t/rpl_row_mysqlbinlog.test b/mysql-test/t/rpl_row_mysqlbinlog.test new file mode 100644 index 00000000000..1d4ce1706de --- /dev/null +++ b/mysql-test/t/rpl_row_mysqlbinlog.test @@ -0,0 +1,287 @@ +################################################################## +# Author: JBM # +# Date: 2006-02-22 # +# Purpose: To test changes to mysqlbinlog for row based bin logs # +# We are using .opt file since we need small binlog size # +################################################################## +# Include Section +# Make sure that we have row based bin log +-- source include/have_binlog_format_row.inc +# Embedded server doesn't support binlogging +-- source include/not_embedded.inc +-- source include/master-slave.inc + +# Setup Section +# we need this for getting fixed timestamps inside of this test +set timestamp=1000000000; + +--disable_warnings +DROP TABLE IF EXISTS t1,t2,t3; +--enable_warnings + +connection master; +CREATE TABLE t1(word VARCHAR(20)); +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); + + +# Test Section +# Lets start by putting some data into the tables. + +--disable_query_log +INSERT INTO t1 VALUES ("abirvalg"); +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; + +# d1 length 3000 +set @d1 = 'dd1'; +set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); +set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); +set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); + +let $count=500; +while ($count) +{ + INSERT INTO t2 VALUES (NULL); + eval INSERT INTO t3 VALUES ($count,@d1,'20060222000000','Tested in Texas',$count*2.2); + dec $count; +} +--enable_query_log + +# Lets Check the tables on the Master +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; + +# Should have the same on the slave; + +sync_slave_with_master; +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; + +# Okay time to get busy, back to master + +connection master; + +# simple query to show more in second binlog +insert into t1 values ("Alas"); +flush logs; + +# delimiters are for easier debugging in future +--disable_query_log +select "--- Dump --" as ""; +--enable_query_log + +# +# Prepare local temporary file to recreate what we have currently. + +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql + +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql + +# Now that we have our file, lets get rid of the current database. +# Cleanup the master and the slave and try to recreate. + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; + +sync_slave_with_master; +#we expect STOP SLAVE to produce a warning as the slave is stopped +#(the server was started with skip-slave-start) +--disable_warnings +stop slave; +--enable_warnings +--require r/slave-stopped.result +show status like 'Slave_running'; +connection master; +reset master; +connection slave; +reset slave; +start slave; +--require r/slave-running.result +show status like 'Slave_running'; +connection master; + +# We should be clean at this point, now we will run in the file from above. + +--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/master.sql" + +# Lets Check the tables on the Master +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; + +# Should have the same on the slave; + +sync_slave_with_master; +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +connection master; + +# We should be gold by the time, so I will get rid of our file. + +--exec rm $MYSQLTEST_VARDIR/tmp/master.sql + + +# this test for position option +# By setting this position to 412, we should only get the create of t3 +--disable_query_log +select "--- --position --" as ""; +--enable_query_log +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=412 $MYSQLTEST_VARDIR/log/master-bin.000001 + +# These are tests for remote binlog. +# They should return the same as previous test. + +--disable_query_log +select "--- Remote --" as ""; +--enable_query_log + +# This is broken now +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--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 part is disabled due to bug #17654 +################### Start Bug 17654 ###################### +#--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql + +#--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql + +# Now that we have our file, lets get rid of the current database. +# Cleanup the master and the slave and try to recreate. + +#DROP TABLE t1; +#DROP TABLE t2; +#DROP TABLE t3; + +#sync_slave_with_master; + +#we expect STOP SLAVE to produce a warning as the slave is stopped +#(the server was started with skip-slave-start) + +#--disable_warnings +#stop slave; +#--enable_warnings +#--require r/slave-stopped.result +#show status like 'Slave_running'; +#connection master; +#reset master; +#connection slave; +#reset slave; +#start slave; +#--require r/slave-running.result +#show status like 'Slave_running'; +#connection master; + +# We should be clean at this point, now we will run in the file from above. + +#--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/remote.sql" + +# Lets Check the tables on the Master + +#SELECT COUNT(*) from t1; +#SELECT COUNT(*) from t2; +#SELECT COUNT(*) from t3; +#SELECT * FROM t1 ORDER BY word LIMIT 5; +#SELECT * FROM t2 ORDER BY id LIMIT 5; +#SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; + +# Should have the same on the slave; + +#sync_slave_with_master; +#SELECT COUNT(*) from t1; +#SELECT COUNT(*) from t2; +#SELECT COUNT(*) from t3; +#SELECT * FROM t1 ORDER BY word LIMIT 5; +#SELECT * FROM t2 ORDER BY id LIMIT 5; +#SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +#connection master; + +# We should be gold by the time, so I will get rid of our file. + +#--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql +################### End Bug 17654 ###################### + +# LOAD DATA +--disable_query_log +select "--- LOAD DATA --" as ""; +--enable_query_log +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--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 + +# 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 +--exec $MYSQL_BINLOG --short-form - < $MYSQLTEST_VARDIR/log/master-bin.000001 + +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--exec $MYSQL_BINLOG --short-form --position=412 - < $MYSQLTEST_VARDIR/log/master-bin.000001 + +# Bug#16217 (mysql client did not know how not switch its internal charset) +sync_slave_with_master; + +#we expect STOP SLAVE to produce a warning as the slave is stopped +#(the server was started with skip-slave-start) + +--disable_warnings +stop slave; +--enable_warnings +--require r/slave-stopped.result +show status like 'Slave_running'; +connection master; +reset master; +connection slave; +reset slave; +start slave; +--require r/slave-running.result +show status like 'Slave_running'; +connection master; + +create table t4 (f text character set utf8); +create table t5 (f text character set cp932); +--exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')" +--exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'ƒ\');" +flush logs; +rename table t4 to t04, t5 to t05; +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL --default-character-set=utf8 +# original and recovered data must be equal +select HEX(f) from t04; +select HEX(f) from t4; +select HEX(f) from t05; +select HEX(f) from t5; + +# slave should have same +sync_slave_with_master; +select HEX(f) from t04; +select HEX(f) from t4; +select HEX(f) from t05; +select HEX(f) from t5; + +# clean up +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; +sync_slave_with_master; + +# End of 4.1 tests From 216bc447fb942cc5e4e4a580a91ec9496a540fe8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 23:11:42 +0100 Subject: [PATCH 2/2] rpl_row_mysqlbinlog.result, rpl_row_mysqlbinlog.test: Updated with echos for the results file requested by lars mysql-test/t/rpl_row_mysqlbinlog.test: Updated with echos for the results file requested by lars mysql-test/r/rpl_row_mysqlbinlog.result: Updated with echos for the results file requested by lars --- mysql-test/r/rpl_row_mysqlbinlog.result | 26 ++++++++++++--- mysql-test/t/rpl_row_mysqlbinlog.test | 42 ++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/rpl_row_mysqlbinlog.result b/mysql-test/r/rpl_row_mysqlbinlog.result index 6faacf119be..374f2d3ee82 100644 --- a/mysql-test/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/r/rpl_row_mysqlbinlog.result @@ -4,11 +4,15 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; + +---Setup Section -- set timestamp=1000000000; DROP TABLE IF EXISTS t1,t2,t3; CREATE TABLE t1(word VARCHAR(20)); CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); + +---Test1 check table load -- SELECT COUNT(*) from t1; COUNT(*) 351 @@ -72,7 +76,9 @@ c1 c3 c4 c5 insert into t1 values ("Alas"); flush logs; ---- Dump -- +--- Test 1 Dump binlog to file -- + +--- Test 1 delete tables, clean master and slave -- DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -80,6 +86,10 @@ stop slave; reset master; reset slave; start slave; + +--- Test 1 Load from Dump binlog file -- + +--- Test 1 Check Load Results -- SELECT COUNT(*) from t1; COUNT(*) 352 @@ -141,7 +151,7 @@ c1 c3 c4 c5 4 2006-02-22 00:00:00 Tested in Texas 8.8 5 2006-02-22 00:00:00 Tested in Texas 11 ---- --position -- +--- Test 2 position test -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; use test; @@ -155,7 +165,7 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ---- Remote -- +--- Test 3 First Remote test -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; @@ -176,14 +186,14 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ---- LOAD DATA -- +--- Test 5 LOAD DATA -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ---- reading stdin -- +--- Test 6 reading stdin -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; @@ -203,6 +213,8 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- Test 7 reading stdin w/position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; use test; @@ -215,6 +227,8 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- Test 8 switch internal charset -- stop slave; reset master; reset slave; @@ -247,4 +261,6 @@ HEX(f) select HEX(f) from t5; HEX(f) 835C + +--- Test cleanup -- DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; diff --git a/mysql-test/t/rpl_row_mysqlbinlog.test b/mysql-test/t/rpl_row_mysqlbinlog.test index 1d4ce1706de..3b4c8db86d8 100644 --- a/mysql-test/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/t/rpl_row_mysqlbinlog.test @@ -13,6 +13,11 @@ # Setup Section # we need this for getting fixed timestamps inside of this test + +--disable_query_log +select "---Setup Section --" as ""; +--enable_query_log + set timestamp=1000000000; --disable_warnings @@ -51,6 +56,11 @@ while ($count) } --enable_query_log + +--disable_query_log +select "---Test1 check table load --" as ""; +--enable_query_log + # Lets Check the tables on the Master SELECT COUNT(*) from t1; SELECT COUNT(*) from t2; @@ -79,7 +89,7 @@ flush logs; # delimiters are for easier debugging in future --disable_query_log -select "--- Dump --" as ""; +select "--- Test 1 Dump binlog to file --" as ""; --enable_query_log # @@ -91,6 +101,9 @@ select "--- Dump --" as ""; # Now that we have our file, lets get rid of the current database. # Cleanup the master and the slave and try to recreate. +--disable_query_log +select "--- Test 1 delete tables, clean master and slave --" as ""; +--enable_query_log DROP TABLE t1; DROP TABLE t2; @@ -114,9 +127,16 @@ show status like 'Slave_running'; connection master; # We should be clean at this point, now we will run in the file from above. +--disable_query_log +select "--- Test 1 Load from Dump binlog file --" as ""; +--enable_query_log --exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/master.sql" +--disable_query_log +select "--- Test 1 Check Load Results --" as ""; +--enable_query_log + # Lets Check the tables on the Master SELECT COUNT(*) from t1; SELECT COUNT(*) from t2; @@ -144,7 +164,7 @@ connection master; # this test for position option # By setting this position to 412, we should only get the create of t3 --disable_query_log -select "--- --position --" as ""; +select "--- Test 2 position test --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=412 $MYSQLTEST_VARDIR/log/master-bin.000001 @@ -153,7 +173,7 @@ select "--- --position --" as ""; # They should return the same as previous test. --disable_query_log -select "--- Remote --" as ""; +select "--- Test 3 First Remote test --" as ""; --enable_query_log # This is broken now @@ -162,6 +182,9 @@ select "--- Remote --" as ""; # This part is disabled due to bug #17654 ################### Start Bug 17654 ###################### +#--disable_query_log +#select "--- Test 4 Second Remote test --" as ""; +#--enable_query_log #--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql #--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql @@ -223,7 +246,7 @@ select "--- Remote --" as ""; # LOAD DATA --disable_query_log -select "--- LOAD DATA --" as ""; +select "--- Test 5 LOAD DATA --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --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 @@ -231,15 +254,21 @@ select "--- LOAD DATA --" as ""; # Bug#7853 (mysqlbinlog does not accept input from stdin) --disable_query_log -select "--- reading stdin --" as ""; +select "--- Test 6 reading stdin --" as ""; --enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --exec $MYSQL_BINLOG --short-form - < $MYSQLTEST_VARDIR/log/master-bin.000001 +--disable_query_log +select "--- Test 7 reading stdin w/position --" as ""; +--enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --exec $MYSQL_BINLOG --short-form --position=412 - < $MYSQLTEST_VARDIR/log/master-bin.000001 # Bug#16217 (mysql client did not know how not switch its internal charset) +--disable_query_log +select "--- Test 8 switch internal charset --" as ""; +--enable_query_log sync_slave_with_master; #we expect STOP SLAVE to produce a warning as the slave is stopped @@ -279,6 +308,9 @@ select HEX(f) from t4; select HEX(f) from t05; select HEX(f) from t5; +--disable_query_log +select "--- Test cleanup --" as ""; +--enable_query_log # clean up connection master; DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;