diff options
author | unknown <knielsen@knielsen-hq.org> | 2011-04-01 15:07:10 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2011-04-01 15:07:10 +0200 |
commit | c677fea7d01ef1fab3357496b309a3e3b3c00dfe (patch) | |
tree | b6000be3447e5a41440cffee8b8d927d37a1dcde /mysql-test | |
parent | 09bd2894973fbdbacec9bfc31a3635165b120200 (diff) | |
parent | 9aa44bb4b3e0fc69306626b961c7d9309e6ab114 (diff) | |
download | mariadb-git-c677fea7d01ef1fab3357496b309a3e3b3c00dfe.tar.gz |
Merge MariaDB 5.2.5 release into MariaDB-5.2-rpl.
Diffstat (limited to 'mysql-test')
1123 files changed, 19027 insertions, 12970 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index e565521a8b0..b0747558f2a 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -1,11 +1,11 @@ # Copyright (C) 2000-2006 MySQL AB # -# This library is free software; you can redistribute it and/or +# This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; version 2 # of the License. # -# This library is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. @@ -109,6 +109,7 @@ TEST_DIRS = t r include std_data std_data/parts collections \ suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \ suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r \ suite/innodb_plugin/include \ + suite/handler \ suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \ suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \ suite/engines/iuds/t suite/engines/rr_trx/include suite/engines/rr_trx/r \ diff --git a/mysql-test/README b/mysql-test/README index 3c8303ca070..0e147f83bd1 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -4,13 +4,14 @@ this directory. It will fire up the newly built mysqld and test it. Note that you do not have to have to do "make install", and you could actually have a co-existing MySQL installation. The tests will not -conflict with it. +conflict with it. To run the test suite in a source directory, you +must do make first. All tests must pass. If one or more of them fail on your system, please read the following manual section for instructions on how to report the problem: -http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html +http://kb.askmonty.org/v/reporting-bugs If you want to use an already running MySQL server for specific tests, use the --extern option to mysql-test-run. Please note that in this mode, @@ -27,7 +28,6 @@ With no test cases named on the command line, mysql-test-run falls back to the normal "non-extern" behavior. The reason for this is that some tests cannot run with an external server. - You can create your own test cases. To create a test case, create a new file in the t subdirectory using a text editor. The file should have a .test extension. For example: @@ -60,14 +60,19 @@ extension. For example: mysql test < t/test_case_name.test > r/test_case_name.result - mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test + mysqltest --record --database test --result-file=r/test_case_name.result < t/test_case_name.test When this is done, take a look at r/test_case_name.result - If the result is incorrect, you have found a bug. In this case, you should edit the test result to the correct results so that we can verify that the bug is corrected in future releases. -To submit your test case, put your .test file and .result file(s) into -a tar.gz archive, add a README that explains the problem, ftp the -archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail -to bugs@lists.mysql.com +If you want to submit your test case you can send it +to maria-developers@lists.launchpad.com or attach it to a bug report on +https://bugs.launchpad.net/maria/. + +If the test case is really big or if it contains 'not public' data, +then put your .test file and .result file(s) into a tar.gz archive, +add a README that explains the problem, ftp the archive to +ftp://ftp.askmonty.org/private and send a mail to +https://bugs.launchpad.net/maria/ about it. diff --git a/mysql-test/collections/default.weekly b/mysql-test/collections/default.weekly index e69de29bb2d..f10bc0776a0 100644..100755 --- a/mysql-test/collections/default.weekly +++ b/mysql-test/collections/default.weekly @@ -0,0 +1,8 @@ +perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st +perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.partition_alter1_2_ndb parts.part_supported_sql_func_innodb parts.partition_alter1_2_innodb parts.partition_alter4_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_ndb rpl_ndb.rpl_truncate_7ndb_2 main.archive-big main.sum_distinct-big main.mysqlbinlog_row_big main.alter_table-big main.variables-big main.type_newdecimal-big main.read_many_rows_innodb main.log_tables-big main.count_distinct3 main.events_time_zone main.merge-big main.create-big main.events_stress main.ssl-big funcs_1.myisam_views-big +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-row-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=row +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-mixed-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=mixed +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-row-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=row +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-mixed-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=mixed diff --git a/mysql-test/collections/mysql-5.1-bugteam.daily b/mysql-test/collections/mysql-5.1-bugteam.daily new file mode 100644 index 00000000000..0503bd49f73 --- /dev/null +++ b/mysql-test/collections/mysql-5.1-bugteam.daily @@ -0,0 +1,5 @@ +perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental diff --git a/mysql-test/collections/mysql-5.1-bugteam.push b/mysql-test/collections/mysql-5.1-bugteam.push new file mode 100644 index 00000000000..d01b98eb87f --- /dev/null +++ b/mysql-test/collections/mysql-5.1-bugteam.push @@ -0,0 +1,4 @@ +perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --suite=main --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --suite=main --embedded --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index 7f48341077e..fd6ba1c17fa 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -302,5 +302,58 @@ BINLOG ' SHOW BINLOG EVENTS; DROP TABLE t1; + +--echo +--echo # BUG#54903 BINLOG statement toggles session variables +--echo # ---------------------------------------------------------------------- +--echo # This test verify that BINLOG statement doesn't change current session's +--echo # variables foreign_key_checks and unique_checks. +--echo +CREATE TABLE t1 (c1 INT KEY); + +SET @@SESSION.foreign_key_checks= ON; +SET @@SESSION.unique_checks= ON; + +--echo # INSERT INTO t1 VALUES (1) +--echo # foreign_key_checks=0 and unique_checks=0 +BINLOG ' +dfLtTBMBAAAAKQAAANcAAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA== +'; + +SELECT * FROM t1; +--echo # Their values should be ON +SHOW SESSION VARIABLES LIKE "%_checks"; + +--echo +SET @@SESSION.foreign_key_checks= OFF; +SET @@SESSION.unique_checks= OFF; + +--echo # INSERT INTO t1 VALUES(2) +--echo # foreign_key_checks=1 and unique_checks=1 +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; + +SELECT * FROM t1; +--echo # Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; + +--echo # INSERT INTO t1 VALUES(2) +--echo # foreign_key_checks=1 and unique_checks=1 +--echo # It should not change current session's variables, even error happens +--error 1062 +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; + +SELECT * FROM t1; +--echo # Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; + +DROP TABLE t1; + disconnect fresh; diff --git a/mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test b/mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test index 54f3c538c79..d537e29c1a8 100644 --- a/mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test +++ b/mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test @@ -60,6 +60,7 @@ # Please, remove this test case after pushing WL#2687. ################################################################################ +RESET MASTER; --echo ################################################################################### --echo # CONFIGURATION diff --git a/mysql-test/extra/rpl_tests/rpl_EE_err.test b/mysql-test/extra/rpl_tests/rpl_EE_err.test index 205bbe79dac..0b3fec1f605 100644 --- a/mysql-test/extra/rpl_tests/rpl_EE_err.test +++ b/mysql-test/extra/rpl_tests/rpl_EE_err.test @@ -9,10 +9,6 @@ # check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and # Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986). #################################### -# Change Author: JBM -# Change Date: 2006-01-11 -# Change: Split test per lars review -#################################### #"REQUIREMENT: A master DROP TABLE on a table with non-existing MYI # file must be correctly replicated to the slave" #################################### @@ -23,8 +19,5 @@ flush tables; let $MYSQLD_DATADIR= `select @@datadir`; remove_file $MYSQLD_DATADIR/test/t1.MYI ; drop table if exists t1; -save_master_pos; -connection slave; -sync_with_master; -# End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test index 8d2f6c32233..861bd59253b 100644 --- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test +++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test @@ -1,14 +1,6 @@ # # Test of auto_increment with offset # -##################################### -# By: JBM -# Date: 2006-02-10 -# Change: NDB does not support auto inc -# in this usage. Currently there is no -# plan to implment. Skipping test when -# NDB is default engine. -##################################### -- source include/not_ndb_default.inc -- source include/master-slave.inc @@ -169,7 +161,7 @@ drop table t1; # auto_increment fields if the values of them are 0. There is an inconsistency # between slave and master. When MODE_NO_AUTO_VALUE_ON_ZERO are masters treat # -source include/master-slave-reset.inc; +source include/rpl_reset.inc; connection master; --disable_warnings @@ -210,12 +202,10 @@ INSERT INTO t2 VALUES(4); FLUSH LOGS; sync_slave_with_master; -let $diff_table_1= master:test.t1; -let $diff_table_2= slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; -let $diff_table_1= master:test.t2; -let $diff_table_2= slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; connection master; @@ -228,15 +218,14 @@ let $MYSQLD_DATADIR= `SELECT @@DATADIR`; --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL test sync_slave_with_master; -let $diff_table_1= master:test.t1; -let $diff_table_2= slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; -let $diff_table_1= master:test.t2; -let $diff_table_2= slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; # End cleanup +--connection master DROP TABLE t1; DROP TABLE t2; SET SQL_MODE=''; @@ -297,4 +286,29 @@ DROP TABLE t1; DROP TABLE t_ignored1; DROP TABLE t_ignored2; +# +# BUG#56662 +# The test verifies if the assertion of "next_insert_id == 0" +# will fail in ha_external_lock() function. +# +connection master; +CREATE TABLE t1 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, data INT) ENGINE=innodb; + +BEGIN; +--echo # Set sql_mode with NO_AUTO_VALUE_ON_ZERO for allowing +--echo # zero to fill the auto_increment field. +SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; +INSERT INTO t1(id,data) VALUES(0,2); +--echo # Resetting sql_mode without NO_AUTO_VALUE_ON_ZERO to +--echo # affect the execution of the transaction on slave. +SET SQL_MODE=0; +COMMIT; +SELECT * FROM t1; sync_slave_with_master; +SELECT * FROM t1; + +connection master; +DROP TABLE t1; +sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test b/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test index 0bfa46de113..30b25955ecb 100644 --- a/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test +++ b/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test @@ -29,8 +29,7 @@ commit; sync_slave_with_master; --echo #Test if the results are consistent on master and slave --echo #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS' -let $diff_table_1=master:test.t3; -let $diff_table_2=slave:test.t3; +let $diff_tables= master:t3, slave:t3; source include/diff_tables.inc; connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test b/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test index 614d79d9c2d..f93d435349f 100644 --- a/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test +++ b/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test @@ -60,14 +60,11 @@ connection master; sync_slave_with_master; --echo #Test if the results are consistent on master and slave --echo #for 'INVOKES A TRIGGER with $trigger_action action' -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; -let $diff_table_1=master:test.t4; -let $diff_table_2=slave:test.t4; +let $diff_tables= master:t4, slave:t4; source include/diff_tables.inc; -let $diff_table_1=master:test.t6; -let $diff_table_2=slave:test.t6; +let $diff_tables= master:t6, slave:t6; source include/diff_tables.inc; connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test b/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test index fece19b397d..d7c26ea42f1 100644 --- a/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test +++ b/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test @@ -41,11 +41,9 @@ connection master; sync_slave_with_master; --echo #Test if the results are consistent on master and slave --echo #for 'CALLS A FUNCTION which INVOKES A TRIGGER with $insert_action action' -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; -let $diff_table_1=master:test.t3; -let $diff_table_2=slave:test.t3; +let $diff_tables= master:t3, slave:t3; source include/diff_tables.inc; connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_charset.test b/mysql-test/extra/rpl_tests/rpl_charset.test index 8bcb60b0227..e56642cbcb5 100644 --- a/mysql-test/extra/rpl_tests/rpl_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_charset.test @@ -2,11 +2,7 @@ # This test will fail if the server/client does not support enough charsets. source include/master-slave.inc; ---disable_warnings set timestamp=1000000000; -drop database if exists mysqltest2; -drop database if exists mysqltest3; ---enable_warnings create database mysqltest2 character set latin2; set @@character_set_server=latin5; @@ -151,6 +147,6 @@ eval create table `t1` ( set @p=_latin1 'test'; update t1 set pk='test' where pk=@p; drop table t1; -sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test b/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test index 98638b0b1f6..7de4f421c35 100644 --- a/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test +++ b/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test @@ -1,16 +1,10 @@ -################################# -# Test updated to use a wrapper # -################################# - eval CREATE TABLE t1 (a INT) ENGINE=$engine_type; begin; insert into t1 values(1); flush tables with read lock; commit; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; # cleanup connection master; unlock tables; diff --git a/mysql-test/extra/rpl_tests/rpl_conflicts.test b/mysql-test/extra/rpl_tests/rpl_conflicts.test index 8a98059b0ad..943d254736d 100644 --- a/mysql-test/extra/rpl_tests/rpl_conflicts.test +++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test @@ -139,8 +139,13 @@ if (`SELECT @@global.binlog_format = 'ROW' AND @@global.slave_exec_mode = 'STRIC --echo ---- Wait until slave stops with an error ---- let $slave_sql_errno= 1032; # ER_KEY_NOT_FOUND source include/wait_for_slave_sql_error.inc; - let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); - --echo Last_SQL_Error = $err (expected "can't find record" error) + + --let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1) + --replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/ + --disable_query_log + --eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)' + --enable_query_log + SELECT * FROM t1; --echo ---- Resolve the conflict on the slave and restart SQL thread ---- @@ -165,4 +170,4 @@ connection master; DROP TABLE t1; --echo [on slave] -sync_slave_with_master; +--sync_slave_with_master diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test index f1064dc268f..3b0348cc29f 100644 --- a/mysql-test/extra/rpl_tests/rpl_ddl.test +++ b/mysql-test/extra/rpl_tests/rpl_ddl.test @@ -136,14 +136,6 @@ sync_slave_with_master; connection master; SET AUTOCOMMIT = 1; # -# 1. DROP all objects, which probably already exist, but must be created here -# ---disable_warnings -DROP DATABASE IF EXISTS mysqltest1; -DROP DATABASE IF EXISTS mysqltest2; -DROP DATABASE IF EXISTS mysqltest3; ---enable_warnings -# # 2. CREATE all objects needed # working database is mysqltest1 # working table (transactional!) is mysqltest1.t1 @@ -619,6 +611,3 @@ connection master; DROP DATABASE mysqltest1; # mysqltest2 was alreday DROPPED some tests before. DROP DATABASE mysqltest3; ---enable_warnings - --- source include/master-slave-end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test index bf7c1e05b24..0e862e041e6 100644 --- a/mysql-test/extra/rpl_tests/rpl_deadlock.test +++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test @@ -131,3 +131,4 @@ sync_slave_with_master; SET global max_relay_log_size= @my_max_relay_log_size; --echo End of 5.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test b/mysql-test/extra/rpl_tests/rpl_extra_col_master.test index 16c4bc8e2da..eb50149655e 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extra_col_master.test @@ -1,24 +1,7 @@ ############################################################# -# Author: Chuck -############################################################# # Purpose: To test having extra columns on the master WL#3915 # engine inspecific sourced part ############################################################# -# Change Author: Jeb -# Change: Cleanup and extend testing -############################################################# -# TODO: partition specific -# -- source include/have_partition.inc -# Note: Will be done in different test due to NDB using this -# test case. -############################################################ - -########### Clean up ################ ---disable_warnings ---disable_query_log -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t10,t11,t12,t13,t14,t15,t16,t17,t18,t31; ---enable_query_log ---enable_warnings # # Setup differently defined tables on master and slave @@ -1025,8 +1008,3 @@ SELECT c1,hex(c4),c5 FROM t5 ORDER BY c1; connection master; DROP TABLE t5; sync_slave_with_master; ---echo - -# END of 5.1 tests case - - diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test index 3b8e7663ec7..882ef2c4e63 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test @@ -1,19 +1,10 @@ ################################################# -# Author: Jeb -# Date: 2006-09-07 # Purpose: To test having extra columns on the slave. ################################################## # Some tests in here requre partitioning -- source include/have_partition.inc -########### Clean up ################ ---disable_warnings ---disable_query_log -DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17; ---enable_query_log ---enable_warnings - ################################################# ############ Different Table Def Test ########### ################################################# @@ -448,9 +439,9 @@ if (`SELECT $engine_type != 'NDB'`) } #--echo *** Drop t9 *** -#connection master; -#DROP TABLE t9; -#sync_slave_with_master; +connection master; +DROP TABLE t9; +sync_slave_with_master; ############################################ # More columns in slave at middle of table # @@ -725,6 +716,10 @@ sync_slave_with_master; --replace_column 5 CURRENT_TIMESTAMP SELECT * FROM t14a ORDER BY c1; +--connection master +DROP TABLE t14a; +--sync_slave_with_master + #################################################### # - Alter Master Dropping columns from the middle. # # Expect: columns dropped # @@ -912,17 +907,3 @@ connection slave; connection master; DROP TABLE t17; sync_slave_with_master; - -#### Clean Up #### ---disable_warnings ---disable_query_log -connection master; -DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17; -sync_slave_with_master; -connection master; ---enable_query_log ---enable_warnings - -# END 5.1 Test Case - - diff --git a/mysql-test/extra/rpl_tests/rpl_failed_optimize.test b/mysql-test/extra/rpl_tests/rpl_failed_optimize.test index cd81f2497b8..6817405b2d9 100644 --- a/mysql-test/extra/rpl_tests/rpl_failed_optimize.test +++ b/mysql-test/extra/rpl_tests/rpl_failed_optimize.test @@ -22,4 +22,5 @@ connection master; select * from t1; commit; drop table t1; --- sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test index fd51601176e..06253c5defb 100644 --- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test +++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test @@ -54,7 +54,6 @@ unlock tables; connection master; drop table t3, t4, t5; -sync_slave_with_master; - # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_foreign_key.test b/mysql-test/extra/rpl_tests/rpl_foreign_key.test index 8755bf5aa87..19cd1d783e1 100644 --- a/mysql-test/extra/rpl_tests/rpl_foreign_key.test +++ b/mysql-test/extra/rpl_tests/rpl_foreign_key.test @@ -60,6 +60,4 @@ select count(*) from t1 /* must be zero */; connection master; drop table t2,t1; -sync_slave_with_master; - - +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test index 40e155bc314..01036f72785 100644 --- a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test +++ b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test @@ -40,28 +40,16 @@ if (!$debug_sync_action) } # Restart slave ---disable_warnings -stop slave; -source include/wait_for_slave_to_stop.inc; +--source include/stop_slave.inc eval SET @@global.debug= "+d,$dbug_sync_point"; -start slave; -source include/wait_for_slave_to_start.inc; +--source include/start_slave.inc --echo slave is going to hang in get_master_version_and_clock -connection master; -# Write file to make mysql-test-run.pl expect the "crash", but don't start -# it until it's told to ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF +--let $rpl_server_number= 1 +--source include/rpl_stop_server.inc -# Send shutdown to the connected server and give -# it 10 seconds to die before zapping it -shutdown_server 10; - -connection slave; --echo slave is unblocked eval SET DEBUG_SYNC=$debug_sync_action; @@ -76,6 +64,7 @@ connection slave; # '1040' ER_CON_COUNT_ERROR # '1053' ER_SERVER_SHUTDOWN let $slave_io_errno= 1040, 1053, 2002, 2003, 2006, 2013; +--let $slave_io_error_is_nonfatal= 1 source include/wait_for_slave_io_error.inc; # deactivate the sync point of get_master_version_and_clock() @@ -84,21 +73,12 @@ source include/wait_for_slave_io_error.inc; # unset. eval set @@global.debug = "-d,$dbug_sync_point"; -# Write file to make mysql-test-run.pl start up the server again ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF - -connection master; -# Turn on reconnect ---enable_reconnect - -# Call script that will poll the server waiting for it to be back online again ---source include/wait_until_connected_again.inc - -# Turn off reconnect again ---disable_reconnect - -connection slave; -source include/wait_for_slave_to_start.inc; +--let $rpl_server_number= 1 +--source include/rpl_start_server.inc +# We don't source include/wait_for_slave_io_to_start.inc, because the +# IO thread has an error and wait_for_slave_io_to_start.inc fails if +# the IO thread has an error. +--let $slave_param= Slave_IO_Running +--let $slave_param_value= Yes +--source include/wait_for_slave_param.inc diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test index bd815d9de02..38dfc818041 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test @@ -1,6 +1,4 @@ ########################################################### -# 2006-02-01: By JBM: Added 1022, ORDER BY -########################################################### # See if queries that use both auto_increment and LAST_INSERT_ID() # are replicated well ############################################################ @@ -14,9 +12,6 @@ --echo # use test; ---disable_warnings -drop table if exists t1, t2, t3; ---enable_warnings --echo # --echo # See if queries that use both auto_increment and LAST_INSERT_ID() @@ -42,9 +37,7 @@ eval create table t2(b int auto_increment, c int, key(b)) engine=$engine_type; insert into t1 values (1),(2),(3); insert into t1 values (null); insert into t2 values (null,last_insert_id()); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1 ORDER BY a; select * from t2 ORDER BY b; connection master; @@ -63,9 +56,7 @@ insert into t1 values (null),(null),(null); insert into t2 values (5,0); insert into t2 values (null,last_insert_id()); SET FOREIGN_KEY_CHECKS=1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1; select * from t2; connection master; @@ -83,17 +74,13 @@ insert into t1 values (null),(null),(null); insert into t2 values (5,0); insert into t2 (c) select * from t1 ORDER BY a; select * from t2 ORDER BY b; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1 ORDER BY a; select * from t2 ORDER BY b; connection master; drop table t1; drop table t2; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; --echo # --echo # Bug#8412: Error codes reported in binary log for CHARACTER SET, @@ -208,9 +195,7 @@ call foo(); select * from t1; select * from t2; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1; select * from t2; connection master; @@ -548,4 +533,5 @@ connection master; drop table t1, t2; drop procedure foo; SET @@global.concurrent_insert= @old_concurrent_insert; -sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test index 0be33a46c04..c6fc7ef1aae 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test @@ -1,6 +1,4 @@ ########################################################### -# 2006-02-08: By JBM: -########################################################### # See if queries that use both auto_increment and LAST_INSERT_ID() # are replicated well ############################################################ @@ -20,9 +18,7 @@ create table t2(b int auto_increment, c int, primary key(b)); insert into t1 values (1),(2),(3); insert into t1 values (null); insert into t2 values (null,last_insert_id()); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1 ORDER BY a; select * from t2 ORDER BY b; connection master; @@ -41,9 +37,7 @@ insert into t1 values (null),(null),(null); insert into t2 values (5,0); insert into t2 values (null,last_insert_id()); SET FOREIGN_KEY_CHECKS=1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1; select * from t2; connection master; @@ -59,17 +53,13 @@ insert into t1 values (null),(null),(null); insert into t2 values (5,0); insert into t2 (c) select * from t1 ORDER BY a; select * from t2 ORDER BY b; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1 ORDER BY a; select * from t2 ORDER BY b; connection master; drop table t1; drop table t2; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; # # Bug#8412: Error codes reported in binary log for CHARACTER SET, @@ -85,3 +75,5 @@ INSERT INTO t1 VALUES (1),(1); drop table t1; sync_slave_with_master; # End of 4.1 tests + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test index c4fa9f16dc7..4a21123e8a1 100644 --- a/mysql-test/extra/rpl_tests/rpl_loaddata.test +++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test @@ -1,6 +1,3 @@ -# Requires statement logging --- source include/have_binlog_format_statement.inc - # See if replication of a "LOAD DATA in an autoincrement column" # Honours autoincrement values # i.e. if the master and slave have the same sequence @@ -14,13 +11,10 @@ # check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and # Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986) +-- source include/have_binlog_format_statement.inc -- source include/master-slave.inc source include/have_innodb.inc; -connection slave; -reset master; -connection master; - # MTR is not case-sensitive. let $lower_stmt_head= load data; let $UPPER_STMT_HEAD= LOAD DATA; @@ -45,9 +39,7 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fi create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); insert into t3 select * from t2; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1; select * from t3; @@ -59,9 +51,7 @@ drop table t2; drop table t3; create table t1(a int, b int, unique(b)); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; # See if slave stops when there's a duplicate entry for key error in LOAD DATA @@ -72,21 +62,16 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1; save_master_pos; connection slave; -# The SQL slave thread should be stopped now. ---source include/wait_for_slave_sql_to_stop.inc +# 1062 = ER_DUP_ENTRY +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error_and_skip.inc # Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START # SLAVE, even though we are not executing any event (as sql_slave_skip_counter # takes us directly to the end of the relay log). -set global sql_slave_skip_counter=1; -start slave; sync_with_master; -let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); -echo Last_SQL_Errno=$last_error; -let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); -echo Last_SQL_Error; -echo $last_error; +--source include/check_slave_no_error.inc # Trigger error again to test CHANGE MASTER @@ -100,17 +85,15 @@ connection slave; # The SQL slave thread should be stopped now. # Exec_Master_Log_Pos should point to the start of Execute event # for last load data. ---source include/wait_for_slave_sql_to_stop.inc +# 1062 = ER_DUP_ENTRY +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc # CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS. -stop slave; +--source include/stop_slave_io.inc change master to master_user='test'; change master to master_user='root'; -let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); -echo Last_SQL_Errno=$last_error; -let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); -echo Last_SQL_Error; -echo $last_error; +--source include/check_slave_no_error.inc # Trigger error again to test RESET SLAVE @@ -125,16 +108,14 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1; save_master_pos; connection slave; # The SQL slave thread should be stopped now. ---source include/wait_for_slave_sql_to_stop.inc +# 1062 = ER_DUP_ENTRY +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc # RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS. stop slave; reset slave; -let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); -echo Last_SQL_Errno=$last_error; -let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); -echo Last_SQL_Error; -echo $last_error; +--source include/check_slave_no_error.inc # Finally, see if logging is done ok on master for a failing LOAD DATA INFILE @@ -165,6 +146,7 @@ terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by connection slave; --source include/wait_for_slave_sql_to_stop.inc drop table t1, t2; +--source include/stop_slave_io.inc connection master; drop table t1, t2; @@ -178,7 +160,8 @@ DROP TABLE IF EXISTS t1; # BUG#48297: Schema name is ignored when LOAD DATA is written into binlog, # replication aborts --- source include/master-slave-reset.inc +-- let $rpl_only_running_threads= 1 +-- source include/rpl_reset.inc -- let $db1= b48297_db1 -- let $db2= b42897_db2 @@ -239,8 +222,7 @@ connect (conn2,localhost,root,,*NO-ONE*); -- sync_slave_with_master -- eval use $db1 -let $diff_table_1=master:$db1.t1; -let $diff_table_2=slave:$db1.t1; +let $diff_tables= master:$db1.t1, slave:$db1.t1; source include/diff_tables.inc; -- connection master @@ -251,7 +233,7 @@ source include/diff_tables.inc; -- sync_slave_with_master # BUG#49479: LOAD DATA INFILE is binlogged without escaping field names --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master use test; CREATE TABLE t1 (`key` TEXT, `text` TEXT); @@ -262,6 +244,6 @@ SELECT * FROM t1; -- sync_slave_with_master -- connection master DROP TABLE t1; --- sync_slave_with_master # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index 9effeee1292..4de8169a2e6 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -125,7 +125,7 @@ DROP TABLE t3; # Reset binlog so that show binlog events will not show the tests # above. -source include/master-slave-reset.inc; +source include/rpl_reset.inc; connection master; create table t1(a int auto_increment primary key, b int); diff --git a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test index 8415522ec92..d8cd4f2d284 100644 --- a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test +++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test @@ -6,9 +6,6 @@ # Requires statement logging -- source include/master-slave.inc -# We have to sync with master, to ensure slave had time to start properly -# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log. -sync_slave_with_master; connection slave; stop slave; connection master; @@ -117,3 +114,4 @@ set global max_binlog_size= @my_max_binlog_size; --echo # --echo # End of 4.1 tests --echo # +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_multi_query.test b/mysql-test/extra/rpl_tests/rpl_multi_query.test index 2438556450d..ae2a3aa45d2 100644 --- a/mysql-test/extra/rpl_tests/rpl_multi_query.test +++ b/mysql-test/extra/rpl_tests/rpl_multi_query.test @@ -7,9 +7,6 @@ # PS doesn't support multi-statements --disable_ps_protocol -- source include/master-slave.inc ---disable_warnings -drop database if exists mysqltest; ---enable_warnings create database mysqltest; delimiter /; @@ -25,4 +22,5 @@ select * from mysqltest.t1; connection master; source include/show_binlog_events.inc; drop database mysqltest; -sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_multi_update.test b/mysql-test/extra/rpl_tests/rpl_multi_update.test index 121ae18daa8..bf7707f9d6d 100644 --- a/mysql-test/extra/rpl_tests/rpl_multi_update.test +++ b/mysql-test/extra/rpl_tests/rpl_multi_update.test @@ -19,12 +19,11 @@ SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; # End of 4.1 tests connection master; drop table t1, t2; -sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test index 3de1d42c34f..6b968fe2e86 100644 --- a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test +++ b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test @@ -226,7 +226,7 @@ connection master; # Reset both slave and master # This should reset binlog to #1 ---source include/master-slave-reset.inc +--source include/rpl_reset.inc --echo diff --git a/mysql-test/extra/rpl_tests/rpl_not_null.test b/mysql-test/extra/rpl_tests/rpl_not_null.test index 58dbd9ce29f..86f49d1665c 100644 --- a/mysql-test/extra/rpl_tests/rpl_not_null.test +++ b/mysql-test/extra/rpl_tests/rpl_not_null.test @@ -71,12 +71,10 @@ INSERT INTO t4(a) VALUES (5); sync_slave_with_master; --echo TABLES t1 and t2 must be equal otherwise an error will be thrown. -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; --echo TABLES t2 and t3 must be different. @@ -101,8 +99,7 @@ REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300); sync_slave_with_master; --echo TABLES t1 and t2 must be equal otherwise an error will be thrown. -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; --echo ************* CLEANING ************* @@ -154,8 +151,7 @@ REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00'); --echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* --echo TABLES t1 and t2 must be equal otherwise an error will be thrown. sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; connection master; @@ -273,7 +269,7 @@ sync_slave_with_master; # SELECT * FROM t3 ORDER BY a; # connection slave; # SELECT * FROM t3 ORDER BY a; -# --source include/reset_master_and_slave.inc +# --source include/rpl_reset.inc # # connection master; # diff --git a/mysql-test/extra/rpl_tests/rpl_record_compare.test b/mysql-test/extra/rpl_tests/rpl_record_compare.test index dc27dcb1f9d..f29e4fb791a 100644 --- a/mysql-test/extra/rpl_tests/rpl_record_compare.test +++ b/mysql-test/extra/rpl_tests/rpl_record_compare.test @@ -4,7 +4,7 @@ # -- echo ## case #1 - last_null_bit_pos==0 in record_compare without X bit --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master -- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1 @@ -16,8 +16,7 @@ UPDATE t1 SET c5 = 'a'; -- enable_warnings -- sync_slave_with_master --- let $diff_table_1= master:test.t1 --- let $diff_table_2= slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc --connection master @@ -26,7 +25,7 @@ DROP TABLE t1; -- echo ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit -- echo ## (1 column less and no varchar) --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master -- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1 @@ -38,8 +37,7 @@ UPDATE t1 SET c5 = 'a'; -- enable_warnings -- sync_slave_with_master --- let $diff_table_1= master:test.t1 --- let $diff_table_2= slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc --connection master @@ -48,7 +46,7 @@ DROP TABLE t1; -- echo ## case #2 - X bit is wrongly set. --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master -- eval CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=$engine DEFAULT CHARSET= latin1 @@ -57,8 +55,7 @@ INSERT INTO t1(c1) VALUES (NULL); UPDATE t1 SET c1= 0; -- sync_slave_with_master --- let $diff_table_1= master:test.t1 --- let $diff_table_2= slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test index 5c7d33d519e..04ab8751e39 100644 --- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test @@ -54,9 +54,9 @@ source include/check_slave_no_error.inc; change master to master_user='impossible_user_name'; start slave; let $slave_io_errno= 1045; -source include/wait_for_slave_io_error.inc; +--source include/wait_for_slave_io_error.inc +--source include/stop_slave_sql.inc -source include/stop_slave.inc; change master to master_user='root'; source include/start_slave.inc; source include/check_slave_no_error.inc; @@ -69,8 +69,11 @@ source include/stop_slave.inc; change master to master_user='impossible_user_name'; start slave; let $slave_io_errno= 1045; -source include/wait_for_slave_io_error.inc; +--source include/wait_for_slave_io_error.inc +--source include/stop_slave_sql.inc -source include/stop_slave.inc; reset slave; source include/check_slave_no_error.inc; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_row_UUID.test b/mysql-test/extra/rpl_tests/rpl_row_UUID.test index 9f2dbb4ce4b..368596d4fbc 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_UUID.test +++ b/mysql-test/extra/rpl_tests/rpl_row_UUID.test @@ -75,5 +75,3 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql $MYSQLTEST_VARDIR/tmp/r # this cleanup as no other test will use these files and they'll # be removed at next testsuite run. -# End of 5.0 test case --- source include/master-slave-end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_row_annotate.test b/mysql-test/extra/rpl_tests/rpl_row_annotate.test index 290d0a89b46..77c5f626e28 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_annotate.test +++ b/mysql-test/extra/rpl_tests/rpl_row_annotate.test @@ -153,3 +153,4 @@ DROP DATABASE test1; sync_slave_with_master; --enable_query_log +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test index 84f7b79e733..540975f24fb 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_basic.test +++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test @@ -2,6 +2,13 @@ # Basic tests of row-level logging # +--disable_query_log +--disable_result_log +# Add suppression for expected warning(s) in error log +call mtr.add_suppression("Can't find record in 't.'"); +--enable_query_log +--enable_result_log + # # First we test tables with only an index. # @@ -241,7 +248,7 @@ DELETE FROM t1; sync_slave_with_master; # Just to get a clean binary log -source include/reset_master_and_slave.inc; +--source include/rpl_reset.inc --echo **** On Master **** connection master; @@ -353,8 +360,7 @@ INSERT INTO t1 VALUES (1, "", 1); INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2); sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; --echo [expecting slave to replicate correctly] @@ -363,8 +369,7 @@ INSERT INTO t2 VALUES (1, "", 1); INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2); sync_slave_with_master; -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; --echo [expecting slave to stop] @@ -374,16 +379,12 @@ INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2); connection slave; # 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1535 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc -connection master; -RESET MASTER; -connection slave; -STOP SLAVE; -RESET SLAVE; -START SLAVE; -source include/wait_for_slave_to_start.inc; + +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc --echo [expecting slave to replicate correctly] connection master; @@ -391,8 +392,7 @@ INSERT INTO t4 VALUES (1, "", 1); INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2); sync_slave_with_master; -let $diff_table_1=master:test.t4; -let $diff_table_2=slave:test.t4; +let $diff_tables= master:t4, slave:t4; source include/diff_tables.inc; --echo [expecting slave to stop] @@ -402,16 +402,11 @@ INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2); connection slave; # 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1535 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc -connection master; -RESET MASTER; -connection slave; -STOP SLAVE; -RESET SLAVE; -START SLAVE; -source include/wait_for_slave_to_start.inc; + +--source include/rpl_reset.inc --echo [expecting slave to stop] connection master; @@ -420,16 +415,11 @@ INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2); connection slave; # 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1535 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc -connection master; -RESET MASTER; -connection slave; -STOP SLAVE; -RESET SLAVE; -START SLAVE; -source include/wait_for_slave_to_start.inc; + +--source include/rpl_reset.inc --echo [expecting slave to replicate correctly] connection master; @@ -437,8 +427,7 @@ INSERT INTO t7 VALUES (1, "", 1); INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2); sync_slave_with_master; -let $diff_table_1=master:test.t7; -let $diff_table_2=slave:test.t7; +let $diff_tables= master:t7, slave:t7; source include/diff_tables.inc; connection master; @@ -458,8 +447,7 @@ UPDATE t1 SET a = 10; INSERT INTO t1 VALUES (4); sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; connection master; @@ -537,8 +525,7 @@ UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6; --sync_slave_with_master --echo *** results: t2 must be consistent **** -let $diff_table_1=master:test.t2; -let $diff_table_2=master:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; --connection master @@ -576,8 +563,7 @@ UPDATE t1 SET a = 8 WHERE a < 5; sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; connection master; @@ -639,8 +625,7 @@ UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3; sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test index 214027160a9..bad308ff814 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test +++ b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test @@ -14,9 +14,8 @@ flush tables; SELECT * FROM t1 ORDER BY a; sync_slave_with_master; -connection master; -sync_slave_with_master; SELECT * FROM t1 ORDER BY a; connection master; drop table t1; -sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp002.test b/mysql-test/extra/rpl_tests/rpl_row_sp002.test index 5a2ab1912b8..c52cf344c5f 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp002.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp002.test @@ -1,9 +1,6 @@ ############################################################################# # This test is being created to test out the non deterministic items with # # row based replication. # -# Original Author: JBM # -# Original Date: Aug/09/2005 # -# Updated: Aug/29/2005 # ############################################################################# # Test: Contains two stored procedures test one that insert data into tables# # and use the LAST_INSERTED_ID() on tables with FOREIGN KEY(a) # @@ -13,9 +10,6 @@ # the table depending on the CASE outcome. The test uses this SP in a# # transaction first rolling back and then commiting, # ############################################################################# -# Mod Date: 08/22/2005 # -# TEST: Added test to include UPDATE CASCADE on table with FK per Trudy # -############################################################################# @@ -24,18 +18,6 @@ -- source include/master-slave.inc -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP PROCEDURE IF EXISTS test.p3; -DROP TABLE IF EXISTS test.t3; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; ---enable_warnings -# End of cleanup - # Begin test section 1 eval CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=$engine_type; @@ -71,9 +53,7 @@ SELECT * FROM test.t2; let $message=< -- test 1 select slave after p1 -- >; --source include/show_msg.inc -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; SELECT * FROM test.t1; SELECT * FROM test.t2; @@ -86,9 +66,7 @@ SELECT * FROM test.t2; let $message=< -- test 1 select slave after p2 -- >; --source include/show_msg.inc -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; SELECT * FROM test.t1; SELECT * FROM test.t2; @@ -136,9 +114,7 @@ SELECT * FROM test.t2; let $message=< -- test 2 select Slave after p1 -- >; --source include/show_msg.inc -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; SELECT * FROM test.t1; SELECT * FROM test.t2; @@ -153,9 +129,7 @@ SELECT * FROM test.t2; let $message=< -- test 1 select Slave after p2 -- >; --source include/show_msg.inc -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; SELECT * FROM test.t1; SELECT * FROM test.t2; @@ -195,9 +169,7 @@ while ($n) ROLLBACK; select * from test.t3; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from test.t3; connection master; @@ -216,9 +188,7 @@ while ($n) COMMIT; select * from test.t3; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from test.t3; connection master; @@ -228,12 +198,12 @@ connection master; # First lets cleanup SET AUTOCOMMIT=1; SET FOREIGN_KEY_CHECKS=0; -DROP PROCEDURE IF EXISTS test.p3; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; -sync_slave_with_master; +DROP PROCEDURE test.p3; +DROP PROCEDURE test.p1; +DROP PROCEDURE test.p2; +DROP TABLE test.t1; +DROP TABLE test.t2; +DROP TABLE test.t3; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp007.test b/mysql-test/extra/rpl_tests/rpl_row_sp007.test index 8f2b72e4d32..492cd2d88f1 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp007.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp007.test @@ -1,8 +1,4 @@ ############################################################################# -# Original Author: JBM # -# Original Date: Aug/15/2005 # -# Updated: 08/29/2005 Remove sleeps # -############################################################################# # TEST: SP that creates table, starts tranaction inserts. Save point, insert# # rollback to save point and then commits. # ############################################################################# @@ -10,14 +6,6 @@ -- source include/have_binlog_format_row.inc -- source include/master-slave.inc -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t1; ---enable_warnings -# End of cleanup - # Begin test section 1 delimiter |; eval CREATE PROCEDURE test.p1(IN i INT) @@ -42,9 +30,7 @@ SELECT * FROM test.t1; let $message=< ---- Slave selects-- >; --source include/show_msg.inc -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; SELECT * FROM test.t1; let $message=< ---- Master selects-- >; @@ -55,16 +41,15 @@ SELECT * FROM test.t1; let $message=< ---- Slave selects-- >; --source include/show_msg.inc -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; SELECT * FROM test.t1; connection master; #show binlog events; -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t1; +DROP PROCEDURE test.p1; +DROP TABLE test.t1; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_set_null.test b/mysql-test/extra/rpl_tests/rpl_set_null.test index f2aba089279..3755c8bbfa5 100644 --- a/mysql-test/extra/rpl_tests/rpl_set_null.test +++ b/mysql-test/extra/rpl_tests/rpl_set_null.test @@ -29,7 +29,7 @@ # BUG#49481: RBR: MyISAM and bit fields may cause slave to stop on # delete cant find record --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master -- eval CREATE TABLE t1 (c1 BIT, c2 INT) Engine=$engine @@ -37,8 +37,7 @@ INSERT INTO `t1` VALUES ( 1, 1 ); UPDATE t1 SET c1=NULL where c2=1; -- sync_slave_with_master --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master @@ -46,15 +45,14 @@ UPDATE t1 SET c1=NULL where c2=1; DELETE FROM t1 WHERE c2=1 LIMIT 1; -- sync_slave_with_master --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE t1; -- sync_slave_with_master --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master @@ -68,8 +66,7 @@ SELECT * FROM t1; UPDATE t1 SET c1=NULL WHERE c1='w'; -- sync_slave_with_master --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master @@ -77,8 +74,7 @@ UPDATE t1 SET c1=NULL WHERE c1='w'; DELETE FROM t1 LIMIT 2; -- sync_slave_with_master --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master diff --git a/mysql-test/extra/rpl_tests/rpl_stm_000001.test b/mysql-test/extra/rpl_tests/rpl_stm_000001.test deleted file mode 100644 index 4397e81aadf..00000000000 --- a/mysql-test/extra/rpl_tests/rpl_stm_000001.test +++ /dev/null @@ -1,131 +0,0 @@ -# Requires binlog_format=statement format since query involving -# get_lock() is logged in row format if binlog_format=mixed or row. --- source include/have_binlog_format_statement.inc --- source include/master-slave.inc - -CALL mtr.add_suppression("Statement may not be safe to log in statement format."); - -# Load some data into t1 -create table t1 (word char(20) not null); -load data infile '../../std_data/words.dat' into table t1; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1; -select * from t1 limit 10; - -# -# Test slave with wrong password -# -sync_slave_with_master; -stop slave; -connection master; -set password for root@"localhost" = password('foo'); -connection slave; -start slave; -connection master; -# -# Give slave time to do at last one failed connect retry -# This one must be short so that the slave will not stop retrying -real_sleep 2; -set password for root@"localhost" = password(''); -# Give slave time to connect (will retry every second) -sleep 2; - -create table t3(n int); -insert into t3 values(1),(2); -sync_slave_with_master; -select * from t3; -select sum(length(word)) from t1; -connection master; -drop table t1,t3; -sync_slave_with_master; - -# Test if the slave SQL thread can be more than 16K behind the slave -# I/O thread (> IO_SIZE) - -connection master; -# we'll use table-level locking to delay slave SQL thread -eval create table t1 (n int) engine=$engine_type; -sync_slave_with_master; -connection master; -reset master; -connection slave; -stop slave; -reset slave; - -connection master; -let $1=5000; -# Generate 16K of relay log -disable_query_log; -while ($1) -{ - eval insert into t1 values($1); - dec $1; -} -enable_query_log; - -# Try to cause a large relay log lag on the slave by locking t1 -connection slave; -lock tables t1 read; -start slave; -#hope this is long enough for I/O thread to fetch over 16K relay log data -sleep 3; -unlock tables; - -#test handling of aborted connection in the middle of update - -connection master; -create table t2(id int); -insert into t2 values(connection_id()); - -connection master1; -# Avoid generating result -create temporary table t3(n int); ---disable_warnings -insert into t3 select get_lock('crash_lock%20C', 1) from t2; ---enable_warnings - -connection master; -send update t1 set n = n + get_lock('crash_lock%20C', 2); -connection master1; -sleep 3; -select (@id := id) - id from t2; -kill @id; -# We don't drop t3 as this is a temporary table -drop table t2; -connection master; -# The get_lock function causes warning for unsafe statement. ---disable_warnings ---error 1317,2013 -reap; ---enable_warnings -connection slave; -# The SQL slave thread should now have stopped because the query was killed on -# the master (so it has a non-zero error code in the binlog). ---source include/wait_for_slave_sql_to_stop.inc - -# The following test can't be done because the result of Pos will differ -# on different computers -# --replace_result $MASTER_MYPORT MASTER_PORT -# show slave status; - -set global sql_slave_skip_counter=1; -start slave; -select count(*) from t1; -connection master1; -drop table t1; -create table t1 (n int); -insert into t1 values(3456); -insert into mysql.user (Host, User, Password) - VALUES ("10.10.10.%", "blafasel2", password("blafasel2")); -select select_priv,user from mysql.user where user = _binary'blafasel2'; -update mysql.user set Select_priv = "Y" where User= _binary"blafasel2"; -select select_priv,user from mysql.user where user = _binary'blafasel2'; -sync_slave_with_master; -select n from t1; -select select_priv,user from mysql.user where user = _binary'blafasel2'; -connection master1; -drop table t1; -delete from mysql.user where user="blafasel2"; -sync_slave_with_master; - -# End of 4.1 tests diff --git a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test index 2c396c9a209..d4140785878 100644 --- a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test +++ b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test @@ -30,6 +30,11 @@ let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); --echo Error: "$error" (expected different error codes on master and slave) --echo Errno: "$errno" (expected 0) drop table t1; +--source include/stop_slave.inc +# Clear error messages. +RESET SLAVE; # End of 4.1 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_stm_create_if_not_exists.test b/mysql-test/extra/rpl_tests/rpl_stm_create_if_not_exists.test index 65d2483dc4b..cecbd45c02a 100644 --- a/mysql-test/extra/rpl_tests/rpl_stm_create_if_not_exists.test +++ b/mysql-test/extra/rpl_tests/rpl_stm_create_if_not_exists.test @@ -19,10 +19,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1 (c1 INT , c2 INT, c3 char(10), c4 SELECT 'abc' AS c3, 1 AS c4; source include/show_binlog_events.inc; +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:t1,slave:t1 + --source include/diff_tables.inc } --echo @@ -36,10 +39,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1 SELECT 'abc', 2; source include/show_binlog_events.inc; +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:t1,slave:t1 + --source include/diff_tables.inc } --echo @@ -57,10 +63,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS test.t1 SELECT 'abc', 20; source include/show_binlog_events.inc; +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:test.t1,slave:test.t1 + --source include/diff_tables.inc } USE test; DROP DATABASE db1; @@ -74,10 +83,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1 REPLACE SELECT '123', 2; source include/show_binlog_events.inc; +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:t1,slave:t1 + --source include/diff_tables.inc } --echo @@ -89,10 +101,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1 IGNORE SELECT '123', 2; source include/show_binlog_events.inc; +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:t1,slave:t1 + --source include/diff_tables.inc } --echo @@ -103,10 +118,14 @@ let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); eval CREATE $_temporary TABLE IF NOT EXISTS t1 SELECT '123', 2; source include/show_binlog_events.inc; + +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:t1,slave:t1 + --source include/diff_tables.inc } --echo @@ -121,10 +140,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1 IGNORE (SELECT '123', 3) UNION (SELECT '123', 4); source include/show_binlog_events.inc; +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:t1,slave:t1 + --source include/diff_tables.inc } if (!$is_temporary) @@ -155,10 +177,14 @@ let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); call p1(500); call p1(600); source include/show_binlog_events.inc; + +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:t1,slave:t1 + --source include/diff_tables.inc } DROP PROCEDURE p1; @@ -173,10 +199,14 @@ EXECUTE stm USING @a; SET @a= 800; EXECUTE stm USING @a; source include/show_binlog_events.inc; + +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:t1,slave:t1 + --source include/diff_tables.inc } --echo @@ -224,10 +254,13 @@ eval /*!CREATE $_temporary TABLE IF NOT EXISTS t1 */SELECT 'abc', 905; source include/show_binlog_events.inc; +--sync_slave_with_master +--connection master + if (!$is_temporary) { - let $diff_table= test.t1; - source include/rpl_diff_tables.inc; + --let $diff_tables= master:t1,slave:t1 + --source include/diff_tables.inc } DROP TABLE t2; diff --git a/mysql-test/extra/rpl_tests/rpl_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_stop_slave.test index 7c88afe3532..2153db09eb2 100644 --- a/mysql-test/extra/rpl_tests/rpl_stop_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_stop_slave.test @@ -42,6 +42,7 @@ send STOP SLAVE SQL_THREAD; connection slave1; --echo # To resume slave SQL thread SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; --echo @@ -52,8 +53,7 @@ source include/wait_for_slave_sql_to_stop.inc; --echo # Slave should stop after the transaction has committed. --echo # So t1 on master is same to t1 on slave. -let diff_table_1=master:test.t1; -let diff_table_2=slave:test.t1; +let diff_tables= master:t1, slave:t1; source include/diff_tables.inc; connection slave; diff --git a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test index 3b6fe7a0ef4..bb740e59b11 100644 --- a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test +++ b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test @@ -1,12 +1,3 @@ -#################### -# Change Author: JBM -# Change Date: 2006-01-17 -# Change: Added order by in select -#################### -# Change Date: 2006-02-02 -# Change: renamed to make bettre sense, -# and wrapped per Engine test -############################ source include/master-slave.inc; # @@ -32,4 +23,4 @@ connection master; DROP TABLE t1; sync_slave_with_master; -# End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_test_framework.inc b/mysql-test/extra/rpl_tests/rpl_test_framework.inc new file mode 100644 index 00000000000..fb42d2efb9a --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_test_framework.inc @@ -0,0 +1,86 @@ +# ==== Purpose ==== +# +# Auxiliary file used by suite/rpl/t/rpl_test_framework.test +# +# The purpose is to check that the sync chain generated in +# rpl_change_topology.inc (invoked from rpl_init.inc) is correct. This +# is done in two ways: +# (1) Print the sync chain. +# (2) Execute a statement and verify that it replicates to all slaves. +# +# +# ==== Implementation ==== +# +# Does this: +# (1) Set up a given replication topology (rpl_init.inc) +# (2) Print $rpl_sync_chain +# (3) Execute "DELETE FROM t1" and then "INSERT INTO t1" on the master +# (4) Sync and compare all servers. +# (5) Clean up the replication topology (rpl_end.inc) +# +# (Technical detail: Since DELETE FROM t1 is not executed at the end, +# some servers may have rows left in t1 from a previous invocation of +# rpl_test_framework.inc. Therefore, this file will only work in +# statement mode where "DELETE FROM t1" removes rows that exist on +# slave but not on master.) +# +# +# ==== Usage ==== +# +# --let $rpl_server_count= <number> +# --let $rpl_topology= <topology specification> +# --let $masters= <list of masters> +# [--let $rpl_diff_servers= <list of servers>] +# --source extra/rpl_tests/rpl_test_framework.inc +# +# Parameters: +# $next_number +# The INSERT statement will insert $next_number into t1, and +# $next_number will increase by 1. +# +# $rpl_server_count, $rpl_topology: +# See include/rpl_init.inc +# +# $masters +# This should be a list of numbers, each identifying a server. +# The DELETE and INSERT statements will be executed on all servers +# in the list. +# +# $rpl_diff_servers +# See include/rpl_diff.inc + +--source include/rpl_init.inc +--source include/rpl_generate_sync_chain.inc +--echo rpl_sync_chain= '$rpl_sync_chain' + +--inc $next_number + +# Iterate over masters +while ($masters) +{ + --let $master_i= `SELECT SUBSTRING_INDEX('$masters', ',', 1)` + --let $masters= `SELECT SUBSTRING('$masters', LENGTH('$master_i') + 2)` + + # Connect to master and execute statement + --let $rpl_connection_name= server_$master_i + --source include/rpl_connection.inc + DELETE FROM t1; + --eval INSERT INTO t1 VALUES ($next_number) +} + +--source include/rpl_sync.inc + +# Compare all servers. +--let $diff_tables= server_$rpl_server_count:t1 +--let $server_i= $rpl_server_count +--dec $server_i +while ($server_i) +{ + --let $diff_tables= server_$server_i:t1,$diff_tables + --dec $server_i +} +--source include/diff_tables.inc + +--let $diff_servers= +--let $masters= +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_truncate.test b/mysql-test/extra/rpl_tests/rpl_truncate.test index 7036ab126e1..c1d70b4dab2 100644 --- a/mysql-test/extra/rpl_tests/rpl_truncate.test +++ b/mysql-test/extra/rpl_tests/rpl_truncate.test @@ -1,11 +1,6 @@ -# -# Copyright 2006 MySQL. All rights reserved. -# # Test to check for the different version of truncating a table. # The statements are "TRUNCATE tbl" and "DELETE FROM tbl". We check # the behaviour of each possible value for BINLOG_FORMAT. -# -# Author(s): Mats Kindahl --source include/master-slave.inc @@ -14,3 +9,5 @@ let $trunc_stmt = TRUNCATE TABLE; let $trunc_stmt = DELETE FROM; --source extra/rpl_tests/rpl_truncate_helper.test + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test index cd1ce93177a..d1d0e06e32f 100644 --- a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test +++ b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test @@ -1,4 +1,4 @@ -source include/reset_master_and_slave.inc; +--source include/rpl_reset.inc --echo **** On Master **** connection master; @@ -10,8 +10,7 @@ connection master; eval $trunc_stmt t1; sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; --echo ==== Test using a table with delete triggers ==== @@ -26,8 +25,7 @@ connection master; eval $trunc_stmt t1; sync_slave_with_master; -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; connection master; diff --git a/mysql-test/include/analyze-sync_with_master.test b/mysql-test/include/analyze-sync_with_master.test index 684c0dbbab7..27b5a56c6b1 100644 --- a/mysql-test/include/analyze-sync_with_master.test +++ b/mysql-test/include/analyze-sync_with_master.test @@ -1,6 +1,9 @@ -SHOW PROCESSLIST; +# ==== Purpose ==== +# +# This is an auxiliary file that mysqltest executes when +# sync_slave_with_master or sync_with_master fails. The purpose is to +# print debug information. -let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); -eval SHOW BINLOG EVENTS IN '$binlog_name'; - -exit;
\ No newline at end of file +--let $rpl_server_count= 0 +--let $rpl_only_current_connection= 1 +--source include/show_rpl_debug_info.inc diff --git a/mysql-test/include/assert.inc b/mysql-test/include/assert.inc new file mode 100644 index 00000000000..34cc71e7c25 --- /dev/null +++ b/mysql-test/include/assert.inc @@ -0,0 +1,175 @@ +# ==== Purpose ==== +# +# Check if a condition holds, fail with debug info if not. +# +# The condition is parsed before executed. The following constructs +# are supported: +# +# [SQL_STATEMENT, COLUMN, ROW] +# The square bracket is replaced by the result from SQL_STATEMENT, +# in the given COLUMN and ROW. +# +# Optionally, SQL_STATEMENT may have the form: +# connection:SQL_STATEMENT +# In this case, SQL_STATEMENT is executed on the named connection. +# All other queries executed by this script will be executed on +# the connection that was in use when this script was started. +# The current connection will also be restored at the end of this +# script. +# +# Nested sub-statements on this form are not allowed. +# +# <1> +# This is a shorthand for the result of the first executed square +# bracket. <2> is a shorthand for the second executed square +# bracket, and so on. +# +# ==== Usage ==== +# +# --let $assert_text= Relay_Log_Pos must be between min_pos and max_pos +# --let $assert_cond= [SHOW SLAVE STATUS, Relay_Log_Pos, 1] >= $min_pos AND <1> <= $max_pos +# [--let $assert_quiet= 1] +# [--let $rpl_debug= 1] +# --source include/assert.inc +# +# Parameters: +# +# $assert_text +# Text that describes what is being checked. This text is written to +# the query log so it should not contain non-deterministic elements. +# +# $assert_cond +# Condition to check. See above for details about the format. The +# condition will be executed as `SELECT $assert_cond`. +# +# Both $assert_cond and the result from any substatement on the +# form [SQL_STATEMENT, COLUMN, ROW] will be used in SQL statements, +# inside single quotes (as in '$assert_text'). So any single quotes +# in these texts must be escaped or replaced by double quotes. +# +# $rpl_debug +# Print extra debug info. + + +--let $include_filename= assert.inc [$assert_text] +--source include/begin_include_file.inc + +if ($rpl_debug) +{ + --echo # debug: assert_text='$assert_text' assert_cond='$assert_cond' +} + +# Sanity-check input +if (!$assert_text) +{ + --die ERROR IN TEST: the mysqltest variable rpl_test must be set +} + +--let $_assert_old_connection= $CURRENT_CONNECTION + +# Evaluate square brackets in cond. +--let $_assert_substmt_number= 1 +--let $_assert_cond_interp= '$assert_cond' +--let $_assert_lbracket= `SELECT LOCATE('[', $_assert_cond_interp)` +while ($_assert_lbracket) +{ + # Get position of right bracket + --let $_assert_rbracket= `SELECT LOCATE(']', $_assert_cond_interp)` + if (!$_assert_rbracket) + { + --echo BUG IN TEST: Mismatching square brackets in assert_cond. + --echo Original assert_cond='$assert_cond' + --echo Interpolated assert_cond=$_assert_cond_interp + --die BUG IN TEST: Mismatching square brackets in $assert_cond + } + + # Get sub-statement from statement. Preserve escapes for single quotes. + --let $_assert_full_substmt= `SELECT QUOTE(SUBSTRING($_assert_cond_interp, $_assert_lbracket + 1, $_assert_rbracket - $_assert_lbracket - 1))` + + # Get connection from sub-statement + --let $_assert_colon= `SELECT IF($_assert_full_substmt REGEXP '^[a-zA-Z_][a-zA-Z_0-9]*:', LOCATE(':', $_assert_full_substmt), 0)` + --let $_assert_connection= + --let $_assert_substmt= $_assert_full_substmt + if ($_assert_colon) + { + --let $_assert_connection= `SELECT SUBSTRING($_assert_substmt, 1, $_assert_colon - 1)` + # Preserve escapes for single quotes. + --let $_assert_substmt= `SELECT QUOTE(SUBSTRING($_assert_substmt, $_assert_colon + 1))` + } + + # Interpolate escapes before using condition outside string context. + --let $_assert_substmt_interp= `SELECT $_assert_substmt` + + # Execute and get result from sub-statement + if ($_assert_connection) + { + if ($rpl_debug) + { + --echo # debug: connection='$_assert_connection' sub-statement=$_assert_substmt + } + --let $rpl_connection_name= $_assert_connection + --source include/rpl_connection.inc + --let $_assert_substmt_result= query_get_value($_assert_substmt_interp) + --let $rpl_connection_name= $_assert_old_connection + --source include/rpl_connection.inc + } + if (!$_assert_connection) + { + if ($rpl_debug) + { + --echo # debug: old connection, sub-statement=$_assert_substmt + } + --let $_assert_substmt_result= query_get_value($_assert_substmt_interp) + } + if ($rpl_debug) + { + --echo # debug: result of sub-statement='$_assert_substmt_result' + } + + # Replace sub-statement by its result + --let $_assert_cond_interp= `SELECT QUOTE(REPLACE($_assert_cond_interp, CONCAT('[', $_assert_full_substmt, ']'), '$_assert_substmt_result'))` + # Replace result references by result + --let $_assert_cond_interp= `SELECT QUOTE(REPLACE($_assert_cond_interp, '<$_assert_substmt_number>', '$_assert_substmt_result'))` + + --let $_assert_lbracket= `SELECT LOCATE('[', $_assert_cond_interp)` + + --inc $_assert_substmt_number +} + +# Interpolate escapes before using condition outside string context. +--let $_assert_cond_interp= `SELECT $_assert_cond_interp` + +if ($rpl_debug) +{ + --echo # debug: interpolated_cond='$_assert_cond_interp' +} + +# Execute. +--let $_assert_result= `SELECT $_assert_cond_interp` + +if ($rpl_debug) +{ + --echo # debug: result='$_assert_result' +} + +# Check. +if (!$_assert_result) +{ + --echo ######## Test assertion failed: $assert_text ######## + --echo Dumping debug info: + if ($rpl_inited) + { + --source include/show_rpl_debug_info.inc + } + --echo Assertion text: '$assert_text' + --echo Assertion condition: '$assert_cond' + --echo Assertion condition, interpolated: '$_assert_cond_interp' + --echo Assertion result: '$_assert_result' + --die Test assertion failed in assertion.inc +} + +--let $include_filename= assert.inc [$assert_text] +--source include/end_include_file.inc + +--let $assert_text= +--let $assert_cond= diff --git a/mysql-test/include/begin_include_file.inc b/mysql-test/include/begin_include_file.inc new file mode 100644 index 00000000000..98d3a1743ee --- /dev/null +++ b/mysql-test/include/begin_include_file.inc @@ -0,0 +1,82 @@ +# ==== Purpose ==== +# +# This is an auxiliary file that facilitates writing include/*.inc +# files. It has three purposes: +# +# 1. Store mtr's state at the beginning of the .inc file and restore +# the state at the end. The following status is restored: +# +# disable_warnings +# disable_query_log +# disable_result_log +# disable_abort_on_errors +# Current connection +# +# 2. This file also prints the name of the .inc file that sources +# it. Only the name of the top-level .inc file is printed: if +# file_1.inc sources file_2.inc, then this file only prints +# file_1.inc. +# +# 3. If the mysqltest variable $rpl_debug is set, then +# this file will print: +# +# ==== BEGIN include/<filename> ==== +# +# and end_include_file.inc will print +# +# ==== END include/<filename> ==== +# +# These printouts are indented to make it easier to read the +# result log. +# +# +# ==== Usage ==== +# +# # At the beginning of include/my_file.inc: +# --let $include_filename= my_file.inc +# [--let $rpl_debug= 1] +# --source include/begin_include_file.inc +# +# # At the end of include/my_file.inc: +# --let $include_filename= my_file.inc +# --source include/end_include_file.inc +# +# Parameters: +# $include_filename +# The basename of the file: a file named /path/to/my_file.inc +# should set $include_filename=my_file.inc. This parameter +# must be provided both for begin_include_file.inc and +# end_include_file.inc. +# +# $rpl_debug +# If set, this script will print the following text: +# ==== BEGIN include/$include_filename.inc ==== + + +# Print 'include/$include_filename', but only when invoked from +# the top-level. We don't want to print +# 'include/$include_filename' from all files included +# recursively. +if (!$_include_file_depth) +{ + --echo include/$include_filename +} +--inc $_include_file_depth +if ($rpl_debug) +{ + --echo $_include_file_indent==== BEGIN include/$include_filename ==== +} + +--let $_include_file_enabled_warnings= $ENABLED_WARNINGS$_include_file_enabled_warnings +--let $_include_file_enabled_query_log= $ENABLED_QUERY_LOG$_include_file_enabled_query_log +--let $_include_file_enabled_result_log= $ENABLED_RESULT_LOG$_include_file_enabled_result_log +--let $_include_file_enabled_abort_on_error= $ENABLED_ABORT_ON_ERROR$_include_file_enabled_abort_on_error +--let $_include_file_connection= $CURRENT_CONNECTION,$_include_file_connection + +if ($rpl_debug) +{ + --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR' +} + +--let $include_filename= +--let $_include_file_indent= .$_include_file_indent diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index 6dcb01c13cf..88b56c95cec 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -8,8 +8,10 @@ # any unwanted side affects. # --disable_query_log +--replace_column 5 # 6 # 7 # 8 # 9 # 10 # 22 # 23 # 24 # 25 # 26 # +query_vertical +SHOW SLAVE STATUS; + call mtr.check_testcase(); --enable_query_log - - diff --git a/mysql-test/include/check_slave_is_running.inc b/mysql-test/include/check_slave_is_running.inc index 5fbbe0d684c..88664da7fa7 100644 --- a/mysql-test/include/check_slave_is_running.inc +++ b/mysql-test/include/check_slave_is_running.inc @@ -2,17 +2,29 @@ # # Assert that the slave threads are running and don't have any errors. # +# # ==== Usage ==== # -# --source include/check_slave_running.inc +# [--let $rpl_debug= 1] +# --source include/check_slave_is_running.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= check_slave_is_running.inc +--source include/begin_include_file.inc + + +--let $slave_param= Slave_IO_Running +--let $slave_param_value= Yes +--source include/check_slave_param.inc ---echo Checking that both slave threads are running. +--let $slave_param= Slave_SQL_Running +--let $slave_param_value= Yes +--source include/check_slave_param.inc ---let $slave_sql_running = query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1) ---let $slave_io_running = query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1) -if (`SELECT '$slave_sql_running' != 'Yes' OR '$slave_io_running' != 'Yes'`) { - --echo Slave not running: Slave_SQL_Running = $slave_sql_running Slave_IO_Running = $slave_io_running - --source include/show_rpl_debug_info.inc - --die Expected slave to be running, but it was not running. -} +--let $include_filename= check_slave_is_running.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/check_slave_no_error.inc b/mysql-test/include/check_slave_no_error.inc index 371db5ed6a0..9922b426ed6 100644 --- a/mysql-test/include/check_slave_no_error.inc +++ b/mysql-test/include/check_slave_no_error.inc @@ -1,12 +1,22 @@ # ==== Purpose ==== # -# Assert that Slave_SQL_Error and Slave_IO_Error are empty. +# Assert that Slave_SQL_Errno = Slave_IO_Errno = 0 in the output from +# SHOW SLAVE STATUS. +# # # ==== Usage ==== # -# --let $slave_param= Exec_Master_Log_Pos -# --let $slave_param_value= 4711 -# --source include/check_slave_running.inc +# [--let $rpl_debug= 1] +# --source include/check_slave_no_error.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= check_slave_no_error.inc +--source include/begin_include_file.inc + --let $slave_param= Last_SQL_Errno --let $slave_param_value= 0 @@ -15,3 +25,7 @@ --let $slave_param= Last_IO_Errno --let $slave_param_value= 0 --source include/check_slave_param.inc + + +--let $include_filename= check_slave_no_error.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/check_slave_param.inc b/mysql-test/include/check_slave_param.inc index d82c26851ea..1e0e81308f2 100644 --- a/mysql-test/include/check_slave_param.inc +++ b/mysql-test/include/check_slave_param.inc @@ -4,13 +4,33 @@ # # ==== Usage ==== # -# --let $slave_param= Exec_Master_Log_Pos -# --let $slave_param_value= 4711 +# --let $slave_param= COLUMN_NAME +# --let $slave_param_value= VALUE +# [--let $rpl_debug= 1] # --source include/check_slave_param.inc +# +# Parameters: +# $slave_param, $slave_param_value +# Column name in output of SHOW SLAVE STATUS that should be checked, +# and the expected value. Example: +# --let $slave_param= Exec_Master_Log_Pos +# --let $slave_param_value= 4711 +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= check_slave_param.inc [$slave_param] +--source include/begin_include_file.inc + --let $_param_value= query_get_value(SHOW SLAVE STATUS, $slave_param, 1) if (`SELECT '$_param_value' != '$slave_param_value'`) { - --echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value' --source include/show_rpl_debug_info.inc + --echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value' --die Wrong value for slave parameter } + + +--let $include_filename= check_slave_param.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/circular_rpl_for_4_hosts_init.inc b/mysql-test/include/circular_rpl_for_4_hosts_init.inc deleted file mode 100644 index ac6654777db..00000000000 --- a/mysql-test/include/circular_rpl_for_4_hosts_init.inc +++ /dev/null @@ -1,130 +0,0 @@ -############################################################# -# -# Author: Serge Kozlov <skozlov@mysql.com> -# Date: 03/11/2008 -# Purpose: Set up circular replication based on schema -# A->B->C->D->A -# -# Notes: -# 1. --slave-num=3 must be added to *-master.opt file -# 2. Even the test uses new names for servers but file names -# of log files are still old: -# master_a -> master.[log|err] -# master_b -> slave.[log|err] -# master_c -> slave1.[log|err] -# master_d -> slave2.[log|err] -# -############################################################# ---source include/master-slave.inc - -# -# Set up circular ring by schema A->B->C->D->A -# - ---connection slave -STOP SLAVE; -RESET SLAVE; - -# master a ---connection master ---disconnect master -connect (master_a,127.0.0.1,root,,test,$MASTER_MYPORT,); -RESET MASTER; ---disable_warnings -STOP SLAVE; ---enable_warnings -RESET SLAVE; -SET auto_increment_increment = 4; -SET auto_increment_offset = 1; -let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); - -# master b ---connection slave ---disconnect slave -connect (master_b,127.0.0.1,root,,test,$SLAVE_MYPORT,); -RESET MASTER; -RESET SLAVE; ---replace_result $MASTER_MYPORT MASTER_A_PORT $_binlog_file MASTER_A_LOG_FILE ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file' -SET auto_increment_increment = 4; -SET auto_increment_offset = 2; -let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); - -# master c ---connection slave1 ---disconnect slave1 -connect (master_c,127.0.0.1,root,,test,$SLAVE_MYPORT1,); -RESET MASTER; ---disable_warnings -STOP SLAVE; ---enable_warnings -RESET SLAVE; ---replace_result $SLAVE_MYPORT MASTER_B_PORT $_binlog_file MASTER_B_LOG_FILE ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file' -SET auto_increment_increment = 4; -SET auto_increment_offset = 3; -let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); - -# master d -connect (master_d,127.0.0.1,root,,test,$SLAVE_MYPORT2,); -RESET MASTER; ---disable_warnings -STOP SLAVE; ---enable_warnings -RESET SLAVE; ---replace_result $SLAVE_MYPORT1 MASTER_C_PORT $_binlog_file MASTER_C_LOG_FILE ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',MASTER_LOG_FILE='$_binlog_file' -SET auto_increment_increment = 4; -SET auto_increment_offset = 4; -let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); - -# master a ---connection master_a ---replace_result $SLAVE_MYPORT2 MASTER_D_PORT $_binlog_file MASTER_D_LOG_FILE ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT2,master_user='root',MASTER_LOG_FILE='$_binlog_file' - - - -# Check server_ids: they should be different ---connection master_a -let $_id_a= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); -SHOW VARIABLES LIKE 'auto_increment_%'; ---connection master_b -let $_id_b= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); -SHOW VARIABLES LIKE 'auto_increment_%'; ---connection master_c -let $_id_c= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); -SHOW VARIABLES LIKE 'auto_increment_%'; ---connection master_d -let $_id_d= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); -SHOW VARIABLES LIKE 'auto_increment_%'; ---connection master_a -let $_compared_ids= (($_id_a <> $_id_b) AND ($_id_a <> $_id_c) AND ($_id_a <> $_id_d) AND ($_id_b <> $_id_c) AND ($_id_b <> $_id_d) AND ($_id_c <> $_id_d)) AS a; -let $_compared_ids_result= query_get_value(SELECT $_compared_ids, a, 1); ---echo $_compared_ids_result - -# Start ring ---connection master_a -connect(slave,127.0.0.1,root,,test,$MASTER_MYPORT); -START SLAVE; ---source include/wait_for_slave_to_start.inc ---disconnect slave - ---connection master_b -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT1); -START SLAVE; ---source include/wait_for_slave_to_start.inc ---disconnect slave - ---connection master_c -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT); -START SLAVE; ---source include/wait_for_slave_to_start.inc ---disconnect slave - ---connection master_d -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2); -START SLAVE; ---source include/wait_for_slave_to_start.inc ---disconnect slave - diff --git a/mysql-test/include/circular_rpl_for_4_hosts_sync.inc b/mysql-test/include/circular_rpl_for_4_hosts_sync.inc deleted file mode 100644 index 68aede76913..00000000000 --- a/mysql-test/include/circular_rpl_for_4_hosts_sync.inc +++ /dev/null @@ -1,23 +0,0 @@ -############################################################# -# -# Author: Serge Kozlov <skozlov@mysql.com> -# Date: 03/11/2008 -# Purpose: Sync all hosts for circular replication based on -# schema A->B->C->D->A -# -# Notes: see include/circular_rpl_for_4_hosts_init.inc -# -############################################################# - -# Make the full loop of sync ---connection master_a ---disable_query_log ---sync_slave_with_master master_b ---sync_slave_with_master master_c ---sync_slave_with_master master_d ---sync_slave_with_master master_a ---sync_slave_with_master master_b ---sync_slave_with_master master_c ---save_master_pos ---connection master_a ---enable_query_log diff --git a/mysql-test/include/cleanup_fake_relay_log.inc b/mysql-test/include/cleanup_fake_relay_log.inc index c55e2937242..921484ec695 100644 --- a/mysql-test/include/cleanup_fake_relay_log.inc +++ b/mysql-test/include/cleanup_fake_relay_log.inc @@ -1,18 +1,28 @@ # ==== Purpose ==== # -# Clean up files create by setup_fake_relay_log.inc. +# Clean up files created by setup_fake_relay_log.inc. # # ==== Usage ==== # # See setup_fake_relay_log.inc ---echo Cleaning up after setup_fake_relay_log.inc +--let $include_filename= cleanup_fake_relay_log.inc +--source include/begin_include_file.inc + -# Remove files. ---disable_warnings -remove_file $_fake_relay_log; -remove_file $_fake_relay_index; ---enable_warnings --disable_query_log +RESET SLAVE; + +# Assert that the fake relay log files are gone (RESET SLAVE should +# have removed them). +--let $file_does_not_exist= $_fake_relay_log +--source include/file_does_not_exist.inc + +# Revert variables. eval SET @@global.relay_log_purge= $_fake_relay_log_purge; ---enable_query_log + +eval CHANGE MASTER TO MASTER_HOST = '$_fake_old_master_host'; + + +--let $include_filename= cleanup_fake_relay_log.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/ctype_8bit.inc b/mysql-test/include/ctype_8bit.inc new file mode 100644 index 00000000000..7259db54d05 --- /dev/null +++ b/mysql-test/include/ctype_8bit.inc @@ -0,0 +1,46 @@ +# +# Test Unicode conversion, upper, lower +# +SELECT @@collation_connection; +CREATE TABLE t1 AS SELECT ' ' AS a LIMIT 0; +INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07); +INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F); +INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17); +INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F); +INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27); +INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F); +INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37); +INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F); +INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47); +INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F); +INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57); +INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F); +INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67); +INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F); +INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77); +INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F); +INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87); +INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F); +INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97); +INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F); +INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7); +INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF); +INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7); +INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF); +INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7); +INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF); +INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7); +INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF); +INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7); +INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF); +INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7); +INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF); +SELECT + HEX(a) AS chr, + HEX(LOWER(a)) AS upper, + HEX(LOWER(a)) AS lower, + HEX(@utf8:=CONVERT(a USING utf8)) AS utf8, + HEX(@roundtrip:=CAST(@utf8 AS CHAR)) AS roundtrip, + if(a=BINARY @roundtrip,'','Round trip unsafe') AS issafe +FROM t1 ORDER BY chr; +DROP TABLE t1; diff --git a/mysql-test/include/diff_master_slave.inc b/mysql-test/include/diff_master_slave.inc deleted file mode 100644 index b6d79190671..00000000000 --- a/mysql-test/include/diff_master_slave.inc +++ /dev/null @@ -1,21 +0,0 @@ -# ==== Purpose ==== -# -# Diff the output of a statement on master and slave -# -# ==== Usage ===== -# -# let $diff_statement= SELECT * FROM t1 WHERE a < 100; -# source include/diff_master_slave.inc; - ---echo source include/diff_master_slave.inc; -disable_query_log; -disable_result_log; - -exec $MYSQL test -e "$diff_statement" > $MYSQLTEST_VARDIR/tmp/diff_master.out; -sync_slave_with_master; -exec $MYSQL_SLAVE test -e "$diff_statement" > $MYSQLTEST_VARDIR/tmp/diff_slave.out; - -diff_files $MYSQLTEST_VARDIR/tmp/diff_master.out $MYSQLTEST_VARDIR/tmp/diff_slave.out; - -enable_result_log; -enable_query_log; diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index 8a463686fdb..42a8b11740b 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -1,35 +1,41 @@ # ==== Purpose ==== # -# Check if the two given tables (possibly residing on different -# master/slave servers) are equal. +# Check if all tables in the given list are equal. The tables may have +# different names, exist in different connections, and/or reside in +# different databases. +# # # ==== Usage ==== # -# The tables to check are given by the test language variables -# $diff_table_1 and $diff_table_2. They must be of the -# following form: +# --let $diff_tables= [con1:][db1.]t1, [con2:][db2.]t2, ... , [conN:][dbN.]tN +# [--let $rpl_debug= 1] +# --source include/diff_tables.inc +# +# Parameters: +# $diff_tables +# Comma-separated list of tables to compare. Each table has the form +# +# [CONNECTION:][DATABASE.]table +# +# If CONNECTION is given, then that connection is used. If +# CONNECTION is not given, then the connection of the previous +# table is used (or the current connection, if this is the first +# table). If DATABASE is given, the table is read in that +# database. If DATABASE is not given, the table is read in the +# connection's current database. # -# [master:|slave:]database.table +# $rpl_debug +# See include/rpl_init.inc # -# I.e., both database and table must be speicified. Optionally, you -# can prefix the name with 'master:' (to read the table on master) or -# with 'slave:' (to read the table on slave). If no prefix is given, -# reads the table from the current connection. If one of these -# variables has a prefix, both should have a prefix. # # ==== Side effects ==== # -# - Prints "Comparing tables $diff_table_1 and $diff_tables_2". +# - Prints "include/diff_tables.inc [$diff_tables]". # # - If the tables are different, prints the difference in a # system-specific format (unified diff if supported) and generates # an error. # -# - If $diff_table_1 or $diff_table_2 begins with 'master:' or -# 'slave:', it will stay connected to one of those hosts after -# execution. The host is only guaranteed to remain unchanged if -# none of $diff_table_1 or $diff_table_2 begins with 'master:' or -# 'slave:'. # # ==== Bugs ==== # @@ -50,70 +56,138 @@ # by character case. +--let $include_filename= diff_tables.inc [$diff_tables] +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +# Check sanity +if (`SELECT LOCATE(',', '$diff_tables') = 0`) +{ + --die ERROR IN TEST: $diff_tables must contain at least two tables (separated by comma) +} + + # ==== Save both tables to file ==== ---echo Comparing tables $diff_table_1 and $diff_table_2 -disable_query_log; -disable_warnings; ---error 0,1 ---remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1 ---error 0,1 ---remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2 -enable_warnings; - -let $_diff_table=$diff_table_2; -let $_diff_i=2; -while ($_diff_i) { - - # Parse out any leading "master:" or "slave:" from the table specification -# and connect the appropriate server. - let $_pos= `SELECT LOCATE(':', '$_diff_table')`; - let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`; - if (`SELECT 'XX$_diff_conn' <> 'XX'`) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`; - connection $_diff_conn; +# Trim off whitespace +--let $_dt_tables= `SELECT REPLACE('$diff_tables', ' ', '')` + +# Iterate over all tables +--let $_dt_outfile= +--let $_dt_prev_outfile= +while (`SELECT '$_dt_tables' != ''`) +{ + --let $_dt_table= `SELECT SUBSTRING_INDEX('$_dt_tables', ',', 1)` + --let $_dt_tables= `SELECT SUBSTRING('$_dt_tables', LENGTH('$_dt_table') + 2)` + + # Parse connection, if any + --let $_dt_colon_index= `SELECT LOCATE(':', '$_dt_table')` + if ($_dt_colon_index) + { + --let $_dt_connection= `SELECT SUBSTRING('$_dt_table', 1, $_dt_colon_index - 1)` + --let $_dt_table= `SELECT SUBSTRING('$_dt_table', $_dt_colon_index + 1)` + --let $rpl_connection_name= $_dt_connection + --source include/rpl_connection.inc + } + + # Parse database name, if any + --let $_dt_database_index= `SELECT LOCATE('.', '$_dt_table')` + if ($_dt_database_index) + { + --let $_dt_database= `SELECT SUBSTRING('$_dt_table', 1, $_dt_database_index - 1)` + --let $_dt_table= `SELECT SUBSTRING('$_dt_table', $_dt_database_index + 1)` + } + if (!$_dt_database_index) + { + --let $_dt_database= `SELECT DATABASE()` } - # Sanity-check the input. - let $_diff_error= `SELECT '$_diff_table' NOT LIKE '_%._%'`; - if ($_diff_error) { - --echo !!!ERROR IN TEST: \$diff_table_$_diff_i='$_diff_table' is not in the form database.table - exit; + if ($rpl_debug) + { + --echo con='$_dt_connection' db='$_dt_database' table='$_dt_table' + --echo rest of tables='$_dt_tables' } - # We need the output files to be sorted (so that diff_files does not - # think the files are different just because they are differently - # ordered). To this end, we first generate a query that sorts the - # table by all columns. Since ORDER BY accept column indices, we - # just generate a comma-separated list of all numbers from 1 to the - # number of columns in the table. - let $_diff_column_index=`SELECT MAX(ordinal_position) - FROM information_schema.columns - WHERE CONCAT(table_schema, '.', table_name) = - '$_diff_table'`; - let $_diff_column_list=$_diff_column_index; - dec $_diff_column_index; - while ($_diff_column_index) { - let $_diff_column_list=$_diff_column_index, $_diff_column_list; - dec $_diff_column_index; + # We need to sort the output files so that diff_files does not think + # the tables are different just because the rows are differently + # ordered. To this end, we first generate a string containing a + # comma-separated list of all column names. This is used in the + # ORDER BY clause of the following SELECT statement. We get the + # column names from INFORMATION_SCHEMA.COLUMNS, and we concatenate + # them with GROUP_CONCAT. Since GROUP_CONCAT is limited by the + # @@SESSION.group_concat_max_len, which is only 1024 by default, we + # first compute the total size of all columns and then increase this + # limit if needed. We restore the limit afterwards so as not to + # interfere with the test case. + + # Compute length of ORDER BY clause. + let $_dt_order_by_length= + `SELECT SUM(LENGTH(column_name) + 3) FROM information_schema.columns + WHERE table_schema = '$_dt_database' AND table_name = '$_dt_table'`; + if (!$_dt_order_by_length) + { + --echo ERROR IN TEST: table $_dt_database.$_dt_table not found in INFORMATION_SCHEMA.COLUMNS. Did you misspell it? + --die ERROR IN TEST: table not found in INFORMATION_SCHEMA. Did you misspell it? + } + --let $_dt_old_group_concat_max_len= + # Increase group_concat_max_len if needed. + if (`SELECT $_dt_order_by_length > @@SESSION.group_concat_max_len`) + { + --let $_dt_old_group_concat_max_len= `SELECT @@SESSION.group_concat_max_len` + --eval SET SESSION group_concat_max_len = $_dt_order_by_length; + if ($rpl_debug) + { + --echo # increasing group_concat_max_len from $_dt_old_group_concat_max_len to $_dt_order_by_length + } + } + # Generate ORDER BY clause. + # It would be better to do GROUP_CONCAT(CONCAT('`', column_name, '`')) but + # BUG#58087 prevents us from returning strings that begin with backticks. + let $_dt_column_list= + `SELECT GROUP_CONCAT(column_name ORDER BY ORDINAL_POSITION SEPARATOR '`,`') + FROM information_schema.columns + WHERE table_schema = '$_dt_database' AND table_name = '$_dt_table'`; + # Restore group_concat_max_len. + if ($_dt_old_group_concat_max_len) + { + --let $_dt_dummy= `SET SESSION group_concat_max_len = $_dt_old_group_concat_max_len + } + if ($rpl_debug) + { + --echo using ORDER BY clause '`$_dt_column_list`' } # Now that we have the comma-separated list of columns, we can write # the table to a file. - eval SELECT * FROM $_diff_table ORDER BY $_diff_column_list - INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/diff_table_$_diff_i'; + --let $_dt_outfile= `SELECT @@datadir` + --let $_dt_outfile= $_dt_outfile/diff_table-$_dt_connection-$_dt_database-$_dt_table + eval SELECT * FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list` INTO OUTFILE '$_dt_outfile'; - # Do the same for $diff_table_1. - dec $_diff_i; - let $_diff_table=$diff_table_1; + # Compare files. + if ($_dt_prev_outfile) + { + if ($rpl_debug) + { + --echo # diffing $_dt_prev_outfile vs $_dt_outfile + } + --diff_files $_dt_prev_outfile $_dt_outfile + # Remove previous outfile. Keep current file for comparison with next table. + --disable_warnings + --remove_file $_dt_prev_outfile + --enable_warnings + } + --let $_dt_prev_outfile= $_dt_outfile } +--disable_warnings +--remove_file $_dt_prev_outfile +--enable_warnings -# ==== Compare the generated files ==== - -diff_files $MYSQLTEST_VARDIR/tmp/diff_table_1 $MYSQLTEST_VARDIR/tmp/diff_table_2; - ---remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1 ---remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2 - -enable_query_log; +--let $include_filename= diff_tables.inc [$diff_tables] +--source include/end_include_file.inc diff --git a/mysql-test/include/end_include_file.inc b/mysql-test/include/end_include_file.inc new file mode 100644 index 00000000000..1e546c1215b --- /dev/null +++ b/mysql-test/include/end_include_file.inc @@ -0,0 +1,79 @@ +# ==== Purpose ==== +# +# See include/begin_include_file.inc +# +# +# ==== Usage ==== +# +# # At the end of include/my_file.inc: +# --let $include_filename= my_file.inc +# [--let $skip_restore_connection= 1] +# [--let $rpl_debug= 1] +# --source include/begin_include_file.inc +# +# Parameters: +# $include_filename +# Name of file that sources this file. +# +# $skip_restore_connection +# By default, this script restores the connection that was active +# when begin_include_file.inc was sourced. If +# $skip_restore_connection is set, then this step is skipped and +# end_include_file.inc leaves the connection as it was before +# end_include_file.inc was sourced. + +--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_warnings', 1, 1)` +--let $_include_file_enabled_warnings= `SELECT SUBSTRING('$_include_file_enabled_warnings', 2)` +if ($_tmp) { + --enable_warnings +} +if (!$_tmp) { + --disable_warnings +} + +--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_query_log', 1, 1)` +--let $_include_file_enabled_query_log= `SELECT SUBSTRING('$_include_file_enabled_query_log', 2)` +if ($_tmp) { + --enable_query_log +} +if (!$_tmp) { + --disable_query_log +} + +--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_result_log', 1, 1)` +--let $_include_file_enabled_result_log= `SELECT SUBSTRING('$_include_file_enabled_result_log', 2)` +if ($_tmp) { + --enable_result_log +} +if (!$_tmp) { + --disable_result_log +} + +--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 1, 1)` +--let $_include_file_enabled_abort_on_error= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 2)` +if ($_tmp) { + --enable_abort_on_error +} +if (!$_tmp) { + --disable_abort_on_error +} + +--let $_include_file_rpl_connection_name= `SELECT SUBSTRING_INDEX('$_include_file_connection', ',', 1)` +--let $_include_file_connection= `SELECT SUBSTRING('$_include_file_connection', LENGTH('$_include_file_rpl_connection_name') + 2)` +if (!$skip_restore_connection) +{ + --let $rpl_connection_name= $_include_file_rpl_connection_name + --source include/rpl_connection.inc +} +--let $skip_restore_connection= 0 + + +--dec $_include_file_depth +--let $_include_file_indent= `SELECT REPEAT('.', $_include_file_depth)` + +if ($rpl_debug) +{ + --echo $_include_file_indent==== END include/$include_filename ==== + --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR' +} +--let $include_filename= diff --git a/mysql-test/include/file_does_not_exist.inc b/mysql-test/include/file_does_not_exist.inc new file mode 100644 index 00000000000..0b02c63a0a9 --- /dev/null +++ b/mysql-test/include/file_does_not_exist.inc @@ -0,0 +1,17 @@ +# ==== Purpose ==== +# +# Checks that a given file does not exist. If the file exists, the +# test fails. +# +# ==== Usage ==== +# +# --let $file_does_not_exist= /path/to/file +# --source include/file_does_not_exist.inc + +# Will fail if file exists. +--write_file $file_does_not_exist +tmp +EOF + +# Remove file again. +--remove_file $file_does_not_exist diff --git a/mysql-test/include/force_restart.inc b/mysql-test/include/force_restart.inc new file mode 100644 index 00000000000..d058e85df45 --- /dev/null +++ b/mysql-test/include/force_restart.inc @@ -0,0 +1,17 @@ +# ==== Purpose ==== +# +# Tell mtr that all servers must be restarted after the test has +# finished. +# +# ==== Usage ==== +# +# --source include/force_restart.inc +# +# ==== See also ==== +# +# include/force_restart_if_skipped.inc + +--let $_force_restart_datadir= `SELECT @@datadir` +--append_file $_force_restart_datadir/mtr/force_restart +1 +EOF diff --git a/mysql-test/include/force_restart_if_skipped.inc b/mysql-test/include/force_restart_if_skipped.inc new file mode 100644 index 00000000000..228e094e932 --- /dev/null +++ b/mysql-test/include/force_restart_if_skipped.inc @@ -0,0 +1,17 @@ +# ==== Purpose ==== +# +# Tell mtr that all servers must be restarted in case the test is +# skipped. +# +# ==== Usage ==== +# +# --source include/force_restart_if_skipped.inc +# +# ==== See also ==== +# +# include/force_restart.inc + +--let $_force_restart_datadir= `SELECT @@datadir` +--append_file $_force_restart_datadir/mtr/force_restart_if_skipped +1 +EOF diff --git a/mysql-test/include/get_relay_log_pos.inc b/mysql-test/include/get_relay_log_pos.inc index 61ee07fc655..93dbc7d284b 100644 --- a/mysql-test/include/get_relay_log_pos.inc +++ b/mysql-test/include/get_relay_log_pos.inc @@ -66,5 +66,11 @@ let $relay_log_pos= `SELECT SUBSTRING(a.c2, 5) FROM events_at a, events_pos b WHERE a.c1=b.c1+1 and b.c2 LIKE '% $master_log_pos%'`; DROP TEMPORARY TABLE mysqlbinlog_events, events_at, events_pos; + +if (!$relay_log_pos) +{ + --echo 'Failed to read from relay_log_file: $relay_log_file pos: $master_log_pos' + --die 'variable $relay_log_pos is null' +} --remove_file $_tmp_file --enable_query_log diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc index c3c8b5cc4f2..fa3e586834c 100644 --- a/mysql-test/include/have_innodb.inc +++ b/mysql-test/include/have_innodb.inc @@ -1,5 +1,4 @@ -if (!`SELECT count(*) FROM information_schema.engines WHERE - (support = 'YES' OR support = 'DEFAULT') AND - engine = 'innodb'`){ - skip Needs innodb engine; +if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED')`) +{ + --skip Test requires InnoDB. } diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc index cfc5b5d0ff8..1266f80c8cd 100644 --- a/mysql-test/include/have_ndb.inc +++ b/mysql-test/include/have_ndb.inc @@ -1,10 +1,2 @@ # Check that server is compiled and started with support for NDB -#disable_query_log; -#--require r/true.require -#select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster'; -#--source include/ndb_not_readonly.inc -#enable_query_log; -# always make sure we have both mysql servers started ok before test starts -# there are some initial startup bugs that are avoided by doing this, avoiding sporadic -# failures in mysql-test-run --source include/have_multi_ndb.inc diff --git a/mysql-test/include/io_thd_fault_injection.inc b/mysql-test/include/io_thd_fault_injection.inc new file mode 100644 index 00000000000..7cbe055dbf6 --- /dev/null +++ b/mysql-test/include/io_thd_fault_injection.inc @@ -0,0 +1,21 @@ +# +# Takes the flag as an argument: +# -- let $io_thd_injection_fault_flag=+d,fault_injection_new_file_rotate_event +# -- source include/io_thd_fault_injection.inc +# + +SET @old_debug=@@global.debug; +-- disable_warnings +-- source include/stop_slave.inc +-- enable_warnings +-- eval SET GLOBAL debug="+d,$io_thd_injection_fault_flag" + +START SLAVE io_thread; +-- source include/wait_for_slave_io_error.inc + +-- eval SET GLOBAL debug="-d,$io_thd_injection_fault_flag" +SET GLOBAL debug=@old_debug; + +# restart because slave is in bad shape +--let $rpl_server_number= 2 +--source include/rpl_restart_server.inc diff --git a/mysql-test/include/kill_query_and_diff_master_slave.inc b/mysql-test/include/kill_query_and_diff_master_slave.inc index b3846d12df1..59588551af5 100644 --- a/mysql-test/include/kill_query_and_diff_master_slave.inc +++ b/mysql-test/include/kill_query_and_diff_master_slave.inc @@ -9,19 +9,19 @@ # connection <CONNECTION>; # let $connection_name=<CONNECTION> # let $connection_id=`SELECT CONNECTION_ID()`; -# let $diff_statement=<SQL COMMAND>; +# let $rpl_diff_statement=<SQL COMMAND>; # send <SQL COMMAND>; # source include/kill_query_and_diff_master_slave.inc; # # Note: <CONNECTION> must not be 'master'. # -# See also kill_query.inc and diff_master_slave.inc for more +# See also kill_query.inc and rpl_diff.inc for more # information source include/kill_query.inc; # Release the debug lock if used, so that the statements in -# diff_master_slave.inc will not be blocked. +# rpl_diff.inc will not be blocked. connection master; disable_query_log; disable_result_log; @@ -32,7 +32,7 @@ if ($debug_lock) enable_result_log; enable_query_log; -source include/diff_master_slave.inc; +--source include/rpl_diff.inc # Acquire the debug lock again if used connection master; diff --git a/mysql-test/include/long_test.inc b/mysql-test/include/long_test.inc new file mode 100644 index 00000000000..d9a3b338229 --- /dev/null +++ b/mysql-test/include/long_test.inc @@ -0,0 +1,4 @@ +# We use this --source include to mark a test as taking long to run. +# We can use this to schedule such test early (to not be left with +# only one or two long tests running, and rests of works idle), or to +# run a quick test skipping long-running test cases. diff --git a/mysql-test/include/master-slave-end.inc b/mysql-test/include/master-slave-end.inc deleted file mode 100644 index 74e4c7b608a..00000000000 --- a/mysql-test/include/master-slave-end.inc +++ /dev/null @@ -1,6 +0,0 @@ ---connection master ---sync_slave_with_master ---connection slave ---disable_query_log -STOP SLAVE; ---enable_query_log diff --git a/mysql-test/include/master-slave-reset.inc b/mysql-test/include/master-slave-reset.inc deleted file mode 100644 index 938eb2c074a..00000000000 --- a/mysql-test/include/master-slave-reset.inc +++ /dev/null @@ -1,36 +0,0 @@ -# Reset the master and the slave to start fresh. -# -# It is necessary to execute RESET MASTER and RESET SLAVE on both -# master and slave since the replication setup might be circular. -# -# Since we expect STOP SLAVE to produce a warning as the slave is -# stopped (the server was started with skip-slave-start), we disable -# warnings when doing STOP SLAVE. - -connection slave; ---disable_warnings -stop slave; -source include/wait_for_slave_to_stop.inc; ---enable_warnings -connection master; ---disable_warnings ---disable_query_log -use test; ---enable_query_log -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -reset master; ---disable_query_log -reset slave; ---enable_query_log -connection slave; -reset slave; -# Clean up old test tables ---disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings ---disable_query_log -reset master; ---enable_query_log -start slave; -source include/wait_for_slave_to_start.inc; diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index e0eb87f02f7..9ed206b2c22 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -1,12 +1,63 @@ -# Replication tests need binlog -source include/have_log_bin.inc; +# ==== Purpose ==== +# +# Configure two servers to be replication master and slave. +# +# ==== Usage ==== +# +# [--let $rpl_server_count= N] +# [--let $rpl_check_server_ids= 1] +# [--let $rpl_skip_reset_master_and_slave= 1] +# [--let $rpl_skip_change_master= 1] +# [--let $rpl_skip_start_slave= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/master-slave.inc +# +# Parameters: +# $rpl_check_server_ids, $rpl_skip_reset_master_and_slave, +# $rpl_skip_change_master, $rpl_skip_start_slave, $rpl_debug, +# $slave_timeout +# See include/rpl_init.inc +# +# $rpl_server_count +# By default, two servers are configured. You can configure more +# servers (servers 3, 4, etc are neither masters nor slaves) by +# setting this variable. See also include/rpl_init.inc -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); -connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); --- source include/master-slave-reset.inc +--let $include_filename= master-slave.inc +if ($rpl_server_count) +{ + --let $include_filename= master-slave.inc [rpl_server_count=$rpl_server_count] +} +--source include/begin_include_file.inc -# Set the default connection to 'master' -connection master; + +--let $rpl_topology= 1->2 +--source include/rpl_init.inc + +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc + +--let $rpl_connection_name= master1 +--let $rpl_server_number= 1 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave +--let $rpl_server_number= 2 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave1 +--let $rpl_server_number= 2 +--source include/rpl_connect.inc + + +--let $include_filename= master-slave.inc +--source include/end_include_file.inc + + +# Set the default connection to 'master'. Do this after +# end_include_file.inc, so that it gets printed to the query log. +--let $rpl_connection_name= master +--source include/rpl_connection.inc diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql index 798b0774849..36f857d5f58 100644 --- a/mysql-test/include/mtr_check.sql +++ b/mysql-test/include/mtr_check.sql @@ -13,7 +13,8 @@ BEGIN -- that are supposed to change SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name != 'timestamp' - AND variable_name != 'INNODB_IBUF_MAX_SIZE' + AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND + variable_name != 'INNODB_FILE_FORMAT_CHECK' ORDER BY variable_name; -- Dump all databases, there should be none @@ -59,13 +60,3 @@ BEGIN mysql.user; END|| - --- --- Procedure used by test case used to force all --- servers to restart after testcase and thus skipping --- check test case after test --- -CREATE DEFINER=root@localhost PROCEDURE force_restart() -BEGIN - SELECT 1 INTO OUTFILE 'force_restart'; -END|| diff --git a/mysql-test/include/mysqldump.inc b/mysql-test/include/mysqldump.inc index 6227138b012..3a53bf8e3bd 100644 --- a/mysql-test/include/mysqldump.inc +++ b/mysql-test/include/mysqldump.inc @@ -41,8 +41,7 @@ eval ALTER TABLE $table_name RENAME to $orig_table_name; --echo # Compare original and recreated tables --echo # Recreated table: $table_name --echo # Original table: $orig_table_name -let $diff_table_1 = $table_name; -let $diff_table_2 = $orig_table_name; +let $diff_tables = $table_name, $orig_table_name; --source include/diff_tables.inc --echo # Cleanup --remove_file $mysqldumpfile diff --git a/mysql-test/include/ndb_master-slave.inc b/mysql-test/include/ndb_master-slave.inc index 0bf4b701f0c..8305a310953 100644 --- a/mysql-test/include/ndb_master-slave.inc +++ b/mysql-test/include/ndb_master-slave.inc @@ -1,10 +1,4 @@ -# Replication tests need binlog -source include/have_log_bin.inc; - -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); -connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); +--source include/master-slave.inc connection slave; # Check that server is compiled and started with support for NDB @@ -14,7 +8,5 @@ select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schem --source include/ndb_not_readonly.inc enable_query_log; --- source include/master-slave-reset.inc - # Set the default connection to 'master' connection master; diff --git a/mysql-test/include/ndb_master-slave_2ch.inc b/mysql-test/include/ndb_master-slave_2ch.inc index 52a06c01d86..17017d2b801 100644 --- a/mysql-test/include/ndb_master-slave_2ch.inc +++ b/mysql-test/include/ndb_master-slave_2ch.inc @@ -1,7 +1,6 @@ -############################################################# -# Author: Serge Kozlov <skozlov@mysql.com> -# Date: 03/17/2008 -# Purpose: Set up circular cluster replication where each +# ==== Purpose ==== +# +# Set up circular cluster replication where each # cluster has two mysqlds and replication directions are # following: # master ---> slave @@ -9,128 +8,60 @@ # cluster A cluster B # \ / # master1 <--- slave1 -############################################################# - ---source include/have_log_bin.inc +# +# ==== Usage ==== +# +# [--let $rpl_server_count= N] +# [--let $rpl_skip_check_server_ids= 1] +# [--let $rpl_skip_reset_master_and_slave= 1] +# [--let $rpl_skip_change_master= 1] +# [--let $rpl_skip_start_slave= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/ndb_master-slave_2ch.inc +# +# Parameters: +# $rpl_server_count, $rpl_skip_check_server_ids, +# $rpl_skip_reset_master_and_slave, $rpl_skip_change_master, +# $rpl_skip_start_slave, $rpl_debug, $slave_timeout +# See include/master-slave.inc + +--let $rpl_topology= 1->2,4->3 +--let $rpl_skip_check_server_ids= 1 +--source include/rpl_init.inc # Make connections to mysqlds -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT1,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); -connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,); - -# Check that all mysqld compiled with ndb support - ---connection master ---disable_query_log ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc ---enable_query_log - ---connection master1 ---disable_query_log ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc ---enable_query_log - ---connection slave ---disable_query_log ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc ---enable_query_log - ---connection slave1 ---disable_query_log ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc ---enable_query_log - -# Stop slaves - ---connection master ---disable_warnings -STOP SLAVE; ---wait_for_slave_to_stop ---enable_warnings +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc ---connection master1 ---disable_warnings -STOP SLAVE; ---wait_for_slave_to_stop ---enable_warnings +--let $rpl_connection_name= master1 +--let $rpl_server_number= 1 +--source include/rpl_connect.inc ---connection slave ---disable_warnings -STOP SLAVE; ---wait_for_slave_to_stop ---enable_warnings +--let $rpl_connection_name= slave +--let $rpl_server_number= 2 +--source include/rpl_connect.inc ---connection slave1 ---disable_warnings -STOP SLAVE; ---wait_for_slave_to_stop ---enable_warnings +--let $rpl_connection_name= slave1 +--let $rpl_server_number= 2 +--source include/rpl_connect.inc -# Reset masters ---connection master ---disable_warnings ---disable_query_log -USE test; ---enable_query_log -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -RESET MASTER; - ---connection master1 ---disable_warnings ---disable_query_log -USE test; ---enable_query_log -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -RESET MASTER; - ---connection slave ---disable_warnings ---disable_query_log -USE test; ---enable_query_log -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -RESET MASTER; - ---connection slave1 ---disable_warnings ---disable_query_log -USE test; ---enable_query_log -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -RESET MASTER; - -# Start slaves - ---connection slave -RESET SLAVE; ---replace_result $MASTER_MYPORT MASTER_MYPORT ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root' -START SLAVE; ---source include/wait_for_slave_to_start.inc - ---connection master1 -RESET SLAVE; ---replace_result $SLAVE_MYPORT1 SLAVE_MYPORT1 ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root' -START SLAVE; ---source include/wait_for_slave_to_start.inc +# Check that all mysqld are compiled with ndb support +--let $_rpl_server= 4 +while ($_rpl_server) +{ + --connection server_$_rpl_server + if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'ndbcluster' AND (support = 'YES' OR support = 'DEFAULT')`) + { + --skip Test requires NDB. + } + --source include/ndb_not_readonly.inc + --dec $_rpl_server +} # Set the default connection to 'master' (cluster A) connection master; - diff --git a/mysql-test/include/ndb_not_readonly.inc b/mysql-test/include/ndb_not_readonly.inc index f50ca0cab66..ebb343bb18d 100644 --- a/mysql-test/include/ndb_not_readonly.inc +++ b/mysql-test/include/ndb_not_readonly.inc @@ -2,6 +2,9 @@ # # wait for server to connect properly to cluster # + +--disable_query_log + set @saved_log = @@sql_log_bin; set sql_log_bin = 0; --error 0,ER_NO_SUCH_TABLE,ER_OPEN_AS_READONLY,ER_GET_ERRMSG,ER_KEY_NOT_FOUND @@ -25,6 +28,9 @@ while ($mysql_errno) } delete from mysql.ndb_apply_status where server_id=0; set sql_log_bin = @saved_log; + +--enable_query_log + # # connected # diff --git a/mysql-test/include/not_debug.inc b/mysql-test/include/not_debug.inc new file mode 100644 index 00000000000..5ea01fe2935 --- /dev/null +++ b/mysql-test/include/not_debug.inc @@ -0,0 +1,6 @@ +let $is_debug = `select version() like '%debug%'`; +if ($is_debug) +{ + skip Does not run in with debug binaries; +} + diff --git a/mysql-test/include/report-features.test b/mysql-test/include/report-features.test index 1e4ab232490..75879f67165 100644 --- a/mysql-test/include/report-features.test +++ b/mysql-test/include/report-features.test @@ -9,4 +9,4 @@ show engines; show variables; --echo ===== STOP ===== --enable_query_log -exit;
\ No newline at end of file +exit; diff --git a/mysql-test/include/reset_master_and_slave.inc b/mysql-test/include/reset_master_and_slave.inc deleted file mode 100644 index 30ba1f07a40..00000000000 --- a/mysql-test/include/reset_master_and_slave.inc +++ /dev/null @@ -1,8 +0,0 @@ ---echo **** Resetting master and slave **** -connection slave; -source include/stop_slave.inc; -RESET SLAVE; -connection master; -RESET MASTER; -connection slave; -source include/start_slave.inc; diff --git a/mysql-test/include/restart_mysqld.inc b/mysql-test/include/restart_mysqld.inc index 0f363ff1ee3..7cb9c7994d8 100644 --- a/mysql-test/include/restart_mysqld.inc +++ b/mysql-test/include/restart_mysqld.inc @@ -1,18 +1,24 @@ +if ($rpl_inited) +{ + if (!$allow_rpl_inited) + { + --die ERROR IN TEST: When using the replication test framework (master-slave.inc, rpl_init.inc etc), use rpl_restart_server.inc instead of restart_mysqld.inc. If you know what you are doing and you really have to use restart_mysqld.inc, set allow_rpl_inited=1 before you source restart_mysqld.inc + } +} + # Write file to make mysql-test-run.pl expect the "crash", but don't start # it until it's told to ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF +--let $_server_id= `SELECT @@server_id` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--exec echo "wait" > $_expect_file_name # Send shutdown to the connected server and give # it 10 seconds to die before zapping it shutdown_server 10; # Write file to make mysql-test-run.pl start up the server again ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF +--exec echo "restart" > $_expect_file_name # Turn on reconnect --enable_reconnect diff --git a/mysql-test/include/rpl_change_topology.inc b/mysql-test/include/rpl_change_topology.inc new file mode 100644 index 00000000000..d25ebfbf25c --- /dev/null +++ b/mysql-test/include/rpl_change_topology.inc @@ -0,0 +1,248 @@ +# ==== Purpose ==== +# +# Changes replication topology. This file is normally sourced from +# include/rpl_init.inc, but test cases can also source it if they +# need to change topology after they have sourced include/rpl_init.inc +# +# This file sets up variables needed by include/rpl_sync.inc and many +# other replication scripts in the include/ directory. It also issues +# CHANGE MASTER on all servers where the configuration changes from +# what it was before. It does not issue START SLAVE (use +# include/rpl_start_slaves.inc for that). +# +# Note: it is not currently possible to change the number of servers +# after the rpl_init.inc, without first calling rpl_end.inc. So the +# test has to set $rpl_server_count to the total number of servers +# that the test uses, before it sources include/rpl_init.inc. After +# that, $rpl_server_count must not change until after next time the +# test sources include/rpl_end.inc. +# +# Note: Since this script issues CHANGE MASTER, the test case must +# ensure that all slaves where the configuration changes have stopped +# both the IO thread and the SQL thread before this script is sourced. +# +# +# ==== Usage ==== +# +# [--let $rpl_server_count= 7] +# --let $rpl_topology= 1->2->3->1->4, 2->5, 6->7 +# [--let $rpl_skip_change_master= 1] +# [--let $rpl_master_log_file= 1:master-bin.000001,3:master-bin.000003] +# [--let $rpl_master_log_pos= 1:4711,3:107] +# [--let $rpl_debug= 1] +# --source include/rpl_change_topology.inc +# +# Parameters: +# $rpl_master_log_file +# By default, CHANGE MASTER is executed with MASTER_LOG_FILE set +# to the name of the last binlog file on the master (retrieved by +# executing SHOW MASTER STATUS). This variable can be set to +# specify another filename. This variable should be a +# comma-separated list of the following form: +# +# SERVER_NUMBER_1:FILE_NAME_1,SERVER_NUMBER_2:FILE_NAME_2,... +# +# Before CHANGE MASTER is executed on server N, this script checks +# if $rpl_master_log_file contains the text N:FILE_NAME. If it +# does, then MASTER_LOG_FILE is set to FILE_NAME. Otherwise, +# MASTER_LOG_FILE is set to the last binlog on the master. For +# example, to specify that server_1 should start replicate from +# master-bin.000007 and server_5 should start replicate from +# master-bin.012345, do: +# --let $rpl_master_log_file= 1:master-bin.000007,5:master-bin.012345 +# +# $rpl_master_log_pos +# By default, CHANGE MASTER is executed without specifying the +# MASTER_LOG_POS parameter. This variable can be set to set a +# specific position. It has the same form as $rpl_master_log_file +# (see above). For example, to specify that server_3 should start +# replicate from position 4711 of its master, do: +# --let $rpl_master_log_pos= 3:4711 +# +# $rpl_server_count, $rpl_topology, $rpl_debug, $rpl_skip_change_master +# See include/rpl_init.inc +# +# +# ==== Internal variables configured by this file ==== +# +# This file sets up the following variables, which are used by other +# low-level replication files such as: +# include/rpl_sync.inc +# include/rpl_start_slaves.inc +# include/rpl_stop_slaves.inc +# include/rpl_end.inc +# +# $rpl_server_count_length: +# Set to LENGTH($rpl_server_count). So if $rpl_server_count < 10, +# then $rpl_server_count_length = 1; if 10 <= $rpl_server_count < +# 100, then $rpl_server_count_length = 2, etc. +# +# $rpl_master_list +# Set to a string consisting of $rpl_server_count numbers, each one +# whitespace-padded to $rpl_server_count_length characters. If +# server N is a slave, then the N'th number is the master of server +# N. If server N is not a slave, then the N'th number is just spaces +# (so in fact it is not a number). For example, if $rpl_topology is +# '1->2,2->3,3->1,2->4,5->6', then $rpl_master_list is '3122 6'. +# +# $rpl_sync_chain_dirty +# This variable is set to 1. This tells include/rpl_sync.inc to +# compute a new value for $rpl_sync_chain next time that +# include/rpl_sync.inc is sourced. See +# include/rpl_generate_sync_chain.inc and include/rpl_sync.inc for +# details. + + +# Remove whitespace from $rpl_topology +--let $rpl_topology= `SELECT REPLACE('$rpl_topology', ' ', '')` + +--let $include_filename= rpl_change_topology.inc [new topology=$rpl_topology] +--source include/begin_include_file.inc + + +if ($rpl_debug) +{ + --echo ---- Check input ---- +} + + +if (`SELECT '$rpl_topology' = '' OR '$rpl_server_count' = ''`) +{ + --die You must set $rpl_topology and $rpl_server_count before you source rpl_change_topology.inc. If you really want to change to the empty topology, set $rpl_topology= none +} +--let $_rpl_topology= $rpl_topology +if (`SELECT '$_rpl_topology' = 'none'`) +{ + --let $_rpl_topology= +} +if (`SELECT '!$rpl_master_list!' = '!!'`) +{ + --die You must source include/rpl_init.inc before you source include/rpl_change_topology.inc +} +--let $_rpl_old_master_list= $rpl_master_list + +if ($rpl_debug) +{ + --echo \$rpl_server_count='$rpl_server_count' + --echo \$rpl_server_count_length='$rpl_server_count_length' + --echo new \$rpl_topology='$_rpl_topology' + --echo old \$rpl_master_list='$rpl_master_list' + --echo old \$rpl_sync_chain='$rpl_sync_chain' +} + + +if ($rpl_debug) +{ + --echo ---- Generate \$rpl_server_count_length and \$rpl_master_list ---- +} + +--let $rpl_server_count_length= `SELECT LENGTH('$rpl_server_count')` +--let $rpl_master_list= +--let $_rpl_no_server= `SELECT REPEAT(' ', $rpl_server_count_length)` +--let $rpl_master_list= `SELECT REPEAT('$_rpl_no_server', $rpl_server_count)` +while ($_rpl_topology) +{ + # Get 's1->s2' from 's1->s2->s3->...' or from 's1->s2,s3->s4,...' + --let $_rpl_master_slave= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('$_rpl_topology', ',', 1), '->', 2)` + # Modify $_rpl_topology as follows: + # - If it starts with 's1->s2,', remove 's1->s2,' + # - If it starts with 's1->s2->', remove 's1->' + # - If it is equal to 's1->s2', remove 's1->s2' + --let $_rpl_topology= `SELECT SUBSTR('$_rpl_topology', IF(SUBSTR('$_rpl_topology', LENGTH('$_rpl_master_slave') + 1, 2) != '->', LENGTH('$_rpl_master_slave'), LOCATE('->', '$_rpl_master_slave')) + 2)` + # Get 's1' from 's1->s2' + --let $_rpl_master= `SELECT SUBSTRING_INDEX('$_rpl_master_slave', '->', 1)` + # Get 's2' from 's1->s2' + --let $_rpl_slave= `SELECT SUBSTRING('$_rpl_master_slave', LENGTH('$_rpl_master') + 3)` + # Check that s2 does not have another master. + if (`SELECT SUBSTR('$rpl_master_list', 1 + ($_rpl_slave - 1) * $rpl_server_count_length, $rpl_server_count_length) != '$_rpl_no_server'`) + { + --echo ERROR IN TEST: Server '$_rpl_slave' has more than one master in topology '$rpl_topology' + --die ERROR IN TEST: found a server with more than one master in the $rpl_topology variable + } + # Save 's1' at position 's2' in $rpl_master_list + --let $rpl_master_list= `SELECT INSERT('$rpl_master_list', 1 + ($_rpl_slave - 1) * $rpl_server_count_length, $rpl_server_count_length, RPAD('$_rpl_master', $rpl_server_count_length, ' '))` +} + +if ($rpl_debug) +{ + --echo new \$rpl_server_count_length = '$rpl_server_count_length' + --echo new \$rpl_master_list = '$rpl_master_list' +} + +if (!$rpl_skip_change_master) +{ + if ($rpl_debug) + { + --echo ---- Execute CHANGE MASTER on all servers ---- + } + + if (!$rpl_debug) + { + --disable_query_log + } + + --let $_rpl_server= $rpl_server_count + while ($_rpl_server) + { + # The following statement evaluates to: + # 0, if server_$_rpl_server has the same master as before. + # The master's server, if server_$_rpl_server is a slave. + # The empty string, if server_$_rpl_server is not a slave. + --let $_rpl_master= `SELECT TRIM(IFNULL(NULLIF(SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length), SUBSTRING('$_rpl_old_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length)), 0))` + if ($rpl_debug) + { + --echo \$_rpl_server='$_rpl_server' \$_rpl_master='$_rpl_master' + } + if ($_rpl_master) + { + # Get port number + --let $_rpl_port= \$SERVER_MYPORT_$_rpl_master + # Get MASTER_LOG_FILE + --let $_rpl_master_log_file_index= `SELECT LOCATE('$_rpl_server:', '$rpl_master_log_file')` + if ($_rpl_master_log_file_index) + { + # Get text from after ':' and before ',', starting at + # $_rpl_master_log_file + --let $_rpl_master_log_file= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$rpl_master_log_file', $_rpl_master_log_file_index), ',', 1), ':', -1)` + } + if (!$_rpl_master_log_file_index) + { + --let $rpl_connection_name= server_$_rpl_master + --source include/rpl_connection.inc + --let $_rpl_master_log_file= query_get_value(SHOW MASTER STATUS, File, 1) + } + # Change connection. + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + # Get MASTER_LOG_POS + --let $_rpl_master_log_pos_index= `SELECT LOCATE('$_rpl_server:', '$rpl_master_log_pos')` + if ($_rpl_master_log_pos_index) + { + --let $_rpl_master_log_pos= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$rpl_master_log_pos', $_rpl_master_log_pos_index), ',', 1), ':', -1)` + --let $_rpl_master_log_pos= , MASTER_LOG_POS = $_rpl_master_log_pos + } + if (!$_rpl_master_log_pos_index) + { + --let $_rpl_master_log_pos= + } + eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1; + } + if (!$_rpl_master) + { + if (`SELECT '$_rpl_master' = ''`) + { + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + CHANGE MASTER TO MASTER_HOST = ''; + } + } + --dec $_rpl_server + } +} + + +--let $rpl_sync_chain_dirty= 1 + + +--let $include_filename= rpl_change_topology.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_connect.inc b/mysql-test/include/rpl_connect.inc new file mode 100644 index 00000000000..a4d18dd5f9c --- /dev/null +++ b/mysql-test/include/rpl_connect.inc @@ -0,0 +1,58 @@ +# ==== Purpose ==== +# +# Create a connection to a given numbered server. +# +# This script is normally used internally by rpl_init.inc and +# master-slave.inc, but it can also be used in test cases that need to +# create more connections or re-create connections after disconnect. +# +# +# ==== Usage ==== +# +# --let $rpl_connection_name= <connection_name> +# --let $rpl_server_number= <server_number> +# [--let $rpl_debug= 1] +# --source include/rpl_connect.inc +# +# Parameters: +# $rpl_connection_name +# The name of the connection to create. +# +# $rpl_server_number +# The number of the server to connect to. +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= rpl_connect.inc [creating $rpl_connection_name] +--source include/begin_include_file.inc + + +if (!$rpl_server_number) +{ + --die ERROR IN TEST: You must set $rpl_server_number before sourcing include/rpl_connect.inc +} +if (`SELECT '$rpl_connection_name' = ''`) +{ + --die ERROR IN TEST: You must set $rpl_connection_name before sourcing include/rpl_connect.inc +} + +# Get port number +--let $_rpl_port= \$SERVER_MYPORT_$rpl_server_number +if (!$_rpl_port) +{ + --echo Bug in test case: '\$SERVER_MYPORT_$rpl_server_number' not initialized. Check the test's .cfg file. + --die Not all SERVER_MYPORT_* environment variables are setup correctly. +} + +# Create connection. +if ($rpl_debug) +{ + --echo connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,) +} +--connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,) + + +--let $include_filename= rpl_connect.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_connection.inc b/mysql-test/include/rpl_connection.inc new file mode 100644 index 00000000000..1988568a4d2 --- /dev/null +++ b/mysql-test/include/rpl_connection.inc @@ -0,0 +1,47 @@ +# ==== Purpose ==== +# +# The same as 'connection $rpl_connection_name', but it can also +# prints the connection name. The connection is printed if $rpl_debug +# is set, or if rpl_connection.inc is not called between two +# invocations of begin_include_file.inc/end_include_file.inc. +# Otherwise the connection name is not printed. +# +# +# ==== Usage ==== +# +# --let $rpl_connection_name= master +# [--let $rpl_debug= 1] +# --source include/rpl_connection.inc +# +# Parameters: +# $rpl_connection_name +# Name of the connection to connect to. +# +# $rpl_debug +# By default, the connection name is printed only when this file +# is sourced from a top-level test script. If $rpl_debug is set, +# the connection name is also printed whenever auxiliary files +# like rpl_init.inc change connection. + + +if (!$rpl_connection_name) +{ + --die ERROR IN TEST: you must set $rpl_connection_name before sourcing rpl_connection.inc +} + +# This is the same as "if (!$_rpl_include_file_depth || $rpl_debug)", +# but the mysqltest language doesn't have boolean operations. + +if (!$_include_file_depth) +{ + --echo [connection $rpl_connection_name] +} +if ($_include_file_depth) +{ + if ($rpl_debug) + { + --echo [connection $rpl_connection_name] + } +} +--connection $rpl_connection_name +--let $rpl_connection_name= diff --git a/mysql-test/include/rpl_diff.inc b/mysql-test/include/rpl_diff.inc new file mode 100644 index 00000000000..bf24b4f2a13 --- /dev/null +++ b/mysql-test/include/rpl_diff.inc @@ -0,0 +1,118 @@ +# ==== Purpose ==== +# +# Diff the output of a statement on all configured servers (usually +# master and slave). +# +# +# ==== Usage ===== +# +# --let $rpl_diff_statement= SELECT * FROM t1 WHERE a < 100 +# [--let $rpl_diff_servers= <server1>,<server2>,...<serverN>] +# --source include/rpl_diff.inc +# +# Parameters: +# $rpl_diff_statement +# Statement to check. For each compared server, this script will +# start a new client and pass this statement to the client. +# Note: This string will be evaluated as a single-quote-escaped +# SQL string and hence must be quoted as such. In particular, any +# single quotes in this string must be escaped. +# +# $rpl_diff_servers +# By default, this file compares all servers configured by +# rpl_init.inc. You can set $diff_servers to a comma-separated +# list of numbers: only the servers identified by these numbers +# will be compared. +# +# $rpl_diff_database +# By default, the statement will be executed on the database +# 'test'. If $rpl_diff_database is set, the statement will be +# executed on the database named $rpl_diff_database instead. + + +--let $include_filename= rpl_diff.inc +--source include/begin_include_file.inc + + +if (!$rpl_diff_statement) +{ + --die ERROR IN TEST: you must set $rpl_diff_statement before you source include/rpl_diff.inc +} + + +# Sync. +--source include/rpl_sync.inc + + +# Get database name. +--let $_rpl_diff_database= $rpl_diff_database +if (`SELECT '$_rpl_diff_database' = ''`) +{ + --let $_rpl_diff_database= test +} + + +# Generate list of servers. +--let $_rpl_diff_servers= $rpl_diff_servers +if (!$_rpl_diff_servers) +{ + --let $_rpl_server_i= $rpl_server_count + --let $_rpl_diff_servers= + while ($_rpl_server_i) + { + --let $_rpl_diff_servers= $_rpl_server_i,$_rpl_diff_servers + --dec $_rpl_server_i + } +} +if ($rpl_debug) +{ + --echo \$rpl_diff_servers= '$_rpl_diff_servers' +} + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +# Generate file containing $rpl_diff_statement. We don't pass the +# statement on the command line, because it would be subject to shell +# substitutions. +--let $write_to_file= GENERATE +--let $write_var= $rpl_diff_statement +--source include/write_var_to_file.inc +--let $_rpl_diff_statement_file= $write_to_file + + +# Compare all servers. +--let $_rpl_diff_first= 1 +while ($_rpl_diff_servers) +{ + # Set $_rpl_diff_server_i to the first number in the list + --let $_rpl_diff_server_i= `SELECT SUBSTRING_INDEX('$_rpl_diff_servers', ',', 1)` + # Remove $_rpl_diff_server_i from the list + --let $_rpl_diff_servers= `SELECT SUBSTRING('$_rpl_diff_servers', LENGTH('$_rpl_diff_server_i') + 2)` + + # Execute statement + --let $_rpl_diff_file= $MYSQLTEST_VARDIR/tmp/_rpl_diff_server-$_rpl_diff_server_i.tmp + --exec $MYSQL --defaults-group-suffix=.$_rpl_diff_server_i $_rpl_diff_database < $_rpl_diff_statement_file > $_rpl_diff_file + + # Compare + if (!$_rpl_diff_first) + { + if ($rpl_debug) + { + --echo diffing $_rpl_diff_file and $_rpl_diff_prev_file + } + --diff_files $_rpl_diff_file $_rpl_diff_prev_file + --remove_file $_rpl_diff_prev_file + } + --let $_rpl_diff_prev_file= $_rpl_diff_file + --let $_rpl_diff_first= 0 +} +--remove_file $_rpl_diff_prev_file + + +--let $include_filename= rpl_diff.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc deleted file mode 100644 index 7fc68422c40..00000000000 --- a/mysql-test/include/rpl_diff_tables.inc +++ /dev/null @@ -1,36 +0,0 @@ -# ############################################################################# -# Check whether the given table is consistent between different master and -# slaves -# -# Usage: -# --let $diff_table= test.t1 -# --let $diff_server_list= master, slave, slave2 -# --source include/rpl_diff_tables.inc -# ############################################################################# - -if (`SELECT "XX$diff_table" = "XX"`) -{ - --die diff_table is null. -} - ---let $_servers= master, slave -if (`SELECT "XX$diff_server_list" <> "XX"`) -{ - --let $_servers= $diff_server_list -} - ---let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` ---let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))` -connection $_master; -while (`SELECT "XX$_servers" <> "XX"`) -{ - --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` - --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))` - - --sync_slave_with_master $_slave - --let $diff_table_1= $_master:$diff_table - --let $diff_table_2= $_slave:$diff_table - --source include/diff_tables.inc - connection $_slave; -} -connection $_master; diff --git a/mysql-test/include/rpl_end.inc b/mysql-test/include/rpl_end.inc new file mode 100644 index 00000000000..8f1d7f695fc --- /dev/null +++ b/mysql-test/include/rpl_end.inc @@ -0,0 +1,103 @@ +# ==== Purpose ==== +# +# Shut down replication initialized by include/rpl_init.inc. +# +# This syncs all servers, executes STOP SLAVE on all servers, executes +# CHANGE MASTER on all servers, and disconnects all connections +# configured by rpl_init.inc. +# +# It does not execute RESET MASTER or RESET SLAVE, because that would +# remove binlogs which are possibly useful debug information in case +# the test case later fails with a result mismatch. If you need that, +# source include/rpl_reset.inc before you source this file. +# +# +# ==== Usage ==== +# +# [--let $rpl_only_running_threads= 1] +# [--let $rpl_debug= 1] +# --source include/rpl_end.inc +# +# Parameters: +# $rpl_only_running_threads +# If one or both of the IO and SQL threads is stopped, sync and +# stop only the threads that are running. See +# include/rpl_sync.inc and include/stop_slave.inc for details. +# +# $rpl_debug +# See include/rpl_init.inc +# +# Note: +# This script will fail if Last_SQL_Error or Last_IO_Error is +# nonempty. If you expect an error in the SQL thread, you should +# normally call this script as follows: +# +# --source include/wait_for_slave_sql_error.inc +# --source include/stop_slave_io.inc +# RESET SLAVE; +# --let $rpl_only_running_threads= 1 +# --source include/rpl_end.inc +# +# +# ==== Side effects ==== +# +# Changes the current connection to 'default'. + + +--let $include_filename= rpl_end.inc +--source include/begin_include_file.inc + + +if (!$rpl_inited) +{ + --die ERROR IN TEST: rpl_end.inc was sourced when replication was not configured. Most likely, rpl_end.inc was sourced twice or rpl_init.inc has not been sourced. +} + + +if ($rpl_debug) +{ + --echo ---- Check that no slave thread has an error ---- +} + +--let $_rpl_server= $rpl_server_count +while ($_rpl_server) +{ + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + + # Only check slave threads for error on hosts that were at some + # point configured as slave. + --let $_tmp= query_get_value(SHOW SLAVE STATUS, Master_Host, 1) + if (`SELECT '$_tmp' != 'No such row'`) + { + --source include/check_slave_no_error.inc + } + + --dec $_rpl_server +} + +--source include/rpl_sync.inc +--source include/rpl_stop_slaves.inc + +# mtr configures server 2 to be a slave before it runs the test. We +# have to restore that state now, so we change topology to 1->2. +--let $rpl_topology= 1->2 +--source include/rpl_change_topology.inc + + +--connection default +--let $_rpl_server= $rpl_server_count +--let $_rpl_one= _1 +while ($_rpl_server) +{ + --disconnect server_$_rpl_server + --disconnect server_$_rpl_server$_rpl_one + --dec $_rpl_server +} + +--let $rpl_inited= 0 + +# Do not restore connection, because we have disconnected it. +--let $skip_restore_connection= 1 +--let $include_filename= rpl_end.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_for_each_slave.inc b/mysql-test/include/rpl_for_each_slave.inc new file mode 100644 index 00000000000..65d242cf894 --- /dev/null +++ b/mysql-test/include/rpl_for_each_slave.inc @@ -0,0 +1,39 @@ +# ==== Purpose ==== +# +# Execute a .inc file once for each server that was configured as a +# slave by rpl_init.inc +# +# +# ==== Usage ==== +# +# --let $rpl_source_file +# [--let $rpl_debug= 1] +# --source include/rpl_for_each_slave.inc +# +# Parameters: +# $rpl_source_file +# The file that will be sourced. +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= rpl_for_each_file.inc [$rpl_source_file] +--source include/begin_include_file.inc + +--let $_rpl_server= $rpl_server_count +while ($_rpl_server) +{ + --let $_rpl_has_master= `SELECT SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length) != ''` + if ($_rpl_has_master) + { + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + --source $rpl_source_file + } + --dec $_rpl_server +} + + +--let $include_filename= rpl_for_each_file.inc [$rpl_source_file] +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_generate_sync_chain.inc b/mysql-test/include/rpl_generate_sync_chain.inc new file mode 100644 index 00000000000..9104c21c3b8 --- /dev/null +++ b/mysql-test/include/rpl_generate_sync_chain.inc @@ -0,0 +1,122 @@ +# ==== Purpose ==== +# +# Setup $rpl_sync_chain, which is used by rpl_sync.inc. You normally +# don't need to source this file, it should only be sourced by +# rpl_sync.inc. +# +# $rpl_sync_chain is set to a string that specifies in what order +# servers should be synchronized in include/rpl_sync.inc. This has the +# form of a sequence of "chains" (with no separator between two +# chains). Each chain begins with $rpl_server_count_length space +# characters, followed by a sequence of numbers, each number +# whitespace-padded to $rpl_server_count_length characters. Each +# number in the sequence denotes a server, and the N'th server is a +# master of the (N+1)'th server. For example, if $rpl_topology is +# '1->2,2->3,3->1,2->4,5->6', then $rpl_sync_chain is ' 56 123124'. +# +# +# ==== Usage ==== +# +# [--let $rpl_debug= 1] +# --source include/rpl_generate_sync_chain.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= rpl_generate_sync_chain.inc +--source include/begin_include_file.inc + + +# Algorithm: +# 0. Mark all servers as unseen and unsynced. +# 1. Let S be a server that is marked unseen. +# 2. Append S to the list of seen servers. +# 3. Check how S is marked: +# 3.1. If S has no master: append the list of seen servers (in +# order from grand-master to grand-slave) to the end of +# $rpl_sync_chain. Go to 3. +# 3.2. Elseif S is marked as synced: append the list of seen +# servers (in order from grand-master to grand-slave) to the +# end of $rpl_sync_chain. Go to 3. +# 3.3. Elseif S is marked as unsynced but seen: This means that the +# graph of visited servers has a "6-shape": it is a loop with +# a tail, such as 1->2->3->1->4->5. We should first sync the +# loop, and then the tail. To ensure all servers in the loop +# are synced, we must sync the loop two turns minus two +# servers. For example, the loop 1->2->3->4->5->1 is fully +# synced by this sequence of 1-step synchronizations: +# 1->2->3->4->5->1->2->3->4. Hence we do this: in the list of +# traversed servers (in order from grand-master to +# grand-slave), find the first occurrence of S. Take the +# sub-list starting at the 3rd server and ending at the first +# occurrence of S. Append this sub-list it to the end of +# $rpl_sync_chain. Then append the entire list of traversed +# servers (in order from grand-master to grand-slave) to +# $rpl_sync_chain. Go to 3. +# 3.4. Else (i.e., S has a master and is not marked as seen or +# synced): Mark S as seen. Set S=master(S) and go back to 2. +# 4. For each server that is marked as seen, mark it as synced. +# 5. If there are unseen servers, go back to 1. + +# $_rpl_server_marks holds the marks of all servers. The i'th character +# corresponds to the mark of server i: +# '0' = unseen & unmarked, '1' = seen & unsynced, '2' = seen & synced. +--let $_rpl_server_marks= `SELECT REPEAT('0', $rpl_server_count)` +--let $_rpl_start_server= $rpl_server_count +--let $rpl_sync_chain= +while ($_rpl_start_server) +{ + --let $_rpl_server= `SELECT RPAD('$_rpl_start_server', $rpl_server_count_length, ' ')` + --let $_rpl_seen_list= + --let $_rpl_continue_loop= 1 + while ($_rpl_continue_loop) + { + --let $_rpl_master= `SELECT SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length)` + # We need to delimit elements of $_rpl_seen_list with commas, so + # that LOCATE() below will not find spurious matches that begin in + # the middle of one element and end in the middle of next element. + --let $_rpl_seen_list= $_rpl_server,$_rpl_seen_list + # If server is marked seen or synced, or has no master + if (`SELECT SUBSTRING('$_rpl_server_marks', $_rpl_server, 1) != 0 OR '$_rpl_master' = ''`) + { + # If server is marked seen but not synced. + if (`SELECT SUBSTRING('$_rpl_server_marks', $_rpl_server, 1) = 1`) + { + # Get sub-list of servers to prepend to server list. + # E.g., if topology is 1->2->3->4->1->5, then at this point + # $_rpl_seen_list='1,2,3,4,1,5,' and we have to prepend '4,3,' + # to it. Hence, the sub-list starts at position + # 1+2*($rpl_server_count_length+1) and ends at the first + # occurrence of ',1,' in the list. + --let $_rpl_extra_list= `SELECT SUBSTRING('$_rpl_seen_list', 1 + 2 * ($rpl_server_count_length + 1), LOCATE(',$_rpl_server,', '$_rpl_seen_list') - 2 * ($rpl_server_count_length + 1))` + --let $_rpl_seen_list= $_rpl_extra_list$_rpl_seen_list + } + # Append the seen servers. Only need to append if the list + # contains at least two elements. + if (`SELECT LENGTH('$_rpl_seen_list') > $rpl_server_count_length + 1`) + { + --let $rpl_sync_chain= $rpl_sync_chain$_rpl_no_server$_rpl_seen_list + } + --let $_rpl_continue_loop= 0 + } + --let $_rpl_server_marks= `SELECT INSERT('$_rpl_server_marks', $_rpl_server, 1, '1')` + --let $_rpl_server= $_rpl_master + } + # Mark seen servers as synced + --let $_rpl_server_marks= `SELECT REPLACE('$_rpl_server_marks', '1', '2')` + # Get highest-numbered unmarked server. + --let $_rpl_start_server= `SELECT IFNULL(NULLIF($rpl_server_count + 1 - LOCATE('0', REVERSE('$_rpl_server_marks')), $rpl_server_count + 1), 0)` +} +# Strip commas: they were only needed temporarily. +--let $rpl_sync_chain= `SELECT REPLACE('$rpl_sync_chain', ',', '')` + +if ($rpl_debug) +{ + --echo Generated \$rpl_sync_chain = '$rpl_sync_chain' +} + + +--let $include_filename= rpl_generate_sync_chain.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc new file mode 100644 index 00000000000..3cf78dc2979 --- /dev/null +++ b/mysql-test/include/rpl_init.inc @@ -0,0 +1,242 @@ +# ==== Purpose ==== +# +# Set up replication on several servers in a specified topology. +# +# By default, this script does the following: +# - Creates the connections server_1, server_2, ..., server_N, as +# well as extra connections server_1_1, server_2_1, ..., +# server_N_1. server_I and server_I_1 are connections to the same +# server. +# - Sets up @@auto_increment_increment and @@auto_increment_increment. +# - Verifies that @@server_id of all servers are different. +# - Calls RESET MASTER, RESET SLAVE, USE test, CHANGE MASTER, START SLAVE. +# - Sets the connection to server_1 before exiting. +# +# ==== Usage ==== +# +# 1. If you are going to use more than two servers, create +# rpl_test.cfg with the following contents: +# +# !include ../my.cnf +# [mysqld.1] +# log-slave-updates +# [mysqld.2] +# log-slave-updates +# ... +# [mysqld.N] +# log-slave-updates +# +# [ENV] +# SERVER_MYPORT_3= @mysqld.3.port +# SERVER_MYPORT_4= @mysqld.4.port +# SERVER_MYPORT_5= @mysqld.5.port +# ... +# SERVER_MYPORT_N= @mysqld.N.port +# +# (It is allowed, but not required, to configure SERVER_MYPORT_1 +# and SERVER_MYPORT_2 too. If these variables are not set, the +# variables MASTER_MYPORT and SLAVE_MYPORT, configured in the +# default my.cnf used by the rpl and rpl_ndb suites, are used +# instead. In addition, in the rpl_ndb suite, SERVER_MYPORT_3 is +# not needed since MASTER_MYPORT1 can be used instead.) +# +# 2. Execute the following near the top of the test: +# +# [--let $rpl_server_count= 7] +# --let $rpl_topology= 1->2->3->1->4, 2->5, 6->7 +# [--let $rpl_check_server_ids= 1] +# [--let $rpl_skip_change_master= 1] +# [--let $rpl_skip_start_slave= 1] +# [--let $rpl_skip_reset_master_and_slave= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/rpl_init.inc +# +# Parameters: +# +# $rpl_server_count +# The number of servers to configure. If this is not set, the largest +# number in $rpl_topology will be used. +# +# $rpl_topology +# A comma-separated list of replication chain +# specifications. Each replication chain specification has the +# form S1->S2->...->Sn, where 1 <= S1,...Sn <= $rpl_server_count. +# This file will configure S(i+1) to be a slave of S(i). If you +# want to specify the empty topology (no server replicates at +# all), you have to set $rpl_topology=none. +# +# $rpl_check_server_ids +# If $rpl_check_server_ids is set, this script checks that the +# @@server_id of all servers are different. This is normally +# guaranteed by mtr, so it is only useful for debugging. +# +# $rpl_skip_reset_master_and_slave +# By default, this script issues RESET MASTER and RESET SLAVE +# before CHANGE MASTER and START SLAVE. RESET MASTER and RESET +# SLAVE are suppressed if $rpl_skip_reset_master_and_slave is +# set. +# +# $rpl_skip_change_master +# By default, this script issues CHANGE MASTER so that all slaves +# are ready to run as specified by $rpl_topology. CHANGE MASTER +# is suppressed if $rpl_skip_change_master is set. +# +# $rpl_skip_start_slave +# By default, this script issues START SLAVE on all slaves +# specified by $rpl_topology. START SLAVE is suppressed if +# $rpl_skip_change_master is set. +# +# $rpl_debug +# By default, this script only outputs a static text that says +# that rpl_init.inc was invoked. If $rpl_debug is set, additional +# debug info is printed. The debug info may be nondeterministic, +# so no test case should be checked in with $rpl_debug set. +# +# $slave_timeout +# Timeout used when waiting for the slave threads to start. +# See include/wait_for_slave_param.inc +# +# +# ==== Side effects ==== +# +# Changes current connection to server_1. + +--source include/have_log_bin.inc + + +--let $include_filename= rpl_init.inc [topology=$rpl_topology] +--source include/begin_include_file.inc + + +if ($rpl_debug) +{ + --echo ---- Check input ---- + --echo MASTER_MYPORT='$MASTER_MYPORT' SLAVE_MYPORT='$SLAVE_MYPORT' MASTER_MYPORT1='$MASTER_MYPORT1' SLAVE_MYPORT1='$SLAVE_MYPORT1' +} + +# Allow $MASTER_MYPORT as alias for $SERVER_MYPORT_1 +if (`SELECT '$SERVER_MYPORT_1' = ''`) +{ + --let SERVER_MYPORT_1= $MASTER_MYPORT +} +# Allow $SLAVE_MYPORT as alias for $SERVER_MYPORT_2 +if (`SELECT '$SERVER_MYPORT_2' = ''`) +{ + --let SERVER_MYPORT_2= $SLAVE_MYPORT +} +# Allow $MASTER_MYPORT1 as alias for $SERVER_MYPORT_3 +# (this alias is used by rpl_ndb tests) +if (`SELECT '$SERVER_MYPORT_3' = ''`) +{ + --let SERVER_MYPORT_3= $MASTER_MYPORT1 +} +# Allow $SLAVE_MYPORT1 as alias for $SERVER_MYPORT_4 +# (this alias is used by rpl_ndb tests) +if (`SELECT '$SERVER_MYPORT_4' = ''`) +{ + --let SERVER_MYPORT_4= $SLAVE_MYPORT1 +} +# Check that $rpl_server_count is set +if (!$rpl_server_count) +{ + --let $_compute_rpl_server_count= `SELECT REPLACE('$rpl_topology', '->', ',')` + --let $rpl_server_count= `SELECT GREATEST($_compute_rpl_server_count)` +} + + +if ($rpl_debug) +{ + --echo ---- Setup connections and reset each server ---- +} + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +# Create two connections to each server; reset master/slave, select +# database, set autoinc variables. +--let $_rpl_server= $rpl_server_count +--let $_rpl_one= _1 +while ($_rpl_server) +{ + # Connect. + --let $rpl_server_number= $_rpl_server + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connect.inc + --let $rpl_connection_name= server_$_rpl_server$_rpl_one + --source include/rpl_connect.inc + + # Configure server. + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + USE test; + if (!$rpl_skip_reset_master_and_slave) + { + RESET MASTER; + RESET SLAVE; + } + eval SET auto_increment_increment= $rpl_server_count; + eval SET auto_increment_offset= $_rpl_server; + + --dec $_rpl_server +} + + +# Signal that initialization is done and all connections created. +--let $rpl_inited= 1 + +# Signal that the server is in a dirty state and needs to be restarted +# if the test is skipped. If the test is not skipped, it will continue +# to the end and execute its cleanup section (and check-testcase will +# report if you forget to clean up). +--source include/force_restart_if_skipped.inc + + +# Assert that all hosts have different server_ids +if ($rpl_check_server_ids) +{ + if ($rpl_debug) + { + --echo ---- Check that @@server_id is distinct for all servers ---- + } + + --let $_rpl_server= $rpl_server_count + while ($_rpl_server) + { + --let $_rpl_server2= $_rpl_server + --dec $_rpl_server2 + while ($_rpl_server2) + { + --let $assert_text= Servers $_rpl_server and $_rpl_server2 should have different @@server_id + --let $assert_condition= [$_rpl_server:SELECT @@server_id AS i, i, 1] != [$_rpl_server2:SELECT @@server_id AS i, i, 1] + + --source include/assert.inc + --dec $_rpl_server2 + } + --dec $_rpl_server + } +} + +# $rpl_master_list must be set so that include/rpl_change_topology.inc +# knows which servers are initialized and not. +--let $rpl_master_list= `SELECT REPEAT('x', $rpl_server_count * LENGTH($rpl_server_count))` +--source include/rpl_change_topology.inc + + +if (!$rpl_skip_start_slave) +{ + --source include/rpl_start_slaves.inc +} + + +--let $rpl_connection_name= server_1 +--source include/rpl_connection.inc + + +--let $skip_restore_connection= 1 +--let $include_filename= rpl_init.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_reconnect.inc b/mysql-test/include/rpl_reconnect.inc new file mode 100644 index 00000000000..cdbbd0a1bf1 --- /dev/null +++ b/mysql-test/include/rpl_reconnect.inc @@ -0,0 +1,132 @@ +# ==== Purpose ==== +# +# After a server has restarted, this waits for all clients configured +# by rpl_init.inc and/or master-slave.inc to reconnect again. +# +# For each connection, it issues this: +# --enable_reconnect +# --source include/wait_until_connected_again.inc +# --disable_reconnect +# +# +# ==== Usage ==== +# +# --let $rpl_server_number= N +# [--let $rpl_debug= 1] +# --source include/rpl_reconnect.inc +# +# Parameters: +# $rpl_server_number +# Number to identify the server that needs to reconnect. 1 is the +# master server, 2 the slave server, 3 the 3rd server, and so on. +# Cf. include/rpl_init.inc +# +# $rpl_debug +# See include/rpl_init.inc + +--let $include_filename= rpl_reconnect.inc +--source include/begin_include_file.inc + +if (!$rpl_server_number) +{ + --die ERROR IN TEST: you must set $rpl_server_number before you source rpl_connect.inc +} + + +if ($rpl_debug) +{ + --echo ---- Enable reconnect ---- +} + +--let $_rpl_server_number= $rpl_server_number + +--dec $_rpl_server_number +if (!$_rpl_server_number) +{ + --let $rpl_connection_name= default + --source include/rpl_connection.inc + --enable_reconnect + + --let $rpl_connection_name= master + --source include/rpl_connection.inc + --enable_reconnect + + --let $rpl_connection_name= master1 + --source include/rpl_connection.inc + --enable_reconnect +} + +--dec $_rpl_server_number +if (!$_rpl_server_number) +{ + --let $rpl_connection_name= slave + --source include/rpl_connection.inc + --enable_reconnect + + --let $rpl_connection_name= slave1 + --source include/rpl_connection.inc + --enable_reconnect +} + +--let $rpl_connection_name= server_$rpl_server_number +--source include/rpl_connection.inc +--enable_reconnect + +--let $_rpl_one= _1 +--let $rpl_connection_name= server_$rpl_server_number$_rpl_one +--source include/rpl_connection.inc +--enable_reconnect + +if ($rpl_debug) +{ + --echo ---- Wait for reconnect and disable reconnect on all connections ---- +} + +--let $_rpl_server_number= $rpl_server_number + +--dec $_rpl_server_number +if (!$_rpl_server_number) +{ + --let $rpl_connection_name= default + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect + + --let $rpl_connection_name= master + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect + + --let $rpl_connection_name= master1 + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect +} + +--dec $_rpl_server_number +if (!$_rpl_server_number) +{ + --let $rpl_connection_name= slave + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect + + --let $rpl_connection_name= slave1 + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect +} + +--let $rpl_connection_name= server_$rpl_server_number +--source include/rpl_connection.inc +--source include/wait_until_connected_again.inc +--disable_reconnect + +--let $rpl_connection_name= server_$rpl_server_number$_rpl_one +--source include/rpl_connection.inc +--source include/wait_until_connected_again.inc +--disable_reconnect + + +--let $include_filename= rpl_reconnect.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_reset.inc b/mysql-test/include/rpl_reset.inc new file mode 100644 index 00000000000..a94371c38fc --- /dev/null +++ b/mysql-test/include/rpl_reset.inc @@ -0,0 +1,81 @@ +# ==== Purpose ==== +# +# Reset all replication servers to a clean state: +# +# - sync all slaves, +# - stop all slaves (STOP SLAVE), +# - remove all binlogs and relay logs (RESET MASTER and RESET SLAVE), +# - start all slaves again (START SLAVE). +# +# It does not execute CHANGE MASTER, so the replication topology is +# kept intact. +# +# +# ==== Usage ==== +# +# [--let $rpl_only_running_threads= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/rpl_end.inc +# +# Parameters: +# $rpl_only_running_threads +# If one or both of the IO and SQL threads is stopped, sync and +# stop only the threads that are running. See +# include/rpl_sync.inc and include/stop_slave.inc for details. +# +# $rpl_debug +# See include/rpl_init.inc +# +# $slave_timeout +# Set the timeout when waiting for slave threads to stop and +# start, respectively. See include/wait_for_slave_param.inc +# +# Note: +# This script will fail if Last_SQL_Error or Last_IO_Error is +# nonempty. If you expect an error in the SQL thread, you should +# normally do this before you source include/rpl_reset.inc: +# +# --source include/wait_for_slave_sql_error.inc +# --source include/stop_slave_io.inc +# RESET SLAVE; + +--let $include_filename= rpl_reset.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +--source include/rpl_sync.inc + + +if ($rpl_debug) +{ + --echo ---- Stop and reset all servers ---- +} +--let $_rpl_server= $rpl_server_count +while ($_rpl_server) +{ + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + + # Check if this server is configured to have a master + if (`SELECT SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length) != ''`) + { + --source include/stop_slave.inc + RESET SLAVE; + } + RESET MASTER; + --dec $_rpl_server +} + + +--source include/rpl_start_slaves.inc + + +--let $include_filename= rpl_reset.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_restart_server.inc b/mysql-test/include/rpl_restart_server.inc new file mode 100644 index 00000000000..5df2c67d3da --- /dev/null +++ b/mysql-test/include/rpl_restart_server.inc @@ -0,0 +1,39 @@ +# ==== Purpose ==== +# +# Shut down and shut up the server given by $rpl_server_number. This +# is equivalent to rpl_stop_server.inc followed by rpl_start_server.inc +# +# ==== Usage ==== +# +# --let $rpl_server_number= N +# [--let $rpl_server_parameters= --flag1 --flag2 ...] +# [--let $rpl_debug= 1] +# --source include/rpl_restart_server.inc +# +# Parameters: +# +# $rpl_server_number, $rpl_server_parameters +# See include/rpl_start_server.inc +# +# $rpl_debug +# See include/rpl_init.inc +# +# ==== See also ==== +# +# rpl_start_server.inc +# rpl_stop_server.inc + + +--let $_rpl_restart_server_args= [server_number=$rpl_server_number] +if ($rpl_server_parameters) +{ + --let $_rpl_restart_server_args= [server_number=$rpl_server_number parameters: $rpl_server_parameters] +} +--let $include_filename= rpl_restart_server.inc $_rpl_restart_server_args +--source include/begin_include_file.inc + +--source include/rpl_stop_server.inc +--source include/rpl_start_server.inc + +--let $include_filename= rpl_restart_server.inc $_rpl_restart_server_args +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_start_server.inc b/mysql-test/include/rpl_start_server.inc new file mode 100644 index 00000000000..c59c7759910 --- /dev/null +++ b/mysql-test/include/rpl_start_server.inc @@ -0,0 +1,54 @@ +# ==== Purpose ==== +# +# Start the server given by $rpl_server_number. This should normally +# be invoked after rpl_stop_server.inc. +# +# ==== Usage ==== +# +# --let $rpl_server_number= N +# [--let $rpl_server_parameters= --flag1 --flag2 ...] +# [--let $rpl_debug= 1] +# --source include/rpl_start_server.inc +# +# Parameters: +# +# $rpl_server_number +# Number to identify the server that needs to reconnect. 1 is the +# master server, 2 the slave server, 3 the 3rd server, and so on. +# Cf. include/rpl_init.inc +# +# $rpl_server_parameters +# If set, extra parameters given by this variable are passed to +# mysqld. +# +# $rpl_debug +# See include/rpl_init.inc +# +# ==== See also ==== +# +# rpl_stop_server.inc +# rpl_restart_server.inc + + +--let $_rpl_start_server_command= restart +--let $_rpl_start_server_args= [server_number=$rpl_server_number] +if ($rpl_server_parameters) +{ + --let $_rpl_start_server_command= restart:$rpl_server_parameters + --let $_rpl_start_server_args= [server_number=$rpl_server_number parameters: $rpl_server_parameters] +} + +--let $include_filename= rpl_start_server.inc $_rpl_start_server_args +--source include/begin_include_file.inc + +--let $rpl_connection_name= server_$rpl_server_number +--source include/rpl_connection.inc + +# Write file to make mysql-test-run.pl start up the server again +--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect + +--source include/rpl_reconnect.inc + + +--let $include_filename= rpl_start_server.inc $_rpl_start_server_args +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_start_slaves.inc b/mysql-test/include/rpl_start_slaves.inc new file mode 100644 index 00000000000..fdd90eb12c5 --- /dev/null +++ b/mysql-test/include/rpl_start_slaves.inc @@ -0,0 +1,32 @@ +# ==== Purpose ==== +# +# Start all slaves configured by rpl_init.inc and wait for the slave +# threads to start. +# +# Note that rpl_init.inc calls this file automatically, so you only +# need to source this file if the slaves have stopped after that. +# +# +# ==== Usage ==== +# +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/rpl_start_slaves.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc +# +# $slave_timeout +# Set the timeout when waiting for slave threads to stop and +# start, respectively. See include/wait_for_slave_param.inc + + +--let $include_filename= rpl_start_slaves.inc +--source include/begin_include_file.inc + +--let $rpl_source_file= include/start_slave.inc +--source include/rpl_for_each_slave.inc + +--let $include_filename= rpl_start_slaves.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_stop_server.inc b/mysql-test/include/rpl_stop_server.inc new file mode 100644 index 00000000000..e1f8839dd69 --- /dev/null +++ b/mysql-test/include/rpl_stop_server.inc @@ -0,0 +1,63 @@ +# ==== Purpose ==== +# +# Stop the server given by $rpl_server_number. +# +# ==== Usage ==== +# +# --let $rpl_server_number= N +# [--let $rpl_debug= 1] +# --source include/rpl_stop_server.inc +# +# Parameters: +# +# $rpl_server_number +# Number to identify the server that needs to reconnect. 1 is the +# master server, 2 the slave server, 3 the 3rd server, and so on. +# Cf. include/rpl_init.inc +# +# $rpl_debug +# See include/rpl_init.inc +# +# ==== See also ==== +# +# rpl_start_server.inc +# rpl_restart_server.inc + + +# Can't use begin_include_file / end_include_file because they require +# executing on a server and the server will go down after this script. +if (!$_include_file_depth) +{ + --echo include/rpl_stop_server.inc [server_number=$rpl_server_number] +} +--inc $_include_file_depth +--let $_rpl_stop_server_old_connection= $CURRENT_CONNECTION +if ($rpl_debug) +{ + --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR' + --echo $_include_file_indent==== BEGIN include/$include_filename ==== +} + + +--let $rpl_connection_name= server_$rpl_server_number +--source include/rpl_connection.inc + +# Write file to make mysql-test-run.pl expect the "crash", but don't start +# it until it's told to +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect + +# Send shutdown to the connected server and give +# it 10 seconds to die before zapping it +shutdown_server 10; + +--source include/wait_until_disconnected.inc + + +--let $rpl_connection_name= $_rpl_stop_server_old_connection +--source include/rpl_connection.inc +--dec $_include_file_depth +if ($rpl_debug) +{ + --echo $_include_file_indent==== END include/rpl_stop_server.inc [server_number=$rpl_server_number] ==== + --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR' +} diff --git a/mysql-test/include/rpl_stop_slaves.inc b/mysql-test/include/rpl_stop_slaves.inc new file mode 100644 index 00000000000..2b9199739dd --- /dev/null +++ b/mysql-test/include/rpl_stop_slaves.inc @@ -0,0 +1,33 @@ +# ==== Purpose ==== +# +# Stop all slaves configured by rpl_init.inc and waits for the slave +# threads to stop. +# +# +# ==== Usage ==== +# +# [--let $rpl_only_running_threads= 1] +# [--let $rpl_debug= 1] +# [--let $rpl_timeout= NUMBER] +# --source include/rpl_stop_slaves.inc +# +# Parameters: +# $rpl_only_running_threads +# See include/stop_slave.inc +# +# $slave_timeout +# Set the timeout when waiting for slave threads to stop. See +# include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= rpl_stop_slaves.inc +--source include/begin_include_file.inc + +--let $rpl_source_file= include/stop_slave.inc +--source include/rpl_for_each_slave.inc + +--let $include_filename= rpl_stop_slaves.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_sync.inc b/mysql-test/include/rpl_sync.inc new file mode 100644 index 00000000000..a05bee23981 --- /dev/null +++ b/mysql-test/include/rpl_sync.inc @@ -0,0 +1,153 @@ +# ==== Purpose ==== +# +# Sync all servers in an arbitrary replication topology. This works +# only if the servers have been configured with rpl_init.inc (and +# possibly rpl_change_topology.inc). +# +# +# ==== Usage ==== +# +# [--let $rpl_only_running_threads= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/rpl_sync.inc +# +# Parameters: +# $rpl_only_running_threads +# By default, this script assumes that both the IO thread and the +# SQL thread are running and fails if one of them is stopped. If +# $rpl_only_running_threads is set, this script first checks +# which slave threads are running: +# - If both threads are running, sync both threads with master. +# - If only IO thread is running, sync IO thread with master. +# - If only SQL thread is running, sync SQL thread with IO thread. +# - If no thread is running, don't sync. +# +# $slave_timeout +# Set the timeout when waiting for threads to sync. See +# include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc +# +# +# ==== Side effects ==== +# +# Does not change the current connection (note that this is different +# from mysqltest's built-in sync_slave_with_master command). + + +--let $include_filename= rpl_sync.inc +--source include/begin_include_file.inc + + +# Compute $rpl_sync_chain if needed. We could have done this in +# rpl_change_topology.inc, but instead we do it here because that +# means we only compute $rpl_sync_chain when it is needed. +if ($rpl_sync_chain_dirty) +{ + --source include/rpl_generate_sync_chain.inc + --let $rpl_sync_chain_dirty= 0 +} + + +if ($rpl_debug) +{ + --echo \$rpl_sync_chain = '$rpl_sync_chain' \$rpl_only_running_threads= $rpl_only_running_threads +} + +if (!$rpl_server_count_length) +{ + --die \$rpl_server_count_length is not set. Did you call rpl_init.inc? +} + + +--let $_rpl_i= 1 +--let $_rpl_connect= 0 +while ($_rpl_i) { + # $rpl_sync_chain consists of a sequence of sync chains. Each sync + # chain has the form: + # + # <space><server1_1><server1_2>...<server1_N> + # + # So the space character indicates that a new sync chain starts. + --let $_rpl_server= `SELECT TRIM(SUBSTR('$rpl_sync_chain', 1 + ($_rpl_i - 1) * $rpl_server_count_length, $rpl_server_count_length))` + + if ($_rpl_server) + { + if ($rpl_debug) + { + --echo [sync server_$_rpl_prev_server -> server_$_rpl_server] + } + if ($rpl_only_running_threads) + { + --connection server_$_rpl_server + --let $_rpl_slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1) + --let $_rpl_slave_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1) + if ($rpl_debug) + { + --echo Sync IO: $_rpl_slave_io_running; Sync SQL: $_rpl_slave_sql_running + } + --let $_rpl_slave_io_running= `SELECT IF('$_rpl_slave_io_running' = 'Yes', 1, '')` + --let $_rpl_slave_sql_running= `SELECT IF('$_rpl_slave_sql_running' = 'Yes', 1, '')` + if ($_rpl_slave_io_running) + { + --connection server_$_rpl_prev_server + if ($_rpl_slave_sql_running) + { + if ($rpl_debug) + { + --let $_rpl_master_file= query_get_value("SHOW MASTER STATUS", File, 1) + --let $_rpl_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1) + --echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos' + } + --sync_slave_with_master server_$_rpl_server + } + if (!$_rpl_slave_sql_running) + { + --let $sync_slave_connection= server_$_rpl_server + --source include/sync_slave_io_with_master.inc + } + } + if (!$_rpl_slave_io_running) + { + if ($_rpl_slave_sql_running) + { + --source include/sync_slave_sql_with_io.inc + } + } + } + if (!$rpl_only_running_threads) + { + --connection server_$_rpl_prev_server + if ($rpl_debug) + { + --let $_rpl_master_file= query_get_value("SHOW MASTER STATUS", File, 1) + --let $_rpl_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1) + --echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos' + } + --sync_slave_with_master server_$_rpl_server + } + } + + # This happens at the beginning of a new sync subchain and at the + # end of the full sync chain. + if (!$_rpl_server) + { + --inc $_rpl_i + --let $_rpl_server= `SELECT TRIM(SUBSTR('$rpl_sync_chain', 1 + ($_rpl_i - 1) * $rpl_server_count_length, $rpl_server_count_length))` + + if (!$_rpl_server) + { + # terminate loop + --let $_rpl_i= -1 + } + } + + --let $_rpl_prev_server= $_rpl_server + --inc $_rpl_i +} + + +--let $include_filename= rpl_sync.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/save_master_pos.inc b/mysql-test/include/save_master_pos.inc new file mode 100644 index 00000000000..2c176d160cc --- /dev/null +++ b/mysql-test/include/save_master_pos.inc @@ -0,0 +1,33 @@ +# ==== Purpose ==== +# +# Save the current binlog position on the master, just like the +# built-in mysqltest command save_master_pos. The advantage of this +# script is that the saved position is available to the test script. +# +# +# ==== Usage ==== +# +# [--let $rpl_debug= 1] +# --source include/save_master_pos.inc +# +# Typically, you would use this script together with +# include/sync_io_with_master.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= save_master_pos.inc +--source include/begin_include_file.inc + +let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1); +let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1); + +if ($rpl_debug) +{ + --echo save_master_pos saved file='$_master_file', pos='$_master_pos' +} + +--let $include_filename= save_master_pos.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index f881f3bf4e8..6c47752aabd 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -29,11 +29,15 @@ # Creates a binlog file and a binlog index file, and sets # @@global.relay_log_purge=1. All this is restored when you call # cleanup_fake_relay_log.inc. -# -# Enables the query log. ---disable_query_log +--let $include_filename= setup_fake_relay_log.inc +--source include/begin_include_file.inc + +if (!$rpl_debug) +{ + --disable_query_log +} # Print message. let $_fake_relay_log_printable= `SELECT REPLACE('$fake_relay_log', '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`; @@ -46,22 +50,18 @@ if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) { --echo Error: Slave was running when test case sourced --echo include/setup_fake_replication.inc --echo Slave_IO_Running = $_io_running; Slave_SQL_Running = $_sql_running - --echo Printing some debug info: - SHOW SLAVE STATUS; - SHOW MASTER STATUS; - SHOW BINLOG EVENTS; - SHOW PROCESSLIST; + --source include/show_rpl_debug_info.inc + --die } # Read server variables. -let $MYSQLD_DATADIR= `SELECT @@datadir`; +let $_fake_datadir= `SELECT @@datadir`; let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1); if (!$_fake_filename) { - --echo Badly written test case: relay_log variable is empty. Please use the - --echo server option --relay-log=FILE. + --die ERROR IN TEST: relay_log variable is empty. Please use the server option --relay-log=FILE. } -let $_fake_relay_log= $MYSQLD_DATADIR/$_fake_filename-fake.000001; -let $_fake_relay_index= $MYSQLD_DATADIR/$_fake_filename.index; +let $_fake_relay_log= $_fake_datadir/$_fake_filename-fake.000001; +let $_fake_relay_index= $_fake_datadir/$_fake_filename.index; # Need to restore relay_log_purge in cleanup_fake_relay_log.inc, since # CHANGE MASTER modifies it (see the manual for CHANGE MASTER). let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; @@ -69,24 +69,16 @@ let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; # Create relay log file. copy_file $fake_relay_log $_fake_relay_log; # Create relay log index. +--let $write_var= $_fake_filename-fake.000001\n +--let $write_to_file= $_fake_relay_index +--source include/write_var_to_file.inc -if (`SELECT LENGTH(@@secure_file_priv) > 0`) -{ - -- let $_file_priv_dir= `SELECT @@secure_file_priv` - -- let $_suffix= `SELECT UUID()` - -- let $_tmp_file= $_file_priv_dir/fake-index.$_suffix - - -- eval select '$_fake_filename-fake.000001\n' into dumpfile '$_tmp_file' - -- copy_file $_tmp_file $_fake_relay_index - -- remove_file $_tmp_file -} - -if (`SELECT LENGTH(@@secure_file_priv) = 0`) -{ - -- eval select '$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index' -} +# Remember old settings. +--let $_fake_old_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1) # Setup replication from existing relay log. eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4; ---enable_query_log + +--let $include_filename= setup_fake_relay_log.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc index 9944e6cd25f..0faae59d8d3 100644 --- a/mysql-test/include/show_rpl_debug_info.inc +++ b/mysql-test/include/show_rpl_debug_info.inc @@ -3,87 +3,104 @@ # Print status information for replication, typically used to debug # test failures. # -# First, the following is printed on slave: +# The following is printed on the current connection: # +# SELECT NOW() # SHOW SLAVE STATUS +# SHOW MASTER STATUS # SHOW PROCESSLIST # SHOW BINLOG EVENTS IN <binlog_name> # # Where <binlog_name> is the currently active binlog. # -# Then, the following is printed on master: -# -# SHOW MASTER STATUS -# SHOW PROCESSLIST -# SHOW BINLOG EVENTS IN <sql_binlog_name> -# SHOW BINLOG EVENTS IN <io_binlog_name> +# Then, the same is printed from all connections configured by +# rpl_init.inc - i.e., on connection server_N, where +# 1 <= N <= $rpl_server_count # -# Where <sql_binlog_name> is the binlog name that the slave sql thread -# is currently reading from and <io_binlog_name> is the binlog that -# the slave IO thread is currently reading from. # # ==== Usage ==== # -# [let $master_connection= <connection>;] -# source include/show_rpl_debug_info.inc; +# [--let $rpl_only_current_connection= 1] +# --source include/show_rpl_debug_info.inc +# +# Parameters: +# $rpl_only_current_connection +# By default, debug info is printed from all connections, starting +# with the current connection. If this variable is set, debug +# info is printed only for the current connection. +# +# +# ==== Side effects ==== +# +# Turns on enable_query_log, enable_result_log, enable_warnings, +# horizontal_results, and enable_abort_on_error. # -# If $master_connection is set, debug info will be retrieved from the -# connection named $master_connection. Otherwise, it will be -# retrieved from the 'master' connection if the current connection is -# 'slave'. +# Prints non-deterministic output to the query log. This file should +# never be called in a test that does not fail. -let $_con= $CURRENT_CONNECTION; ---echo ---echo [on $_con] ---echo -SELECT NOW(); ---echo **** SHOW SLAVE STATUS on $_con **** -query_vertical SHOW SLAVE STATUS; ---echo ---echo **** SHOW PROCESSLIST on $_con **** -SHOW PROCESSLIST; ---echo ---echo **** SHOW BINLOG EVENTS on $_con **** -let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); -eval SHOW BINLOG EVENTS IN '$binlog_name'; -let $_master_con= $master_connection; -if (!$_master_con) +--enable_query_log +--enable_result_log +--enable_warnings +--disable_abort_on_error +--horizontal_results + + +--let $_rpl_old_con= $CURRENT_CONNECTION +--let $_rpl_is_first_server= 1 +--let $_rpl_server= $rpl_server_count +--inc $_rpl_server + + +while ($_rpl_server) { - if (`SELECT '$_con' = 'slave'`) - { - let $_master_con= master; - } - if (!$_master_con) + if (!$_rpl_is_first_server) { - --echo Unable to determine master connection. No debug info printed for master. - --echo Please fix the test case by setting $master_connection before sourcing - --echo show_rpl_debug_info.inc. + --connection server_$_rpl_server } -} - -if ($_master_con) -{ - let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1); - let $master_binlog_name_sql= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1); --echo - --echo [on $_master_con] - connection $_master_con; + --echo ############################## $CURRENT_CONNECTION ############################## + --echo + --echo **** SHOW WARNINGS on $CURRENT_CONNECTION **** + SHOW WARNINGS; + --echo + --echo **** SELECT replication-related variables on $CURRENT_CONNECTION **** + SELECT NOW(), @@SERVER_ID; + --echo + --echo **** SHOW SLAVE STATUS on $CURRENT_CONNECTION **** + query_vertical SHOW SLAVE STATUS; --echo - SELECT NOW(); - --echo **** SHOW MASTER STATUS on $_master_con **** + --echo **** SHOW MASTER STATUS on $CURRENT_CONNECTION **** query_vertical SHOW MASTER STATUS; --echo - --echo **** SHOW PROCESSLIST on $_master_con **** + --echo **** SHOW SLAVE HOSTS on $CURRENT_CONNECTION **** + query_vertical SHOW SLAVE HOSTS; + --echo + --echo **** SHOW PROCESSLIST on $CURRENT_CONNECTION **** SHOW PROCESSLIST; --echo - --echo **** SHOW BINLOG EVENTS on $_master_con **** - eval SHOW BINLOG EVENTS IN '$master_binlog_name_sql'; - if (`SELECT '$master_binlog_name_io' != '$master_binlog_name_sql'`) + --echo **** SHOW BINARY LOGS on $CURRENT_CONNECTION **** + SHOW BINARY LOGS; + --echo + --echo **** SHOW BINLOG EVENTS on $CURRENT_CONNECTION **** + let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); + --echo binlog_name = '$binlog_name' + eval SHOW BINLOG EVENTS IN '$binlog_name'; + + + --let $_rpl_is_first_server= 0 + --dec $_rpl_server + # Don't use same connection twice. + if (`SELECT 'server_$_rpl_server' = '$_rpl_old_con'`) { - eval SHOW BINLOG EVENTS IN '$master_binlog_name_io'; + --dec $_rpl_server + if ($rpl_only_current_connection) + { + --let $_rpl_server= 0 + } } - - connection $_con; } + +--connection $_rpl_old_con +--enable_abort_on_error diff --git a/mysql-test/include/show_slave_status.inc b/mysql-test/include/show_slave_status.inc index d66c068e19b..779de5a37f5 100644 --- a/mysql-test/include/show_slave_status.inc +++ b/mysql-test/include/show_slave_status.inc @@ -1,25 +1,75 @@ -# Include file to show the slave status, masking out some information -# that varies depending on where the test is executed. +# ==== Purpose ==== +# +# Show selected columns of output from SHOW SLAVE STATUS. +# +# Note: test cases should never call SHOW SLAVE STATUS directly, +# because that outputs more information to the query log than what is +# needed for the property that is being tested. That would cause +# maintenance problems, because (1) it is hard for a human to +# understand what property is being tested; (2) the output of many of +# the fields is non-deterministic (e.g., Slave_IO_State) or changes +# frequently (e.g., binlog positions). +# +# Instead, what you want most of the time is to source one of the +# following scripts: +# +# include/check_slave_no_error.inc +# Assert that Slave_SQL_Errno = Slave_IO_Errno = 0. +# +# include/check_slave_is_running.inc +# Assert that Slave_IO_Running = Slave_SQL_Running = 'Yes'. +# +# include/wait_for_slave_sql_error.inc +# Wait for the SQL thread to get a given error (and assert that +# it has this error). +# +# include/wait_for_slave_io_error.inc +# Wait for the IO thread to get a given error (and assert that +# it has this error). +# +# include/wait_for_slave_sql_to_stop.inc +# include/wait_for_slave_io_to_stop.inc +# include/wait_for_slave_to_stop.inc +# Wait for the SQL thread, the IO thread, or both to stop (and +# assert they stop). +# +# When none of the above applies, you may use this script instead. +# However, take care so that the test never contains explicit binlog +# coordinates. Usually you can read the binlog coordinates into a +# variable and compare it to some other coordinates. +# +# +# ==== Usage ==== +# +# --let $status_items= Column_Name[, Column_Name[, ...]] +# --source include/show_slave_status.inc +# +# Parameters: +# $status_items +# Set to the name of the column in the output of SHOW SLAVE STATUS +# that you want to display. Example: +# +# --let $status_items= Master_SSL_Allowed +# +# You can show multiple columns by setting $status_items to a +# comma-separated list. Example: +# +# --let $status_items= Master_Log_File, Relay_Master_Log_File ---let $_items=$status_items + +--let $_show_slave_status_items=$status_items if (`SELECT "XX$status_items" = "XX"`) { - --die 'Variable status_items is NULL' + --die Bug in test case: The mysqltest variable $status_items is not set. } ---disable_query_log ---vertical_results -while (`SELECT "XX$_items" <> "XX"`) +while (`SELECT "XX$_show_slave_status_items" <> "XX"`) { - --let $_name= `SELECT SUBSTRING_INDEX('$_items', ',', 1)` - --let $_items= `SELECT LTRIM(SUBSTRING('$_items', LENGTH('$_name') + 2))` - - --let $_value= query_get_value(SHOW SLAVE STATUS, $_name, 1) + --let $_show_slave_status_name= `SELECT SUBSTRING_INDEX('$_show_slave_status_items', ',', 1)` + --let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))` - --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR - --eval SELECT "$_value" AS $_name + --let $_show_slave_status_value= query_get_value(SHOW SLAVE STATUS, $_show_slave_status_name, 1) + --let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')` + --echo $_show_slave_status_name = '$_show_slave_status_value' } - ---horizontal_results ---enable_query_log diff --git a/mysql-test/include/start_slave.inc b/mysql-test/include/start_slave.inc index 78a02736de8..d01978037b4 100644 --- a/mysql-test/include/start_slave.inc +++ b/mysql-test/include/start_slave.inc @@ -6,16 +6,34 @@ # Please use this instead of 'START SLAVE', to reduce the risk of test # case bugs. # +# # ==== Usage ==== # -# source include/wait_for_slave_to_start.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/start_slave.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= start_slave.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + ---disable_query_log START SLAVE; ---enable_query_log ---echo include/start_slave.inc source include/wait_for_slave_to_start.inc; + + +--let $include_filename= start_slave.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/stop_slave.inc b/mysql-test/include/stop_slave.inc index 7161e6fe739..64cc0d5b322 100644 --- a/mysql-test/include/stop_slave.inc +++ b/mysql-test/include/stop_slave.inc @@ -3,19 +3,86 @@ # Issues STOP SLAVE on the current connection. Then waits until both # the IO and SQL threads have stopped, or until a timeout is reached. # -# Please use this instead of 'STOP SLAVE', to reduce the risk of test -# case bugs. +# Please use this instead of 'STOP SLAVE', to reduce the risk of races +# in test cases. +# +# This will fail if the slave IO or SQL thread has an error. If you +# expect an error in the IO thread, use +# include/wait_for_slave_io_error.inc and include/stop_slave_sql.inc. +# # # ==== Usage ==== # -# source include/wait_for_slave_to_start.inc; +# [--let $rpl_only_running_threads= 1] +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/stop_slave.inc +# +# Parameters: +# $rpl_only_running_threads +# By default, this script executes STOP SLAVE unconditionally. +# This generates a warnings if one or both slave threads are +# already stopped. If $rpl_only_running_threads is set, this +# script checks which slave threads are running, and issues either +# STOP SLAVE, STOP SLAVE SQL_THREAD, STOP SLAVE IO_THREAD, or +# nothing. # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= stop_slave.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +if ($rpl_only_running_threads) +{ + --let $_slave_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1) + --let $_slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1) + if ($rpl_debug) + { + --echo Stop SQL: $_slave_sql_running; Stop IO: $_slave_io_running + } + + --let $_slave_running_bits= `SELECT IF('$_slave_io_running' = 'Yes', 1, 0) + IF('$_slave_sql_running' = 'Yes', 2, 0)` + if ($_slave_running_bits) + { + --dec $_slave_running_bits + # $_slave_running_bits=1: io thread running + if (!$_slave_running_bits) + { + --source include/stop_slave_io.inc + } + --dec $_slave_running_bits + # $_slave_running_bits=2: sql thread running + if (!$_slave_running_bits) + { + --source include/stop_slave_sql.inc + } + --dec $_slave_running_bits + # $_slave_running_bits=2: both threads running + if (!$_slave_running_bits) + { + STOP SLAVE; + --source include/wait_for_slave_to_stop.inc + } + } +} +if (!$rpl_only_running_threads) +{ + STOP SLAVE; + --source include/wait_for_slave_to_stop.inc +} + ---disable_query_log -STOP SLAVE; ---enable_query_log ---echo include/stop_slave.inc -source include/wait_for_slave_to_stop.inc; +--let $include_filename= stop_slave.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/stop_slave_io.inc b/mysql-test/include/stop_slave_io.inc new file mode 100644 index 00000000000..ddc83782311 --- /dev/null +++ b/mysql-test/include/stop_slave_io.inc @@ -0,0 +1,43 @@ +# ==== Purpose ==== +# +# Issues STOP SLAVE IO_THREAD on the current connection. Then waits +# until the IO thread has stopped, or until a timeout is reached. +# +# This will fail if the slave IO thread has an error. If you expect an +# error in the IO thread, use include/wait_for_slave_io_error.inc +# instead. +# +# Please use this instead of 'STOP SLAVE IO_THREAD', to reduce the +# risk of races in test cases. +# +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/stop_slave_io.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= stop_slave_io.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +STOP SLAVE IO_THREAD; +--source include/wait_for_slave_io_to_stop.inc + + +--let $include_filename= stop_slave_io.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/stop_slave_sql.inc b/mysql-test/include/stop_slave_sql.inc new file mode 100644 index 00000000000..f5075b32fda --- /dev/null +++ b/mysql-test/include/stop_slave_sql.inc @@ -0,0 +1,41 @@ +# ==== Purpose ==== +# +# Issues STOP SLAVE SQL_THREAD on the current connection. Then waits +# until the SQL thread has stopped, or until a timeout is reached. +# +# Please use this instead of 'STOP SLAVE SQL_THREAD', to reduce the +# risk of races in test cases. +# +# This will fail if the SQL thread has an error. +# +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/stop_slave_sql.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= stop_slave_sql.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +STOP SLAVE SQL_THREAD; +--source include/wait_for_slave_sql_to_stop.inc + + +--let $include_filename= stop_slave_sql.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/sync_io_with_master.inc b/mysql-test/include/sync_io_with_master.inc new file mode 100644 index 00000000000..34906c416f5 --- /dev/null +++ b/mysql-test/include/sync_io_with_master.inc @@ -0,0 +1,46 @@ +# ==== Purpose ==== +# +# Waits until the slave IO thread on the current connection has been +# synced up to the point saved by the last call to +# include/save_master_pos.inc (i.e., until the IO thead has copied up +# to the saved position). Does not wait for the SQL thread. +# +# +# ==== Usage ==== +# +# On master: +# --source include/save_master_pos.inc +# +# On slave: +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/sync_slave_io_with_master.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= sync_io_with_master.inc +--source include/begin_include_file.inc + + +--let $_old_slave_error_param= $slave_error_param +--let $slave_error_param= Last_IO_Errno + +--let $slave_param= Master_Log_File +--let $slave_param_value= $_master_file +source include/wait_for_slave_param.inc; + +let $slave_param= Read_Master_Log_Pos; +let $slave_param_value= $_master_pos; +source include/wait_for_slave_param.inc; + +--let $slave_error_param= $_old_slave_error_param + + +--let $include_filename= sync_io_with_master.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/sync_slave_io_with_master.inc b/mysql-test/include/sync_slave_io_with_master.inc index f7dd563039c..b1b81371c97 100644 --- a/mysql-test/include/sync_slave_io_with_master.inc +++ b/mysql-test/include/sync_slave_io_with_master.inc @@ -2,35 +2,49 @@ # # Waits until the slave IO thread has been synced, i.e., all events # have been copied over to slave. Does not care if the SQL thread is -# in sync. +# in sync (or even running). # # # ==== Usage ==== # -# source include/sync_slave_io_with_master.inc; +# [--let $sync_slave_connection= <connection_name>] +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/sync_slave_io_with_master.inc # -# Syncs to the current position on master, as found by SHOW MASTER -# STATUS. +# Syncs slave to the current position on master, as found by SHOW +# MASTER STATUS. # # Must be called on the master. Will change connection to the slave. # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $sync_slave_connection +# By default, this script switches connection to 'slave'. If +# $sync_slave_connection is set, then '$sync_slave_connection' is +# used instead of 'slave'. +# +# $slave_timeout +# See include/wait_for_slave_param.inc. +# +# $rpl_debug +# See include/rpl_init.inc + +--let $include_filename= sync_slave_io_with_master.inc +--source include/begin_include_file.inc -let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1); -let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1); -connection slave; +--source include/save_master_pos.inc -let $slave_error_message= Failed while waiting for slave IO thread to sync; +--let $rpl_connection_name= slave +if (`SELECT '$sync_slave_connection' != ''`) +{ + --let $rpl_connection_name= $sync_slave_connection +} +--source include/rpl_connection.inc -let $slave_param= Master_Log_File; -let $slave_param_value= $_master_file; -source include/wait_for_slave_param.inc; +--source include/sync_io_with_master.inc -let $slave_param= Read_Master_Log_Pos; -let $slave_param_value= $_master_pos; -source include/wait_for_slave_param.inc; -let $slave_error_message= ; +--let $include_filename= sync_slave_io_with_master.inc +--let $skip_restore_connection= 1 +--source include/end_include_file.inc diff --git a/mysql-test/include/sync_slave_sql_with_io.inc b/mysql-test/include/sync_slave_sql_with_io.inc new file mode 100644 index 00000000000..8048f7a177c --- /dev/null +++ b/mysql-test/include/sync_slave_sql_with_io.inc @@ -0,0 +1,50 @@ +# ==== Purpose ==== +# +# Sync the slave SQL thread with the IO thread. +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/sync_slave_sql_with_io.inc +# +# Parameters: +# $slave_timeout +# By default, the synchronization timeouts after 300 seconds. If +# $slave_timeout is set, the synchronization timeouts after +# $slave_timeout seconds. +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= sync_slave_sql_with_io.inc +--source include/begin_include_file.inc + + +let $_slave_timeout= $slave_timeout; +if (!$_slave_timeout) +{ + let $_slave_timeout= 300; +} + +--let $_master_log_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1) +--let $_master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1) + +if ($rpl_debug) +{ + --echo Master_Log_File='$_master_log_file' Read_Master_Log_Pos='$_master_log_pos' \$slave_timeout='$_slave_timeout' +} + +--let $_sync_slave_sql_with_io_errno= `SELECT MASTER_POS_WAIT('$_master_log_file', $_master_log_pos, $_slave_timeout)` +if (`SELECT IFNULL($_sync_slave_sql_with_io_errno, -1) < 0`) +{ + --echo #### Failed to sync slave SQL thread with slave IO thread. #### + --echo MASTER_POS_WAIT('$_master_log_file', $_master_log_pos, $_slave_timeout) returned $_sync_slave_sql_with_io_errno + --source include/show_rpl_debug_info.inc + --die Failed to sync slave SQL thread with slave IO thread. +} + + +--let $include_filename= sync_slave_sql_with_io.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_query_to_fail.inc b/mysql-test/include/wait_for_query_to_fail.inc new file mode 100644 index 00000000000..471813026ee --- /dev/null +++ b/mysql-test/include/wait_for_query_to_fail.inc @@ -0,0 +1,25 @@ +# +# Run a query over and over until it fails or timeout occurs +# + + +let $counter= 100; + +disable_abort_on_error; +disable_query_log; +disable_result_log; +eval $query; +while (!$mysql_errno) +{ + eval $query; + sleep 0.1; + dec $counter; + + if (!$counter) + { + --die "Waited too long for query to fail"; + } +} +enable_abort_on_error; +enable_query_log; +enable_result_log; diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc index ffdcf752873..bd3468eebb6 100644 --- a/mysql-test/include/wait_for_slave_io_error.inc +++ b/mysql-test/include/wait_for_slave_io_error.inc @@ -4,56 +4,86 @@ # error, or until a timeout is reached. Also waits until the IO # thread has completely stopped. # -# ==== Usage ==== # -# # Wait several errors. -# let $slave_io_errno= 1, 2, 3; -# source include/wait_for_slave_io_error.inc; +# ==== Usage ==== # -# # Print error message -# let $slave_io_errno= 1; -# let $show_slave_io_error= 1; -# source include/wait_for_slave_io_error.inc; +# --let $slave_io_errno= NUMBER [, NUMBER ...] +# [--let $show_slave_io_error= 1] +# [--let $slave_io_error_is_nonfatal= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/wait_for_slave_io_error.inc # # Parameters: +# $slave_io_errno +# The expected IO error numbers. This can be either a single +# number, or a comma-separated list of numbers. Examples: +# --let $slave_io_errno= 1040, 1053, 2002, 2003, 2006, 2013 +# --let $slave_io_errno= 1045 +# (After BUG#41956 has been fixed, this will be required to be +# symbolic names instead of numbers.) # -# $slave_io_errno -# The expected IO error numbers. This is required. -# (After BUG#41956 has been fixed, this will be required to be a -# symbolic name instead of a numbers.) +# $show_slave_io_error +# If set, will print the error to the query log. # -# $show_slave_io_error -# If set, will print the error to the query log. +# $slave_io_error_is_nonfatal +# By default, we wait for the slave IO thread to stop completely +# (i.e., until Slave_IO_State is empty). If this variable is set, +# then we don't wait. This is useful if the error is non-fatal +# (e.g., temporary connection error) and does not cause the slave +# IO thread to stop. # -# $slave_timeout -# See wait_for_slave_param.inc for description. +# $slave_timeout +# See include/wait_for_slave_param.inc # -# $master_connection -# See wait_for_slave_param.inc for description. +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_io_error.inc [errno=$slave_io_errno] +--source include/begin_include_file.inc -if (!$slave_io_errno) { - --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc -} let $old_slave_param_comparison= $slave_param_comparison; let $slave_param= Last_IO_Errno; let $slave_param_comparison= !=; let $slave_param_value= 0; -let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread; source include/wait_for_slave_param.inc; -let $slave_error_message= ; let $slave_param_comparison= $old_slave_param_comparison; -let $_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); -if (`SELECT $_error NOT IN ($slave_io_errno)`) { - --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) **** +let $_wfsie_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); + +if (!$slave_io_errno) { + --echo !!!ERROR IN TEST: you must set \$slave_io_errno before you source + --echo !!!wait_for_slave_sql_error.inc. The error we got this time was '$_wfsie_errno', + --echo !!!so you probably want to add the following line to your test case: + --echo !!! --let \$slave_io_errno= $_wfsie_errno + --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc +} + +if (`SELECT $_wfsie_errno NOT IN ($slave_io_errno)`) { + --echo **** Slave stopped with wrong error code: $_wfsie_errno (expected $slave_io_errno) **** source include/show_rpl_debug_info.inc; - --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) **** + --echo **** Slave stopped with wrong error code: $_wfsie_errno (expected $slave_io_errno) **** --die Slave stopped with wrong error code } if ($show_slave_io_error) { - let $error= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1); - echo Last_IO_Error = $error; + --let $_wait_for_slave_io_error_old_status_items= $status_items + --let $status_items= Last_IO_Error + --source include/show_slave_status.inc + --let $status_items= $_wait_for_slave_io_error_old_status_items +} + +if (!$slave_io_error_is_nonfatal) +{ + --let $slave_param= Slave_IO_State + --let $slave_param_value= + --source include/wait_for_slave_param.inc } +--let $slave_io_error_is_nonfatal= 0 + + +--let $include_filename= wait_for_slave_io_error.inc [errno=$slave_io_errno] +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_io_to_start.inc b/mysql-test/include/wait_for_slave_io_to_start.inc index abdc8339290..ab2ccb45007 100644 --- a/mysql-test/include/wait_for_slave_io_to_start.inc +++ b/mysql-test/include/wait_for_slave_io_to_start.inc @@ -4,16 +4,31 @@ # connected to the master (i.e., until SHOW SLAVE STATUS returns Yes # in the Slave_IO_Running field), or until a timeout is reached. # +# # ==== Usage ==== # -# source include/wait_for_slave_io_to_start.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_io_to_start.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_io_to_start.inc +--source include/begin_include_file.inc + let $slave_param= Slave_IO_Running; let $slave_param_value= Yes; -let $slave_error_message= Failed while waiting for slave IO thread to start; +--let $slave_error_param= Last_IO_Errno source include/wait_for_slave_param.inc; -let $slave_error_message= ; +--let $slave_error_param= + + +--let $include_filename= wait_for_slave_io_to_start.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_io_to_stop.inc b/mysql-test/include/wait_for_slave_io_to_stop.inc index f61b0db1ed7..d25c2ac071d 100644 --- a/mysql-test/include/wait_for_slave_io_to_stop.inc +++ b/mysql-test/include/wait_for_slave_io_to_stop.inc @@ -1,24 +1,40 @@ # ==== Purpose ==== # -# Waits until the IO thread of the current connection has stopped, or -# until a timeout is reached. +# Waits until the IO thread of the current connection has stopped +# gracefully. +# +# Note: this script will fail if the IO thread stops with an error. +# If you expect an error in the IO thread, use +# include/wait_for_slave_io_error.inc instead. +# +# This script also fails if a timeout is reached (default 300 +# seconds). +# # # ==== Usage ==== # -# source include/wait_for_slave_io_to_stop.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_io_to_stop.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc. +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_io_to_stop.inc +--source include/begin_include_file.inc + + +--let $slave_param= Slave_IO_Running +--let $slave_param_value= No +--let $slave_error_param= Last_IO_Errno +--source include/wait_for_slave_param.inc +--let $slave_error_param= + -# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE -# STATUS will return an empty set. -let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); -if (`SELECT '$_slave_io_running' != 'No such row'`) -{ - let $slave_param= Slave_IO_Running; - let $slave_param_value= No; - let $slave_error_message= Failed while waiting for slave IO thread to stop; - source include/wait_for_slave_param.inc; - let $slave_error_message= ; -} +--let $include_filename= wait_for_slave_io_to_stop.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index 98cd426fa11..c9660b0679d 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -3,11 +3,16 @@ # Waits until SHOW SLAVE STATUS has returned a specified value, or # until a timeout is reached. # +# # ==== Usage ==== # -# let $slave_param= Slave_SQL_Running; -# let $slave_param_value= No; -# source include/slave_wait_param.inc; +# --let $slave_param= Slave_SQL_Running +# --let $slave_param_value= No +# [--let $slave_param_comparison= [ < | <= | >= | > | = | != ]] +# [--let $slave_timeout= NUMBER] +# [--let $slave_error_param= [Slave_SQL_Errno | Slave_IO_Errno]] +# [--let $rpl_debug= 1] +# --source include/slave_wait_param.inc # # Parameters: # @@ -21,33 +26,35 @@ # $slave_param_value. If you want to wait until $slave_param # becomes *unequal* to $slave_param_value, set this parameter to the # string '!=', like this: -# let $slave_param_comparison= !=; +# --let $slave_param_comparison= != # # $slave_timeout # The default timeout is 5 minutes. You can change the timeout by -# setting $slave_timeout. The unit is tenths of seconds. +# setting $slave_timeout. The unit is seconds. # -# $master_connection -# If the timeout is reached, debug info is given by calling SHOW -# SLAVE STATUS, SHOW PROCESSLIST, and SHOW BINLOG EVENTS. Then, a -# 'connection master' is then issued, and more debug info is given -# by calling SHOW MASTER STATUS, SHOW PROCESSLIST, and SHOW BINLOG -# EVENTS. If $master_connection is set, the latter three commands -# will be issued on $master_connection instead of on the host named -# 'master'. See also show_rpl_debug_info.inc +# $slave_error_param +# If set, this script will check if the column of the output from +# SHOW SLAVE STATUS named $slave_error_param is nonzero. If it is, +# this script will faile immediately. Typically, this should be set +# to Last_IO_Errno or Last_SQL_Errno. # -# $slave_error_message -# If set, this is printed when a timeout occurs. This is primarily -# intended to be used by other wait_for_slave_* macros, to indicate -# what the purpose of the wait was. (A very similar error message is -# given by default, but the wait_for_slave_* macros use this to give -# an error message identical to that in previous versions, so that -# errors are easier searchable in the pushbuild history.) +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_param.inc [$slave_param] +--source include/begin_include_file.inc + + +let $_slave_timeout= $slave_timeout; +if (!$_slave_timeout) +{ + let $_slave_timeout= 300; +} -let $_slave_timeout_counter= $slave_timeout; -if (!$_slave_timeout_counter) +if (`SELECT '$slave_error_param' = ''`) { - let $_slave_timeout_counter= 3000; + --let $slave_error_param= 1 } let $_slave_param_comparison= $slave_param_comparison; @@ -56,27 +63,57 @@ if (!$_slave_param_comparison) let $_slave_param_comparison= =; } -let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); -while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_param_value') AND $_slave_timeout_counter > 0`) +if ($rpl_debug) { - dec $_slave_timeout_counter; - if ($_slave_timeout_counter) - { - sleep 0.1; - let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); - } + --echo Waiting until '$slave_param' $_slave_param_comparison '$slave_param_value' [timeout='$_slave_timeout', \$slave_error_param='$slave_error_param'] +} + +--let $_slave_check_configured= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1) + +if (`SELECT '$_slave_check_configured' = 'No such row'`) +{ + --echo **** ERROR: SHOW SLAVE STATUS returned empty result set. Slave not configured. **** + --source include/show_rpl_debug_info.inc + --die SHOW SLAVE STATUS returned empty result set. Slave not configured. } -# This has to be outside the loop until BUG#41913 has been fixed -if (!$_slave_timeout_counter) +# mysqltest doesn't provide any better way to multiply by 10 +--let $_wait_for_slave_param_zero= 0 +--let $_slave_timeout_counter= $_slave_timeout$zero +--let $_slave_continue= 1 +while ($_slave_continue) { - --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** - if ($slave_error_message) + --let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1) + + # Check if an error condition is reached. + if (!$slave_error_param) + { + --let $_show_slave_status_error_value= query_get_value("SHOW SLAVE STATUS", $slave_error_param, 1) + if ($_show_slave_status_error_value) + { + --echo **** ERROR: $slave_error_param = '$_show_slave_status_error_value' while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** + --source include/show_rpl_debug_info.inc + --die Error condition reached in include/wait_for_slave_param.inc + } + } + + # Check if the termination condition is reached. + --let $_slave_continue= `SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_param_value')` + + # Decrease timer, and check if the timeout is reached. + if ($_slave_continue) { - --echo Message: $slave_error_message + --dec $_slave_timeout_counter + if (!$_slave_timeout_counter) + { + --echo **** ERROR: timeout after $_slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** + --source include/show_rpl_debug_info.inc + --die Timeout in include/wait_for_slave_param.inc + } + --sleep 0.1 } - --echo Current connection is '$CURRENT_CONNECTION' - echo Note: the following output may have changed since the failure was detected; - source include/show_rpl_debug_info.inc; - die; } + + +--let $include_filename= wait_for_slave_param.inc [$slave_param] +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc index 80836f908c6..80c532d6a20 100644 --- a/mysql-test/include/wait_for_slave_sql_error.inc +++ b/mysql-test/include/wait_for_slave_sql_error.inc @@ -6,43 +6,65 @@ # # ==== Usage ==== # -# source include/wait_for_slave_sql_error.inc; +# --let $slave_sql_errno= NUMBER +# [--let $show_slave_sql_error= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/wait_for_slave_sql_error.inc # # Parameters: +# $slave_sql_errno +# The expected SQL error number. This is required. +# (After BUG#41956 has been fixed, this will be required to be a +# symbolic name instead of a number.) # -# $slave_sql_errno -# The expected SQL error number. This is required. -# (After BUG#41956 has been fixed, this will be required to be a -# symbolic name instead of a number.) -# -# $show_slave_sql_error -# If set, will print the error to the query log. +# $show_slave_sql_error +# If set, will print the error to the query log. # -# $slave_timeout -# See wait_for_slave_param.inc for description. +# $slave_timeout +# See include/wait_for_slave_param.inc # -# $master_connection -# See wait_for_slave_param.inc for description. +# $rpl_debug +# See include/rpl_init.inc -if (!$slave_sql_errno) { - --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc -} +--let $include_filename= wait_for_slave_sql_error.inc [errno=$slave_sql_errno] +--source include/begin_include_file.inc + + +# Note: here, we should not wait for Slave_SQL_Errno!=0. +# Slave_SQL_Errno and Slave_SQL_Running are not set atomically. +# Slave_SQL_Errno is set first, then Slave_SQL_Running. So we wait +# until Slave_SQL_Running=No to be sure that both conditions hold. let $slave_param= Slave_SQL_Running; let $slave_param_value= No; -let $slave_error_message= Failed while waiting for slave to stop the SQL thread (expecting error in the SQL thread); source include/wait_for_slave_param.inc; -let $_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); -if (`SELECT '$_error' != '$slave_sql_errno'`) { - --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) **** +let $_wfsse_errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); + +if (!$slave_sql_errno) { + --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before you source + --echo !!!wait_for_slave_sql_error.inc. The error we got this time was '$_wfsse_errno', + --echo !!!so you probably want to add the following line to your test case: + --echo !!! --let \$slave_sql_errno= $_wfsse_errno + --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc +} + +if (`SELECT $_wfsse_errno NOT IN ($slave_sql_errno)`) { + --echo **** Slave stopped with wrong error code: $_wfsse_errno (expected $slave_sql_errno) **** source include/show_rpl_debug_info.inc; - --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) **** + --echo **** Slave stopped with wrong error code: $_wfsse_errno (expected $slave_sql_errno) **** --die Slave stopped with wrong error code } if ($show_slave_sql_error) { - let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); - echo Last_SQL_Error = $error; + --let $_wait_for_slave_sql_error_old_status_items= $status_items + --let $status_items= Last_SQL_Error + --source include/show_slave_status.inc + --let $status_items= $_wait_for_slave_sql_error_old_status_items } + + +--let $include_filename= wait_for_slave_sql_error.inc [errno=$slave_sql_errno] +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc index 11c02c0b490..9246c1839af 100644 --- a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc +++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc @@ -5,38 +5,58 @@ # # ==== Usage ==== # -# let $slave_sql_error= <ERRNO>; -# source include/wait_for_slave_sql_error_and_skip.inc; +# --let $slave_sql_error= NUMBER +# [--let $show_sql_error= 1] +# [--let $slave_skip_counter= 1] +# [--let $not_switch_connection= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/wait_for_slave_sql_error_and_skip.inc # # Parameters: # -# $slave_sql_errno -# The error number to wait for. This is required. (See -# wait_for_slave_sql_error.inc) +# $slave_sql_errno +# The error number to wait for. This is required. (See +# wait_for_slave_sql_error.inc) # -# $show_sql_error -# If set, will print the error to the query log. -# -# $slave_timeout -# See wait_for_slave_param.inc for description. +# $show_sql_error +# If set, will print the error to the query log. # -# $master_connection -# See wait_for_slave_param.inc for description. +# $slave_skip_counter +# If set, skip this number of events. If not set, skip one event. # -# $slave_skip_counter -# If set, skip this number of events. If not set, skip one event. +# $not_switch_connection +# By default, this script executes on the connection 'slave'. If +# $not_switch_connection is set, this script executes on the current +# connection. In any case, the original connection is restored. # -# $not_switch_connection If set, don't switch to slave and don't switch back -# master. +# $slave_timeout +# See include/wait_for_slave_param.inc # +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_sql_error_and_skip.inc [errno=$slave_sql_errno] +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + -echo --source include/wait_for_slave_sql_error_and_skip.inc; if (!$not_switch_connection) { - connection slave; + --let $rpl_connection_name= slave + --source include/rpl_connection.inc } + + source include/wait_for_slave_sql_error.inc; + # skip the erroneous statement if ($slave_skip_counter) { eval SET GLOBAL SQL_SLAVE_SKIP_COUNTER= $slave_skip_counter; @@ -45,7 +65,7 @@ if (!$slave_skip_counter) { SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; } source include/start_slave.inc; -if (!$not_switch_connection) -{ - connection master; -} + + +--let $include_filename= wait_for_slave_sql_error_and_skip.inc [errno=$slave_sql_errno] +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_sql_to_start.inc b/mysql-test/include/wait_for_slave_sql_to_start.inc index 48744f5dd13..4aea9fba569 100644 --- a/mysql-test/include/wait_for_slave_sql_to_start.inc +++ b/mysql-test/include/wait_for_slave_sql_to_start.inc @@ -5,13 +5,33 @@ # # ==== Usage ==== # -# source include/wait_for_slave_sql_to_start.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_sql_to_start.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_sql_to_start.inc +--source include/begin_include_file.inc + let $slave_param= Slave_SQL_Running; let $slave_param_value= Yes; -let $slave_error_message= Failed while waiting for slave SQL to start; + +# Unfortunately, the slave sql thread sets Slave_SQL_Running=Yes +# *before* it clears Last_SQL_Errno. So we have to allow errors in +# the SQL thread here. + +#--let $slave_error_param= Last_SQL_Errno source include/wait_for_slave_param.inc; +#--let $slave_error_param= + + +--let $include_filename= wait_for_slave_sql_to_start.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-test/include/wait_for_slave_sql_to_stop.inc index 6992613b646..492b3237be5 100644 --- a/mysql-test/include/wait_for_slave_sql_to_stop.inc +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -1,24 +1,40 @@ # ==== Purpose ==== # -# Waits the SQL thread of the current connection has stopped, or until -# a timeout is reached. +# Waits until the SQL thread of the current connection has stopped +# gracefully. +# +# Note: this script will fail if the SQL thread stops with an error. +# If you expect an error in the SQL thread, use +# include/wait_for_slave_io_error.inc instead. +# +# This script also fails if a timeout is reached (default 300 +# seconds). +# # # ==== Usage ==== # -# source include/wait_for_slave_sql_to_stop.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_sql_to_stop.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_sql_to_stop.inc +--source include/begin_include_file.inc + + +--let $slave_param= Slave_SQL_Running +--let $slave_param_value= No +--let $slave_error_param= Last_SQL_Errno +--source include/wait_for_slave_param.inc +--let $slave_error_param= + -# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE -# STATUS will return an empty set. -let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); -if (`SELECT '$_slave_io_running' != 'No such row'`) -{ - let $slave_param= Slave_SQL_Running; - let $slave_param_value= No; - let $slave_error_message= Failed while waiting for slave SQL thread to stop; - source include/wait_for_slave_param.inc; - let $slave_error_message= ; -} +--let $include_filename= wait_for_slave_sql_to_stop.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_to_start.inc b/mysql-test/include/wait_for_slave_to_start.inc index 567950cc6d7..a916e2ea615 100644 --- a/mysql-test/include/wait_for_slave_to_start.inc +++ b/mysql-test/include/wait_for_slave_to_start.inc @@ -3,22 +3,28 @@ # Waits until both the IO and SQL threads of the current connection # have started, or until a timeout is reached. # +# # ==== Usage ==== # -# source include/wait_for_slave_to_start.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_to_start.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_to_start.inc +--source include/begin_include_file.inc -let $slave_error_message= Failed while waiting for slave to start; -let $slave_param= Slave_IO_Running; -let $slave_param_value= Yes; -source include/wait_for_slave_param.inc; +--source include/wait_for_slave_io_to_start.inc +--source include/wait_for_slave_sql_to_start.inc -let $slave_param= Slave_SQL_Running; -let $slave_param_value= Yes; -source include/wait_for_slave_param.inc; -let $slave_error_message= ; +--let $include_filename= wait_for_slave_to_start.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc index 56d0e7b0c91..1bfd16067c5 100644 --- a/mysql-test/include/wait_for_slave_to_stop.inc +++ b/mysql-test/include/wait_for_slave_to_stop.inc @@ -1,30 +1,38 @@ # ==== Purpose ==== # # Waits until both the IO and SQL threads of the current connection -# have stopped, or until a timeout is reached. +# have stopped gracefully. +# +# Note: this script will fail if one of the threads stops with an +# error. If you expect an error in one of the threads, use +# include/wait_for_slave_io_error.inc or +# include/wait_for_slave_sql_error.inc instead. +# +# This script also fails if a timeout is reached (default 300 +# seconds). +# # # ==== Usage ==== # -# source include/wait_for_slave_to_stop.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_to_stop.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_to_stop.inc +--source include/begin_include_file.inc -# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE -# STATUS will return an empty set. -let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); -if (`SELECT '$_slave_io_running' != 'No such row'`) -{ - let $slave_error_message= Failed while waiting for slave to stop; - let $slave_param= Slave_IO_Running; - let $slave_param_value= No; - source include/wait_for_slave_param.inc; +--source include/wait_for_slave_sql_to_stop.inc +--source include/wait_for_slave_io_to_stop.inc - let $slave_param= Slave_SQL_Running; - let $slave_param_value= No; - source include/wait_for_slave_param.inc; - let $slave_error_message= ; -} +--let $include_filename= wait_for_slave_to_stop.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/write_var_to_file.inc b/mysql-test/include/write_var_to_file.inc new file mode 100644 index 00000000000..e70667634a3 --- /dev/null +++ b/mysql-test/include/write_var_to_file.inc @@ -0,0 +1,57 @@ +# ==== Purpose ==== +# +# Write the contents of $write_var to file $write_to_file. +# +# +# ==== Usage ==== +# +# --let $write_var = <value> +# --let $write_to_file = [<file>|GENERATE] +# --source include/write_var_to_file.inc +# +# $write_var is evaluated in sql 'string' context, so escapes like \n +# are interpolated. +# +# $write_to_file can be either a filename, or the special string +# GENERATE. If it is GENERATE, a unique filename is generated (based +# on UUID()). The filename is saved in $write_to_file so that it can +# be retrieved later. +# +# +# ==== Implementation ==== +# +# We can't use mysqltest's write_file because it does not evaluate +# variables. We can't use '--exec echo $write_var > $write_file' +# because it will use \n\r line terminator under windows. So the only +# working way is mysql's SELECT INTO DUMPFILE, which is subject to +# @@secure_file_priv. That makes this more complex than you might +# expect. + +if (`SELECT '$write_to_file' = ''`) +{ + --die You must set the mysqltest variable \$write_to_file before you source include/write_var_to_file.inc +} + +if (`SELECT '$write_to_file' = 'GENERATE'`) +{ + --let $_wvtf_suffix= `SELECT UUID()` + --let $write_to_file= $MYSQLTEST_VARDIR/tmp/_var_file_$_wvtf_suffix.inc +} + +--error 0,1 +--remove_file $write_to_file + +if (`SELECT LENGTH(@@secure_file_priv) > 0`) +{ + --let $_wvtf_secure_file_priv= `SELECT @@secure_file_priv` + --let $_wvtf_suffix= `SELECT UUID()` + --let $_wvtf_tmp_file= $_wvtf_secure_file_priv/_wvtf_$_wvtf_suffix + + --eval SELECT '$write_var' INTO DUMPFILE '$_wvtf_tmp_file' + --copy_file $_wvtf_tmp_file $write_to_file + --remove_file $_wvtf_tmp_file +} +if (`SELECT LENGTH(@@secure_file_priv) = 0`) +{ + --eval SELECT '$write_var' INTO DUMPFILE '$write_to_file' +} diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index 9f8de3e5830..b22e8bfb4b5 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -145,7 +145,6 @@ sub fix_secure_file_priv { sub fix_std_data { my ($self, $config, $group_name, $group)= @_; - #return "$::opt_vardir/std_data"; my $testdir= $self->get_testdir($group); return "$testdir/std_data"; } @@ -355,7 +354,7 @@ sub post_check_client_group { if (! defined $option){ #print $config; - croak "Could not get value for '$name_from'"; + croak "Could not get value for '$name_from' for test $self->{testname}"; } $config->insert($client_group_name, $name_to, $option->value()) } @@ -441,9 +440,9 @@ sub resolve_at_variable { $after = $'; chop($group_name); - my $from_group= $config->group($group_name) - or croak "There is no group named '$group_name' that ", - "can be used to resolve '$option_name'"; + my $from_group= $config->group($group_name) + or croak "There is no group named '$group_name' that ", + "can be used to resolve '$option_name' for test '$self->{testname}'"; my $value= $from_group->value($option_name); $res .= $before.$value; @@ -611,6 +610,7 @@ sub new_config { ARGS => $args, PORT => $args->{baseport}, SERVER_ID => 1, + testname => $args->{testname}, }, $class; # add auto-options diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index c29a29723df..5f557ef5d99 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -1,6 +1,6 @@ # -*- cperl -*- -# Copyright (C) 2005-2006 MySQL AB -# +# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. @@ -89,6 +89,21 @@ sub init_pattern { } +sub testcase_sort_order { + my ($a, $b, $sort_criteria)= @_; + # Run slow tests first, trying to avoid getting stuck at the end + # with a slow test in one worker and the other workers idle. + return -1 if $a->{'long_test'} && !$b->{'long_test'}; + return 1 if !$a->{'long_test'} && $b->{'long_test'}; + + my $a_sort_criteria= $sort_criteria->{$a->fullname()}; + my $b_sort_criteria= $sort_criteria->{$b->fullname()}; + my $res= $a_sort_criteria cmp $b_sort_criteria; + return $res if $res; + + return $a->fullname() cmp $b->fullname(); +} + ############################################################################## # # Collect information about test cases to be run @@ -129,7 +144,7 @@ sub collect_test_cases ($$$) { { last unless $opt_reorder; # test->{name} is always in suite.name format - if ( $test->{name} =~ /.*\.$tname/ ) + if ( $test->{name} =~ /^$sname.*\.$tname$/ ) { $found= 1; last; @@ -169,24 +184,32 @@ sub collect_test_cases ($$$) { # Append the criteria for sorting, in order of importance. # push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B")); + push(@criteria, $tinfo->{template_path}); # Group test with equal options together. # Ending with "~" makes empty sort later than filled my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : []; push(@criteria, join("!", sort @{$opts}) . "~"); + # Add slave opts if any + if ($tinfo->{'slave_opt'}) + { + push(@criteria, join("!", sort @{$tinfo->{'slave_opt'}})); + } + # This sorts tests with force-restart *before* identical tests + push(@criteria, $tinfo->{force_restart} ? "force-restart" : "no-restart"); - $sort_criteria{$tinfo->fullname()} = join(" ", @criteria); + $tinfo->{criteria}= join(" ", @criteria); + $sort_criteria{$tinfo->fullname()} = $tinfo->{criteria}; } - @$cases = sort { - $sort_criteria{$a->fullname()} . $a->fullname() cmp - $sort_criteria{$b->fullname()} . $b->fullname() } @$cases; + @$cases = sort { testcase_sort_order($a, $b, \%sort_criteria) } @$cases; # For debugging the sort-order # foreach my $tinfo (@$cases) # { - # print $sort_criteria{$tinfo->fullname()}," -> \t",$tinfo->fullname(),"\n"; + # my $tname= $tinfo->{name} . ' ' . $tinfo->{combination}; + # my $crit= $tinfo->{criteria}; + # print("$tname\n\t$crit\n"); # } - } if (defined $print_testcases){ @@ -890,9 +913,14 @@ sub collect_one_test_case { if ( $tinfo->{'big_test'} and ! $::opt_big_test ) { $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test needs 'big-test' option"; + $tinfo->{'comment'}= "Test needs --big-test"; return $tinfo } + if ( $tinfo->{'big_test'} ) + { + # All 'big_test' takes a long time to run + $tinfo->{'long_test'}= 1; + } if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries ) { @@ -915,7 +943,7 @@ sub collect_one_test_case { { # All ndb test's should be skipped $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)"; + $tinfo->{'comment'}= "No ndbcluster"; return $tinfo; } } @@ -936,7 +964,7 @@ sub collect_one_test_case { if ( $skip_rpl ) { $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No replication tests(--skip-rpl)"; + $tinfo->{'comment'}= "No replication tests"; return $tinfo; } } @@ -1065,6 +1093,7 @@ my @tags= ["include/have_example_plugin.inc", "example_plugin_test", 1], ["include/have_oqgraph_engine.inc", "oqgraph_test", 1], ["include/have_ssl.inc", "need_ssl", 1], + ["include/long_test.inc", "long_test", 1], ); diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index a42627c93cd..3c8a938ae54 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 622bbca3946..5671f58bbfe 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -2407,8 +2407,8 @@ sub remove_stale_vardir () { # Remove the var/ dir in mysql-test dir if any # this could be an old symlink that shouldn't be there - mtr_verbose("Removing $default_vardir"); - mtr_rmtree($default_vardir); + # mtr_verbose("Removing $default_vardir"); + # mtr_rmtree($default_vardir); # Remove the "var" dir mtr_verbose("Removing $opt_vardir/"); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index bc88d0d43f9..4ec2a68a3de 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1,6 +1,5 @@ #!/usr/bin/perl # -*- cperl -*- - # ############################################################################## # @@ -142,7 +141,7 @@ my $path_config_file; # The generated config file, var/my.cnf # executables will be used by the test suite. our $opt_vs_config = $ENV{'MTR_VS_CONFIG'}; -my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts,innodb,innodb_plugin,percona,ndb,vcol,oqgraph,sphinx"; +my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,handler,parts,innodb,innodb_plugin,percona,ndb,vcol,oqgraph,sphinx"; my $opt_suites; our $opt_verbose= 0; # Verbose output, enable with --verbose @@ -614,6 +613,11 @@ sub run_test_server ($$$) { if ( !$opt_force ) { # Test has failed, force is off push(@$completed, $result); + if ($result->{'dont_kill_server'}) + { + print $sock "BYE\n"; + next; + } return ("Failure", 1, $completed, $extra_warnings); } elsif ($opt_max_test_fail > 0 and @@ -719,22 +723,42 @@ sub run_test_server ($$$) { next; } - # Prefer same configuration, or just use next if --noreorder - if (!$opt_reorder or (defined $result and - $result->{template_path} eq $t->{template_path})) - { - #mtr_report("Test uses same config => good match"); - # Test uses same config => good match - $next= splice(@$tests, $i, 1); - last; - } - - # Second best choice is the first that does not fulfill - # any of the above conditions - if (!defined $second_best){ + # From secondary choices, we prefer to pick a 'long-running' test if + # possible; this helps avoid getting stuck with a few of those at the + # end of high --parallel runs, with most workers being idle. + if (!defined $second_best || + ($t->{'long_test'} && !($tests->[$second_best]{'long_test'}))){ #mtr_report("Setting second_best to $i"); $second_best= $i; } + + # Smart allocation of next test within this thread. + + if ($opt_reorder and $opt_parallel > 1 and defined $result) + { + my $wid= $result->{worker}; + # Reserved for other thread, try next + next if (defined $t->{reserved} and $t->{reserved} != $wid); + if (! defined $t->{reserved}) + { + # Force-restart not relevant when comparing *next* test + $t->{criteria} =~ s/force-restart$/no-restart/; + my $criteria= $t->{criteria}; + # Reserve similar tests for this worker, but not too many + my $maxres= (@$tests - $i) / $opt_parallel + 1; + for (my $j= $i+1; $j <= $i + $maxres; $j++) + { + my $tt= $tests->[$j]; + last unless defined $tt; + last if $tt->{criteria} ne $criteria; + $tt->{reserved}= $wid; + } + } + } + + # At this point we have found next suitable test + $next= splice(@$tests, $i, 1); + last; } # Use second best choice if no other test has been found @@ -743,12 +767,14 @@ sub run_test_server ($$$) { mtr_error("Internal error, second best too large($second_best)") if $second_best > $#$tests; $next= splice(@$tests, $second_best, 1); + delete $next->{reserved}; } xterm_stat(scalar(@$tests)); if ($next) { - #$next->print_test(); + # We don't need this any more + delete $next->{criteria}; $next->write_test($sock, 'TESTCASE'); $running{$next->key()}= $next; $num_ndb_tests++ if ($next->{ndb_test}); @@ -830,6 +856,11 @@ sub run_worker ($) { delete($test->{'comment'}); delete($test->{'logfile'}); + # A sanity check. Should this happen often we need to look at it. + if (defined $test->{reserved} && $test->{reserved} != $thread_num) { + my $tres= $test->{reserved}; + mtr_warning("Test reserved for w$tres picked up by w$thread_num"); + } $test->{worker} = $thread_num if $opt_parallel > 1; run_testcase($test, $server); @@ -852,10 +883,14 @@ sub run_worker ($) { else { stop_all_servers($opt_shutdown_timeout); } + my $valgrind_reports= 0; + if ($opt_valgrind_mysqld) { + $valgrind_reports= valgrind_exit_reports(); + } if ( $opt_gprof ) { gprof_collect (find_mysqld($basedir), keys %gprof_dirs); } - exit(0); + exit($valgrind_reports); } else { mtr_error("Could not understand server, '$line'"); @@ -900,7 +935,7 @@ sub command_line_setup { my $opt_list_options; # Read the command line options - # Note: Keep list, and the order, in sync with usage at end of this file + # Note: Keep list in sync with usage at end of this file Getopt::Long::Configure("pass_through"); my %options=( # Control what engine/variation to run @@ -936,6 +971,7 @@ sub command_line_setup { 'combination=s' => \@opt_combinations, 'skip-combinations' => \&collect_option, 'experimental=s' => \@opt_experimentals, + # skip-im is deprecated and silently ignored 'skip-im' => \&ignore_option, 'staging-run' => \$opt_staging_run, @@ -1037,8 +1073,9 @@ sub command_line_setup { 'max-connections=i' => \$opt_max_connections, 'help|h' => \$opt_usage, - 'list-options' => \$opt_list_options, - ); + # list-options is internal, not listed in help + 'list-options' => \$opt_list_options, + ); GetOptions(%options) or usage("Can't read options"); usage("") if $opt_usage; @@ -1594,16 +1631,16 @@ sub set_build_thread_ports($) { $ENV{MTR_BUILD_THREAD}= $build_thread; # Calculate baseport - $baseport= $build_thread * 10 + 10000; - if ( $baseport < 5001 or $baseport + 9 >= 32767 ) + $baseport= $build_thread * 20 + 10000; + if ( $baseport < 5001 or $baseport + 19 >= 32767 ) { mtr_error("MTR_BUILD_THREAD number results in a port", "outside 5001 - 32767", - "($baseport - $baseport + 9)"); + "($baseport - $baseport + 19)"); } mtr_report("Using MTR_BUILD_THREAD $build_thread,", - "with reserved ports $baseport..".($baseport+9)); + "with reserved ports $baseport..".($baseport+19)); } @@ -2083,6 +2120,16 @@ sub environment_setup { $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'} || 3306; $ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir; $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir; + + if (IS_WINDOWS) + { + $ENV{'SECURE_LOAD_PATH'}= $glob_mysql_test_dir."\\std_data"; + } + else + { + $ENV{'SECURE_LOAD_PATH'}= $glob_mysql_test_dir."/std_data"; + } + # # Some stupid^H^H^H^H^H^Hignorant network providers set up "wildcard DNS" @@ -2285,10 +2332,10 @@ sub remove_stale_vardir () { # Running with "var" in some other place # - # Remove the var/ dir in mysql-test dir if any - # this could be an old symlink that shouldn't be there - mtr_verbose("Removing $default_vardir"); - rmtree($default_vardir); + # Don't remove the var/ dir in mysql-test dir as it may be in + # use by another mysql-test-run run with --vardir + # mtr_verbose("Removing $default_vardir"); + # rmtree($default_vardir); # Remove the "var" dir mtr_verbose("Removing $opt_vardir/"); @@ -2374,7 +2421,7 @@ sub setup_vardir() { $plugindir="$opt_vardir/plugins"; unshift (@opt_extra_mysqld_opt, "--plugin-dir=$plugindir"); mkpath($plugindir); - if (IS_WINDOWS) + if (IS_WINDOWS && !$opt_embedded_server) { for (<../storage/*$opt_vs_config/*.dll>, <../plugin/*$opt_vs_config/*.dll>, @@ -3605,13 +3652,14 @@ sub find_analyze_request # The test can leave a file in var/tmp/ to signal # that all servers should be restarted -sub restart_forced_by_test +sub restart_forced_by_test($) { + my $file = shift; my $restart = 0; foreach my $mysqld ( mysqlds() ) { my $datadir = $mysqld->value('datadir'); - my $force_restart_file = "$datadir/mtr/force_restart"; + my $force_restart_file = "$datadir/mtr/$file"; if ( -f $force_restart_file ) { mtr_verbose("Restart of servers forced by test"); @@ -3775,6 +3823,7 @@ sub run_testcase ($$) { # Generate new config file from template $config= My::ConfigFactory->new_config ( { + testname => $tinfo->{name}, basedir => $basedir, testdir => $glob_mysql_test_dir, template_path => $tinfo->{template_path}, @@ -3946,7 +3995,7 @@ sub run_testcase ($$) { if ( $res == 0 ) { my $check_res; - if ( restart_forced_by_test() ) + if ( restart_forced_by_test('force_restart') ) { stop_all_servers($opt_shutdown_timeout); } @@ -3985,8 +4034,11 @@ sub run_testcase ($$) { find_testcase_skipped_reason($tinfo); mtr_report_test_skipped($tinfo); # Restart if skipped due to missing perl, it may have had side effects - stop_all_servers($opt_shutdown_timeout) - if ($tinfo->{'comment'} =~ /^perl not found/); + if ( restart_forced_by_test('force_restart_if_skipped') || + $tinfo->{'comment'} =~ /^perl not found/ ) + { + stop_all_servers($opt_shutdown_timeout); + } } elsif ( $res == 65 ) { @@ -4037,7 +4089,6 @@ sub run_testcase ($$) { # ---------------------------------------------------- # Check if it was an expected crash # ---------------------------------------------------- - SRVDIED: my $check_crash = check_expected_crash_and_restart($proc); if ($check_crash) { @@ -4047,6 +4098,7 @@ sub run_testcase ($$) { next; } + SRVDIED: # ---------------------------------------------------- # Stop the test case timer # ---------------------------------------------------- @@ -4310,6 +4362,7 @@ sub extract_warning_lines ($) { qr/Plugin 'ndbcluster' will be forced to shutdown/, qr/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/, qr/InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal/, + qr/InnoDB: Warning: a long semaphore wait:/, qr/Slave: Unknown table 't1' Error_code: 1051/, qr/Slave SQL:.*(Error_code: [[:digit:]]+|Query:.*)/, qr/slave SQL thread aborted/, @@ -4690,6 +4743,19 @@ sub after_failure ($) { mkpath($save_dir) if ! -d $save_dir; + # + # Create a log of files in vardir (good for buildbot) + # + if (!IS_WINDOWS) + { + my $Flog= IO::File->new("$opt_vardir/log/files.log", "w"); + if ($Flog) + { + print $Flog scalar(`/bin/ls -Rl $opt_vardir/*`); + close($Flog); + } + } + # Save the used config files my %config_files = config_files($tinfo); while (my ($file, $generate) = each %config_files) { @@ -4709,7 +4775,12 @@ sub after_failure ($) { sub report_failure_and_restart ($) { my $tinfo= shift; - stop_all_servers(); + if ($opt_valgrind_mysqld && ($tinfo->{'warnings'} || $tinfo->{'timeout'})) { + # In these cases we may want valgrind report from normal termination + $tinfo->{'dont_kill_server'}= 1; + } + # Shotdown properly if not to be killed (for valgrind) + stop_all_servers($tinfo->{'dont_kill_server'} ? $opt_shutdown_timeout : 0); $tinfo->{'result'}= 'MTR_RES_FAILED'; @@ -5096,17 +5167,6 @@ sub server_need_restart { } } - # Temporary re-enable the "always restart slave" hack - # this should be removed asap, but will require that each rpl - # testcase cleanup better after itself - ie. stop and reset - # replication - # Use the "#!use-slave-opt" marker to detect that this is a "slave" - # server - if ( $server->option("#!use-slave-opt") ){ - mtr_verbose_restart($server, "Always restart slave(s)"); - return 1; - } - if ($server->name() =~ /^mysqld\./) { @@ -5247,7 +5307,7 @@ sub start_servers($) { for (all_servers()) { next unless $_->{WAIT} and started($_); if ($_->{WAIT}->($_)) { - $tinfo->{comment}= "Failed to start ".$_->name(); + $tinfo->{comment}= "Failed to start ".$_->name() . "\n"; return 1; } } @@ -5707,6 +5767,72 @@ sub strace_arguments { } } +# +# Search server logs for valgrind reports printed at mysqld termination +# + +sub valgrind_exit_reports() { + my $found_err= 0; + + foreach my $log_file (keys %mysqld_logs) + { + my @culprits= (); + my $valgrind_rep= ""; + my $found_report= 0; + my $err_in_report= 0; + + my $LOGF = IO::File->new($log_file) + or mtr_error("Could not open file '$log_file' for reading: $!"); + + while ( my $line = <$LOGF> ) + { + if ($line =~ /^CURRENT_TEST: (.+)$/) + { + my $testname= $1; + # If we have a report, report it if needed and start new list of tests + if ($found_report) + { + if ($err_in_report) + { + mtr_print ("Valgrind report from $log_file after tests:\n", + @culprits); + mtr_print_line(); + print ("$valgrind_rep\n"); + $err_in_report= 0; + } + # Make ready to collect new report + @culprits= (); + $found_report= 0; + $valgrind_rep= ""; + } + push (@culprits, $testname); + next; + } + # This line marks the start of a valgrind report + $found_report= 1 if $line =~ /^==\d+== .* SUMMARY:/; + + if ($found_report) { + $line=~ s/^==\d+== //; + $valgrind_rep .= $line; + $err_in_report= 1 if $line =~ /ERROR SUMMARY: [1-9]/; + $err_in_report= 1 if $line =~ /definitely lost: [1-9]/; + $err_in_report= 1 if $line =~ /possibly lost: [1-9]/; + } + } + + $LOGF= undef; + + if ($err_in_report) { + mtr_print ("Valgrind report from $log_file after tests:\n", @culprits); + mtr_print_line(); + print ("$valgrind_rep\n"); + $found_err= 1; + } + } + + return $found_err; +} + # # Usage @@ -5741,7 +5867,7 @@ Options to control what engine/variation to run parallel=# How many parallell test should be run defaults-file=<config template> Use fixed config template for all tests - defaults_extra_file=<config template> Extra config template to add to + defaults-extra-file=<config template> Extra config template to add to all generated configs combination=<opt> Use at least twice to run tests with specified options to mysqld @@ -5835,6 +5961,9 @@ Options for debugging the product test(s) manual-ddd Let user manually start mysqld in ddd, before running test(s) + strace-client[=path] Create strace output for mysqltest client, optionally + specifying name and path to the trace program to use. + Example: $0 --strace-client=ktrace max-save-core Limit the number of core files saved (to avoid filling up disks for heavily crashing server). Defaults to $opt_max_save_core, set to 0 for no limit. Set @@ -5874,7 +6003,7 @@ Options for strace Misc options user=USER User for connecting to mysqld(default: $opt_user) comment=STR Write STR to the output - notimer Don't show test case execution time + timer Show test case execution time. verbose More verbose output(use multiple times for even more) verbose-restart Write when and why servers are restarted start Only initialize and start the servers, using the @@ -5928,6 +6057,7 @@ Misc options gcov-src-dir=subdir Colllect coverage only within the given subdirectory. For example, if you're only developing the SQL layer, it makes sense to use --gcov-src-dir=sql + gprof Collect profiling information using gprof. experimental=<file> Refer to list of tests considered experimental; failures will be marked exp-fail instead of fail. report-features First run a "test" that reports mysql features @@ -5936,6 +6066,10 @@ Misc options *previous* test started max-connections=N Max number of open connection to server in mysqltest +Some options that control enabling a feature for normal test runs, +can be turned off by prepending 'no' to the option, e.g. --notimer. +This applies to reorder, timer, check-testcases and warnings. + HERE exit(1); diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index ae79e237ade..73a9090b1e3 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); DROP TABLE if exists t1,t2,t3,t4,t5,t6; SET storage_engine=ARCHIVE; CREATE TABLE t1 ( diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 4a2e108f8c6..edd23050294 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -476,3 +476,43 @@ SELECT a FROM t2; a 2 DROP TABLE t1, t2; +# +# Bug#39828 autoinc wraps around when offset and increment > 1 +# +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) engine=MyISAM; +INSERT INTO t1 VALUES(1); +INSERT INTO t1 VALUES (18446744073709551601); +SET @@SESSION.AUTO_INCREMENT_INCREMENT=10; +SELECT @@SESSION.AUTO_INCREMENT_OFFSET; +@@SESSION.AUTO_INCREMENT_OFFSET +1 +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +ERROR 22003: Out of range value for column 't1' at row 167 +SELECT * FROM t1; +c1 +1 +18446744073709551601 +18446744073709551611 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=default; +SET @@SESSION.AUTO_INCREMENT_OFFSET=default; +DROP TABLE t1; +End of 5.1 tests +# +# Bug#50619 assert in handler::update_auto_increment +# +CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk)); +INSERT INTO t1 VALUES (NULL), (-1), (NULL); +SELECT * FROM t1; +pk +-1 +1 +2 +DROP TABLE t1; +CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk)); +INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL); +ERROR HY000: Failed to read auto-increment value from storage engine +SELECT * FROM t1; +pk +1 +18446744073709551614 +DROP TABLE t1; diff --git a/mysql-test/r/change_user.result b/mysql-test/r/change_user.result index 3c1e2b6f262..18c53a5e22b 100644 --- a/mysql-test/r/change_user.result +++ b/mysql-test/r/change_user.result @@ -51,7 +51,7 @@ change_user SELECT @@session.sql_big_selects; @@session.sql_big_selects 0 -SET @@global.max_join_size = -1; +SET @@global.max_join_size = 18446744073709551615; SET @@session.max_join_size = default; change_user SELECT @@session.sql_big_selects; diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index 00602093425..7a972f4814a 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -222,6 +222,17 @@ SELECT 'Connection on extra port 2 ok'; Connection on extra port 2 ok Connection on extra port 2 ok # -- Success: more than --extra-max-connections + 1 normal connections not possible +# +# -- Bug#49752: 2469.126.2 unintentionally breaks authentication +# against MySQL 5.1 server +# +GRANT ALL ON test.* TO 'Azundris12345678'@'localhost' IDENTIFIED BY 'test123'; +FLUSH PRIVILEGES; +DROP USER 'Azundris12345678'@'localhost'; +FLUSH PRIVILEGES; +# +# -- End of Bug#49752 +# # ------------------------------------------------------------------ # -- End of 5.1 tests # ------------------------------------------------------------------ diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 1cff420e34e..4c3529fb227 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -1,3 +1,5 @@ +call mtr.add_suppression("Table 'test_repair_table2' is marked as crashed and should be repaired"); +call mtr.add_suppression("Table 'test_repair_table4' is marked as crashed and should be repaired"); drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 47797af3cbe..dc12f9ceb03 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -70,3 +70,311 @@ we_ivo NULL we_martin NULL we_toshko NULL drop table t1; +# +# Start of 5.1 tests +# +SELECT @@collation_connection; +@@collation_connection +cp1251_general_ci +CREATE TABLE t1 AS SELECT ' ' AS a LIMIT 0; +INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07); +INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F); +INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17); +INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F); +INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27); +INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F); +INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37); +INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F); +INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47); +INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F); +INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57); +INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F); +INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67); +INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F); +INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77); +INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F); +INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87); +INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F); +INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97); +INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F); +INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7); +INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF); +INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7); +INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF); +INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7); +INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF); +INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7); +INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF); +INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7); +INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF); +INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7); +INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF); +SELECT +HEX(a) AS chr, +HEX(LOWER(a)) AS upper, +HEX(LOWER(a)) AS lower, +HEX(@utf8:=CONVERT(a USING utf8)) AS utf8, +HEX(@roundtrip:=CAST(@utf8 AS CHAR)) AS roundtrip, +if(a=BINARY @roundtrip,'','Round trip unsafe') AS issafe +FROM t1 ORDER BY chr; +chr upper lower utf8 roundtrip issafe +00 00 00 00 00 +01 01 01 01 01 +02 02 02 02 02 +03 03 03 03 03 +04 04 04 04 04 +05 05 05 05 05 +06 06 06 06 06 +07 07 07 07 07 +08 08 08 08 08 +09 09 09 09 09 +0A 0A 0A 0A 0A +0B 0B 0B 0B 0B +0C 0C 0C 0C 0C +0D 0D 0D 0D 0D +0E 0E 0E 0E 0E +0F 0F 0F 0F 0F +10 10 10 10 10 +11 11 11 11 11 +12 12 12 12 12 +13 13 13 13 13 +14 14 14 14 14 +15 15 15 15 15 +16 16 16 16 16 +17 17 17 17 17 +18 18 18 18 18 +19 19 19 19 19 +1A 1A 1A 1A 1A +1B 1B 1B 1B 1B +1C 1C 1C 1C 1C +1D 1D 1D 1D 1D +1E 1E 1E 1E 1E +1F 1F 1F 1F 1F +20 20 20 20 20 +21 21 21 21 21 +22 22 22 22 22 +23 23 23 23 23 +24 24 24 24 24 +25 25 25 25 25 +26 26 26 26 26 +27 27 27 27 27 +28 28 28 28 28 +29 29 29 29 29 +2A 2A 2A 2A 2A +2B 2B 2B 2B 2B +2C 2C 2C 2C 2C +2D 2D 2D 2D 2D +2E 2E 2E 2E 2E +2F 2F 2F 2F 2F +30 30 30 30 30 +31 31 31 31 31 +32 32 32 32 32 +33 33 33 33 33 +34 34 34 34 34 +35 35 35 35 35 +36 36 36 36 36 +37 37 37 37 37 +38 38 38 38 38 +39 39 39 39 39 +3A 3A 3A 3A 3A +3B 3B 3B 3B 3B +3C 3C 3C 3C 3C +3D 3D 3D 3D 3D +3E 3E 3E 3E 3E +3F 3F 3F 3F 3F +40 40 40 40 40 +41 61 61 41 41 +42 62 62 42 42 +43 63 63 43 43 +44 64 64 44 44 +45 65 65 45 45 +46 66 66 46 46 +47 67 67 47 47 +48 68 68 48 48 +49 69 69 49 49 +4A 6A 6A 4A 4A +4B 6B 6B 4B 4B +4C 6C 6C 4C 4C +4D 6D 6D 4D 4D +4E 6E 6E 4E 4E +4F 6F 6F 4F 4F +50 70 70 50 50 +51 71 71 51 51 +52 72 72 52 52 +53 73 73 53 53 +54 74 74 54 54 +55 75 75 55 55 +56 76 76 56 56 +57 77 77 57 57 +58 78 78 58 58 +59 79 79 59 59 +5A 7A 7A 5A 5A +5B 5B 5B 5B 5B +5C 5C 5C 5C 5C +5D 5D 5D 5D 5D +5E 5E 5E 5E 5E +5F 5F 5F 5F 5F +60 60 60 60 60 +61 61 61 61 61 +62 62 62 62 62 +63 63 63 63 63 +64 64 64 64 64 +65 65 65 65 65 +66 66 66 66 66 +67 67 67 67 67 +68 68 68 68 68 +69 69 69 69 69 +6A 6A 6A 6A 6A +6B 6B 6B 6B 6B +6C 6C 6C 6C 6C +6D 6D 6D 6D 6D +6E 6E 6E 6E 6E +6F 6F 6F 6F 6F +70 70 70 70 70 +71 71 71 71 71 +72 72 72 72 72 +73 73 73 73 73 +74 74 74 74 74 +75 75 75 75 75 +76 76 76 76 76 +77 77 77 77 77 +78 78 78 78 78 +79 79 79 79 79 +7A 7A 7A 7A 7A +7B 7B 7B 7B 7B +7C 7C 7C 7C 7C +7D 7D 7D 7D 7D +7E 7E 7E 7E 7E +7F 7F 7F 7F 7F +80 90 90 D082 80 +81 83 83 D083 81 +82 82 82 E2809A 82 +83 83 83 D193 83 +84 84 84 E2809E 84 +85 85 85 E280A6 85 +86 86 86 E280A0 86 +87 87 87 E280A1 87 +88 88 88 E282AC 88 +89 89 89 E280B0 89 +8A 9A 9A D089 8A +8B 8B 8B E280B9 8B +8C 9C 9C D08A 8C +8D 9D 9D D08C 8D +8E 9E 9E D08B 8E +8F 9F 9F D08F 8F +90 90 90 D192 90 +91 91 91 E28098 91 +92 92 92 E28099 92 +93 93 93 E2809C 93 +94 94 94 E2809D 94 +95 95 95 E280A2 95 +96 96 96 E28093 96 +97 97 97 E28094 97 +98 98 98 3F 3F Round trip unsafe +99 99 99 E284A2 99 +9A 9A 9A D199 9A +9B 9B 9B E280BA 9B +9C 9C 9C D19A 9C +9D 9D 9D D19C 9D +9E 9E 9E D19B 9E +9F 9F 9F D19F 9F +A0 A0 A0 C2A0 A0 +A1 A2 A2 D08E A1 +A2 A2 A2 D19E A2 +A3 BC BC D088 A3 +A4 A4 A4 C2A4 A4 +A5 B4 B4 D290 A5 +A6 A6 A6 C2A6 A6 +A7 A7 A7 C2A7 A7 +A8 B8 B8 D081 A8 +A9 A9 A9 C2A9 A9 +AA BA BA D084 AA +AB AB AB C2AB AB +AC AC AC C2AC AC +AD AD AD C2AD AD +AE AE AE C2AE AE +AF BF BF D087 AF +B0 B0 B0 C2B0 B0 +B1 B1 B1 C2B1 B1 +B2 B3 B3 D086 B2 +B3 B3 B3 D196 B3 +B4 B4 B4 D291 B4 +B5 B5 B5 C2B5 B5 +B6 B6 B6 C2B6 B6 +B7 B7 B7 C2B7 B7 +B8 B8 B8 D191 B8 +B9 B9 B9 E28496 B9 +BA BA BA D194 BA +BB BB BB C2BB BB +BC BC BC D198 BC +BD BE BE D085 BD +BE BE BE D195 BE +BF BF BF D197 BF +C0 E0 E0 D090 C0 +C1 E1 E1 D091 C1 +C2 E2 E2 D092 C2 +C3 E3 E3 D093 C3 +C4 E4 E4 D094 C4 +C5 E5 E5 D095 C5 +C6 E6 E6 D096 C6 +C7 E7 E7 D097 C7 +C8 E8 E8 D098 C8 +C9 E9 E9 D099 C9 +CA EA EA D09A CA +CB EB EB D09B CB +CC EC EC D09C CC +CD ED ED D09D CD +CE EE EE D09E CE +CF EF EF D09F CF +D0 F0 F0 D0A0 D0 +D1 F1 F1 D0A1 D1 +D2 F2 F2 D0A2 D2 +D3 F3 F3 D0A3 D3 +D4 F4 F4 D0A4 D4 +D5 F5 F5 D0A5 D5 +D6 F6 F6 D0A6 D6 +D7 F7 F7 D0A7 D7 +D8 F8 F8 D0A8 D8 +D9 F9 F9 D0A9 D9 +DA FA FA D0AA DA +DB FB FB D0AB DB +DC FC FC D0AC DC +DD FD FD D0AD DD +DE FE FE D0AE DE +DF FF FF D0AF DF +E0 E0 E0 D0B0 E0 +E1 E1 E1 D0B1 E1 +E2 E2 E2 D0B2 E2 +E3 E3 E3 D0B3 E3 +E4 E4 E4 D0B4 E4 +E5 E5 E5 D0B5 E5 +E6 E6 E6 D0B6 E6 +E7 E7 E7 D0B7 E7 +E8 E8 E8 D0B8 E8 +E9 E9 E9 D0B9 E9 +EA EA EA D0BA EA +EB EB EB D0BB EB +EC EC EC D0BC EC +ED ED ED D0BD ED +EE EE EE D0BE EE +EF EF EF D0BF EF +F0 F0 F0 D180 F0 +F1 F1 F1 D181 F1 +F2 F2 F2 D182 F2 +F3 F3 F3 D183 F3 +F4 F4 F4 D184 F4 +F5 F5 F5 D185 F5 +F6 F6 F6 D186 F6 +F7 F7 F7 D187 F7 +F8 F8 F8 D188 F8 +F9 F9 F9 D189 F9 +FA FA FA D18A FA +FB FB FB D18B FB +FC FC FC D18C FC +FD FD FD D18D FD +FE FE FE D18E FE +FF FF FF D18F FF +DROP TABLE t1; +# +# End of 5.1 tests +# diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 763acd0fea0..66b2cbd8fc4 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -409,3 +409,11 @@ select hex(cast(_ascii 0x7f as char(1) character set latin1)); hex(cast(_ascii 0x7f as char(1) character set latin1)) 7F End of 5.0 tests +# +# Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings +# +SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, ''); +'' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '') +1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result index 540ba178756..765ad5a96ca 100644 --- a/mysql-test/r/ctype_ujis.result +++ b/mysql-test/r/ctype_ujis.result @@ -2374,6 +2374,16 @@ hex(convert(_latin1 0xA4A2 using ujis)) hex(c2) DROP PROCEDURE sp1; DROP TABLE t1; DROP TABLE t2; +# +# Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +# +SET NAMES utf8; +SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis); +CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis) + +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'a' +Warning 1292 Truncated incorrect INTEGER value: 'a' set names default; set character_set_database=default; set character_set_server=default; diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 7e185daa668..a919a6f8c5e 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -609,3 +609,17 @@ SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; valid_date Thursday 01 January 2009 "End of 5.0 tests" +# +# Start of 5.1 tests +# +# +# Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr' +# +SET NAMES utf8; +SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))); +LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))) +% +SET NAMES latin1; +# +# End of 5.1 tests +# diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 80f04ffd455..61f1db9989f 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -400,4 +400,15 @@ SELECT 0 FROM (SELECT 0) t61; 0 0 +# +# A nested materialized derived table is used before being populated. +# (addon for bug#19077) +# +CREATE TABLE t1 (i INT, j BIGINT); +INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2); +SELECT * FROM (SELECT MIN(i) FROM t1 +WHERE j = SUBSTRING('12', (SELECT * FROM (SELECT MIN(j) FROM t1) t2))) t3; +MIN(i) +1 +DROP TABLE t1; # End of 5.0 tests diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index de592ece285..4a79a15a2b6 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -1037,4 +1037,16 @@ INSERT INTO t1 values (0),(0); SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d)); ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `t`.`f1`) `d`)' value found during parsing DROP TABLE t1; +# +# Bug#58396 group_concat and explain extended are still crashy +# +CREATE TABLE t1(a INT); +EXPLAIN EXTENDED SELECT UPDATEXML('1', a, '1') +FROM t1 ORDER BY (SELECT GROUP_CONCAT(1) FROM t1); +ERROR HY000: Only constant XPATH queries are supported +SHOW WARNINGS; +Level Code Message +Error 1105 Only constant XPATH queries are supported +Note 1003 select updatexml('1',`test`.`t1`.`a`,'1') AS `UPDATEXML('1', a, '1')` from `test`.`t1` order by (select group_concat(1 separator ',') from `test`.`t1`) +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 606f879b47f..1a21fb5872f 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1724,4 +1724,17 @@ m 1 DROP TABLE t1; # +# Bug#58030 crash in Item_func_geometry_from_text::val_str +# +SELECT MAX(TIMESTAMP(RAND(0))); +SELECT MIN(TIMESTAMP(RAND(0))); +# +# Bug#58177 crash and valgrind warnings in decimal and protocol sending functions... +# +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa'); +# End of 5.1 tests diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 649232e0b05..3a626084c9e 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -498,4 +498,17 @@ SELECT -9223372036854775808 MOD -1; SELECT -9223372036854775808999 MOD -1; -9223372036854775808999 MOD -1 0 +# +# Bug#57810 case/when/then : Assertion failed: length || !scale +# +SELECT CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END; +CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END +NULL +CREATE TABLE t1 SELECT CAST((CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END) AS CHAR) as C; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `C` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 4268268fabb..0321b2d85ad 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -2600,4 +2600,16 @@ ORDER BY QUOTE(t1.a); 1 1 DROP TABLE t1; +# +# Bug#57913 large negative number to string conversion functions crash +# Bug#57810 case/when/then : Assertion failed: length || !scale +# +SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1)); +'1' IN ('1', SUBSTRING(-9223372036854775809, 1)) +1 +SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)); +CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)) +1 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '' End of 5.1 tests diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 5500eefda4c..a97c040d9ac 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1343,4 +1343,18 @@ SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); 1 1 DROP TABLE t1; +# +# Bug #52160: crash and inconsistent results when grouping +# by a function and column +# +CREATE TABLE t1(a CHAR(10) NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect time value: '' +Warning 1292 Truncated incorrect time value: '' +Warning 1292 Truncated incorrect time value: '' +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 3b18ee61336..f4aa361ffcf 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1014,4 +1014,12 @@ SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000 SET @a=POLYFROMWKB(@a); SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; SET @a=POLYFROMWKB(@a); +create table t1(a polygon NOT NULL)engine=myisam; +insert into t1 values (geomfromtext("point(0 1)")); +insert into t1 values (geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +p +NULL +NULL +drop table t1; End of 5.1 tests diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 064d6a35bd6..7369fb4cd61 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1253,6 +1253,80 @@ CURRENT_USER() root@localhost SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); + +# Bug#57952 + +DROP DATABASE IF EXISTS mysqltest1; +DROP DATABASE IF EXISTS mysqltest2; +CREATE DATABASE mysqltest1; +CREATE DATABASE mysqltest2; +use mysqltest1; +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1, 1); +CREATE TABLE t2(a INT); +INSERT INTO t2 VALUES (2); +CREATE TABLE mysqltest2.t3(a INT); +INSERT INTO mysqltest2.t3 VALUES (4); +CREATE USER testuser@localhost; +GRANT CREATE ROUTINE, EXECUTE ON mysqltest1.* TO testuser@localhost; +GRANT SELECT(b) ON t1 TO testuser@localhost; +GRANT SELECT ON t2 TO testuser@localhost; +GRANT SELECT ON mysqltest2.* TO testuser@localhost; + +# Connection: bug57952_con1 (testuser@localhost, db: mysqltest1) +PREPARE s1 FROM 'SELECT b FROM t1'; +PREPARE s2 FROM 'SELECT a FROM t2'; +PREPARE s3 FROM 'SHOW TABLES FROM mysqltest2'; +CREATE PROCEDURE p1() SELECT b FROM t1; +CREATE PROCEDURE p2() SELECT a FROM t2; +CREATE PROCEDURE p3() SHOW TABLES FROM mysqltest2; +CALL p1; +b +1 +CALL p2; +a +2 +CALL p3; +Tables_in_mysqltest2 +t3 + +# Connection: default +REVOKE SELECT ON t1 FROM testuser@localhost; +GRANT SELECT(a) ON t1 TO testuser@localhost; +REVOKE SELECT ON t2 FROM testuser@localhost; +REVOKE SELECT ON mysqltest2.* FROM testuser@localhost; + +# Connection: bug57952_con1 (testuser@localhost, db: mysqltest1) +# - Check column-level privileges... +EXECUTE s1; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1' +SELECT b FROM t1; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1' +EXECUTE s1; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1' +CALL p1; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1' +# - Check table-level privileges... +SELECT a FROM t2; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table 't2' +EXECUTE s2; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table 't2' +CALL p2; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table 't2' +# - Check database-level privileges... +SHOW TABLES FROM mysqltest2; +ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2' +EXECUTE s3; +ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2' +CALL p3; +ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2' + +# Connection: default +DROP DATABASE mysqltest1; +DROP DATABASE mysqltest2; +DROP USER testuser@localhost; +use test; + End of 5.0 tests set names utf8; grant select on test.* to юзер_юзер@localhost; diff --git a/mysql-test/r/init_file.result b/mysql-test/r/init_file.result index 43ed908ad01..6394014f3e5 100644 --- a/mysql-test/r/init_file.result +++ b/mysql-test/r/init_file.result @@ -21,4 +21,3 @@ y 11 13 drop table t1, t2; -call mtr.force_restart(); diff --git a/mysql-test/r/innodb-zip.result b/mysql-test/r/innodb-zip.result deleted file mode 100644 index 21396d81ba8..00000000000 --- a/mysql-test/r/innodb-zip.result +++ /dev/null @@ -1,421 +0,0 @@ -set global innodb_file_per_table=off; -set global innodb_file_format=`0`; -create table t0(a int primary key) engine=innodb row_format=compressed; -Warnings: -Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. -Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. -create table t00(a int primary key) engine=innodb -key_block_size=4 row_format=compressed; -Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. -Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. -Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. -create table t1(a int primary key) engine=innodb row_format=dynamic; -Warnings: -Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. -Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. -create table t2(a int primary key) engine=innodb row_format=redundant; -create table t3(a int primary key) engine=innodb row_format=compact; -create table t4(a int primary key) engine=innodb key_block_size=9; -Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9. -create table t5(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1. -set global innodb_file_per_table=on; -create table t6(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1. -set global innodb_file_format=`1`; -create table t7(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -create table t8(a int primary key) engine=innodb -key_block_size=1 row_format=fixed; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. -create table t9(a int primary key) engine=innodb -key_block_size=1 row_format=compact; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -create table t10(a int primary key) engine=innodb -key_block_size=1 row_format=dynamic; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -create table t11(a int primary key) engine=innodb -key_block_size=1 row_format=compressed; -create table t12(a int primary key) engine=innodb -key_block_size=1; -create table t13(a int primary key) engine=innodb -row_format=compressed; -create table t14(a int primary key) engine=innodb key_block_size=9; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9. -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t0 Compact -test t00 Compact -test t1 Compact -test t10 Dynamic -test t11 Compressed -test t12 Compressed -test t13 Compressed -test t14 Compact -test t2 Redundant -test t3 Compact -test t4 Compact -test t5 Redundant -test t6 Redundant -test t7 Redundant -test t8 Compact -test t9 Compact -drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14; -alter table t1 key_block_size=0; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0. -alter table t1 row_format=dynamic; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Dynamic -alter table t1 row_format=compact; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Compact -alter table t1 row_format=redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Redundant -drop table t1; -create table t1(a int not null, b text, index(b(10))) engine=innodb -key_block_size=1; -create table t2(b text)engine=innodb; -insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000))); -insert into t1 select 1, b from t2; -commit; -begin; -update t1 set b=repeat('B',100); -select a,left(b,40) from t1 natural join t2; -a left(b,40) -1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA -rollback; -select a,left(b,40) from t1 natural join t2; -a left(b,40) -1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Compressed -test t2 Compact -drop table t1,t2; -SET SESSION innodb_strict_mode = off; -CREATE TABLE t1( -c TEXT NOT NULL, d TEXT NOT NULL, -PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs -CREATE TABLE t1( -c TEXT NOT NULL, d TEXT NOT NULL, -PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII; -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs -CREATE TABLE t1( -c TEXT NOT NULL, d TEXT NOT NULL, -PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII; -drop table t1; -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); -DROP TABLE t1; -create table t1( c1 int not null, c2 blob, c3 blob, c4 blob, -primary key(c1, c2(22), c3(22))) -engine = innodb row_format = dynamic; -begin; -insert into t1 values(1, repeat('A', 20000), repeat('B', 20000), -repeat('C', 20000)); -update t1 set c3 = repeat('D', 20000) where c1 = 1; -commit; -select count(*) from t1 where c2 = repeat('A', 20000); -count(*) -1 -select count(*) from t1 where c3 = repeat('D', 20000); -count(*) -1 -select count(*) from t1 where c4 = repeat('C', 20000); -count(*) -1 -update t1 set c3 = repeat('E', 20000) where c1 = 1; -drop table t1; -set global innodb_file_format=`0`; -select @@innodb_file_format; -@@innodb_file_format -Antelope -set global innodb_file_format=`1`; -select @@innodb_file_format; -@@innodb_file_format -Barracuda -set global innodb_file_format=`2`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=`-1`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=`Antelope`; -set global innodb_file_format=`Barracuda`; -set global innodb_file_format=`Cheetah`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=`abc`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=`1a`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=``; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_per_table = on; -set global innodb_file_format = `1`; -set innodb_strict_mode = off; -create table t1 (id int primary key) engine = innodb key_block_size = 0; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0. -drop table t1; -set innodb_strict_mode = on; -create table t1 (id int primary key) engine = innodb key_block_size = 0; -ERROR HY000: Can't create table 'test.t1' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16] -Error 1005 Can't create table 'test.t1' (errno: 1478) -create table t2 (id int primary key) engine = innodb key_block_size = 9; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t3 (id int primary key) engine = innodb key_block_size = 1; -create table t4 (id int primary key) engine = innodb key_block_size = 2; -create table t5 (id int primary key) engine = innodb key_block_size = 4; -create table t6 (id int primary key) engine = innodb key_block_size = 8; -create table t7 (id int primary key) engine = innodb key_block_size = 16; -create table t8 (id int primary key) engine = innodb row_format = compressed; -create table t9 (id int primary key) engine = innodb row_format = dynamic; -create table t10(id int primary key) engine = innodb row_format = compact; -create table t11(id int primary key) engine = innodb row_format = redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t10 Compact -test t11 Redundant -test t3 Compressed -test t4 Compressed -test t5 Compressed -test t6 Compressed -test t7 Compressed -test t8 Compressed -test t9 Dynamic -drop table t3, t4, t5, t6, t7, t8, t9, t10, t11; -create table t1 (id int primary key) engine = innodb -key_block_size = 8 row_format = compressed; -create table t2 (id int primary key) engine = innodb -key_block_size = 8 row_format = redundant; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t3 (id int primary key) engine = innodb -key_block_size = 8 row_format = compact; -ERROR HY000: Can't create table 'test.t3' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t3' (errno: 1478) -create table t4 (id int primary key) engine = innodb -key_block_size = 8 row_format = dynamic; -ERROR HY000: Can't create table 'test.t4' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t4' (errno: 1478) -create table t5 (id int primary key) engine = innodb -key_block_size = 8 row_format = default; -ERROR HY000: Can't create table 'test.t5' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t5' (errno: 1478) -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Compressed -drop table t1; -create table t1 (id int primary key) engine = innodb -key_block_size = 9 row_format = redundant; -ERROR HY000: Can't create table 'test.t1' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t1' (errno: 1478) -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = compact; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = dynamic; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t2' (errno: 1478) -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -set global innodb_file_per_table = off; -create table t1 (id int primary key) engine = innodb key_block_size = 1; -ERROR HY000: Can't create table 'test.t1' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t1' (errno: 1478) -create table t2 (id int primary key) engine = innodb key_block_size = 2; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t3 (id int primary key) engine = innodb key_block_size = 4; -ERROR HY000: Can't create table 'test.t3' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t3' (errno: 1478) -create table t4 (id int primary key) engine = innodb key_block_size = 8; -ERROR HY000: Can't create table 'test.t4' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t4' (errno: 1478) -create table t5 (id int primary key) engine = innodb key_block_size = 16; -ERROR HY000: Can't create table 'test.t5' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t5' (errno: 1478) -create table t6 (id int primary key) engine = innodb row_format = compressed; -ERROR HY000: Can't create table 'test.t6' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. -Error 1005 Can't create table 'test.t6' (errno: 1478) -create table t7 (id int primary key) engine = innodb row_format = dynamic; -ERROR HY000: Can't create table 'test.t7' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. -Error 1005 Can't create table 'test.t7' (errno: 1478) -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t8 Compact -test t9 Redundant -drop table t8, t9; -set global innodb_file_per_table = on; -set global innodb_file_format = `0`; -create table t1 (id int primary key) engine = innodb key_block_size = 1; -ERROR HY000: Can't create table 'test.t1' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t1' (errno: 1478) -create table t2 (id int primary key) engine = innodb key_block_size = 2; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t3 (id int primary key) engine = innodb key_block_size = 4; -ERROR HY000: Can't create table 'test.t3' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t3' (errno: 1478) -create table t4 (id int primary key) engine = innodb key_block_size = 8; -ERROR HY000: Can't create table 'test.t4' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t4' (errno: 1478) -create table t5 (id int primary key) engine = innodb key_block_size = 16; -ERROR HY000: Can't create table 'test.t5' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t5' (errno: 1478) -create table t6 (id int primary key) engine = innodb row_format = compressed; -ERROR HY000: Can't create table 'test.t6' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t6' (errno: 1478) -create table t7 (id int primary key) engine = innodb row_format = dynamic; -ERROR HY000: Can't create table 'test.t7' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t7' (errno: 1478) -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t8 Compact -test t9 Redundant -drop table t8, t9; -set global innodb_file_per_table=0; -set global innodb_file_format=Antelope; -set global innodb_file_per_table=on; -set global innodb_file_format=`Barracuda`; -set global innodb_file_format_check=`Antelope`; -create table normal_table ( -c1 int -) engine = innodb; -select @@innodb_file_format_check; -@@innodb_file_format_check -Antelope -create table zip_table ( -c1 int -) engine = innodb key_block_size = 8; -select @@innodb_file_format_check; -@@innodb_file_format_check -Barracuda -set global innodb_file_format_check=`Antelope`; -select @@innodb_file_format_check; -@@innodb_file_format_check -Antelope -show table status; -select @@innodb_file_format_check; -@@innodb_file_format_check -Barracuda -drop table normal_table, zip_table; diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index 314b7656322..fe579431420 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -336,8 +336,7 @@ test.t1 check status OK DROP TABLE t1,t2; set global key_cache_block_size= @my_key_cache_block_size; set @@global.key_buffer_size=0; -Warnings: -Warning 1438 Cannot drop default keycache +ERROR HY000: Cannot drop default keycache select @@global.key_buffer_size; @@global.key_buffer_size 2097152 diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result index d8768e802ea..3fc4de3da06 100644 --- a/mysql-test/r/lock_multi.result +++ b/mysql-test/r/lock_multi.result @@ -162,13 +162,6 @@ ERROR 70100: Query execution was interrupted unlock tables; drop table t1; drop table if exists t1; -create table t1 (a int) ENGINE=MEMORY; ---> client 2 -handler t1 open; -ERROR HY000: Table storage engine for 't1' doesn't have this option ---> client 1 -drop table t1; -drop table if exists t1; create table t1 (i int); connection: default lock tables t1 write; diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index cee912ffb2e..c6eaf9b6625 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -899,6 +899,16 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1 TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2 DROP TABLE t1; TRUNCATE TABLE mysql.slow_log; +use mysql; +drop table if exists renamed_general_log; +drop table if exists renamed_slow_log; +RENAME TABLE general_log TO renamed_general_log; +ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log' +RENAME TABLE slow_log TO renamed_slow_log; +ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'slow_log' +use test; +flush tables with read lock; +unlock tables; SET @@session.long_query_time= @old_long_query_time; SET @@global.log_output= @old_log_output; SET @@global.slow_query_log= @old_slow_query_log; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 717437a0532..289be98c1b5 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -2022,6 +2022,8 @@ SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='tm1'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT NULL test tm1 BASE TABLE NULL NULL NULL # # # # # # # # # # NULL # # Unable to open underlying table which is differently defined or of non-MyISAM ty +Warnings: +Warning 1168 Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist DROP TABLE tm1; CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM; CREATE TABLE t2(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index d77ad1d2953..df3d7be6714 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -659,4 +659,15 @@ Error 1242 Subquery returns more than 1 row Error 1242 Subquery returns more than 1 row DROP TABLE t1, t2, t3; SET SESSION sql_safe_updates = DEFAULT; +# +# Bug#52157 various crashes and assertions with multi-table update, stored function +# +CREATE FUNCTION f1 () RETURNS BLOB RETURN 1; +CREATE TABLE t1 (f1 DATE); +INSERT INTO t1 VALUES('2001-01-01'); +UPDATE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1; +Warnings: +Warning 1292 Truncated incorrect datetime value: '1' +DROP FUNCTION f1; +DROP TABLE t1; end of tests diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 68f30ed80f8..f4298cc7a4c 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -235,4 +235,73 @@ Bug #47147: mysql client option --skip-column-names does not apply to vertical o *************************** 1. row *************************** 1 +# +# Bug #54899: --one-database option cannot handle DROP/CREATE DATABASE +# commands. +# +CREATE DATABASE connected_db; +USE connected_db; +SHOW TABLES; +Tables_in_connected_db +table_in_connected_db +DROP DATABASE connected_db; + +# +# Testing --one-database option +# +CREATE DATABASE connected_db; +SHOW TABLES IN connected_db; +Tables_in_connected_db +t1 +SHOW TABLES IN test; +Tables_in_test +t1 +USE test; +DROP TABLE t1; +DROP DATABASE connected_db; + +SHOW TABLES IN test; +Tables_in_test +SHOW TABLES IN test1; +Tables_in_test1 +DROP DATABASE test1; + +# +# Checking --one-database option followed by the execution of +# connect command. +# +CREATE DATABASE connected_db; +SHOW TABLES IN connected_db; +Tables_in_connected_db +t1 +t2 +SHOW TABLES IN test; +Tables_in_test +t1 +t2 +DROP TABLE test.t1; +DROP TABLE test.t2; +DROP DATABASE connected_db; + +# +# Checking --one-database option with no database specified +# at command-line. +# +SHOW TABLES IN test; +Tables_in_test + +# +# Checking --one-database option with non_existent_db +# specified with USE command +# +CREATE DATABASE connected_db; +SHOW TABLES IN connected_db; +Tables_in_connected_db +table_in_connected_db + +SHOW TABLES IN connected_db; +Tables_in_connected_db +table_in_connected_db +DROP DATABASE connected_db; + End of tests diff --git a/mysql-test/r/mysqlbinlog-innodb.result b/mysql-test/r/mysqlbinlog-innodb.result new file mode 100644 index 00000000000..d9f83fb89f0 --- /dev/null +++ b/mysql-test/r/mysqlbinlog-innodb.result @@ -0,0 +1,85 @@ +SET TIMESTAMP=1000000000; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; +CREATE DATABASE test2; +RESET MASTER; +USE test2; +BEGIN; +USE test; +INSERT INTO t1 VALUES (1); +USE test2; +COMMIT; +BEGIN; +USE test; +INSERT INTO t1 VALUES (2); +USE test2; +COMMIT; +USE test; +SELECT * FROM t1 ORDER BY a; +a +1 +2 +FLUSH LOGS; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; +SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +BEGIN +/*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +INSERT INTO t1 VALUES (1) +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=1000000000/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=1000000000/*!*/; +INSERT INTO t1 VALUES (2) +/*!*/; +COMMIT/*!*/; +DELIMITER ; +# 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*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; +SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +BEGIN +/*!*/; +use foo/*!*/; +SET TIMESTAMP=1000000000/*!*/; +INSERT INTO t1 VALUES (1) +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=1000000000/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=1000000000/*!*/; +INSERT INTO t1 VALUES (2) +/*!*/; +COMMIT/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +DROP DATABASE test2; +DROP TABLE t1; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 010f7a17d57..7e228792b0d 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -637,3 +637,23 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; End of 5.0 tests End of 5.1 tests +RESET MASTER; +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1(id int); +DROP DATABASE test1; +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1(id int); +DROP TABLE t1; +DROP DATABASE test1; +FLUSH LOGS; +show binlog events in 'master-bin.000002' from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Query # # CREATE DATABASE test1 +master-bin.000002 # Query # # use `test1`; CREATE TABLE t1(id int) +master-bin.000002 # Query # # DROP DATABASE test1 +master-bin.000002 # Query # # CREATE DATABASE test1 +master-bin.000002 # Query # # use `test1`; CREATE TABLE t1(id int) +master-bin.000002 # Query # # use `test1`; DROP TABLE t1 +master-bin.000002 # Query # # DROP DATABASE test1 diff --git a/mysql-test/r/mysqldump_restore.result b/mysql-test/r/mysqldump_restore.result index 16698251913..9eac8b253de 100644 --- a/mysql-test/r/mysqldump_restore.result +++ b/mysql-test/r/mysqldump_restore.result @@ -20,7 +20,7 @@ ALTER TABLE test.t1 RENAME to test.t1_orig; # Compare original and recreated tables # Recreated table: test.t1 # Original table: test.t1_orig -Comparing tables test.t1 and test.t1_orig +include/diff_tables.inc [test.t1, test.t1_orig] # Cleanup DROP TABLE test.t1, test.t1_orig; # @@ -45,7 +45,7 @@ ALTER TABLE test.t1 RENAME to test.t1_orig; # Compare original and recreated tables # Recreated table: test.t1 # Original table: test.t1_orig -Comparing tables test.t1 and test.t1_orig +include/diff_tables.inc [test.t1, test.t1_orig] # Cleanup DROP TABLE test.t1, test.t1_orig; # @@ -63,7 +63,7 @@ ALTER TABLE test.t1 RENAME to test.t1_orig; # Compare original and recreated tables # Recreated table: test.t1 # Original table: test.t1_orig -Comparing tables test.t1 and test.t1_orig +include/diff_tables.inc [test.t1, test.t1_orig] # Cleanup DROP TABLE test.t1, test.t1_orig; # @@ -82,7 +82,7 @@ ALTER TABLE test.t2 RENAME to test.t2_orig; # Compare original and recreated tables # Recreated table: test.t2 # Original table: test.t2_orig -Comparing tables test.t2 and test.t2_orig +include/diff_tables.inc [test.t2, test.t2_orig] # Cleanup DROP TABLE test.t2, test.t2_orig; DROP TABLE t1; @@ -100,7 +100,7 @@ ALTER TABLE test.t1 RENAME to test.t1_orig; # Compare original and recreated tables # Recreated table: test.t1 # Original table: test.t1_orig -Comparing tables test.t1 and test.t1_orig +include/diff_tables.inc [test.t1, test.t1_orig] # Cleanup DROP TABLE test.t1, test.t1_orig; # End tests diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index edb1ec72070..6de116b4d7a 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -309,6 +309,10 @@ var3 two columns with same name var4 from query that returns NULL var5 from query that returns no row failing query in let +create table t1 (a varchar(100)); +insert into t1 values ('`select 42`'); +`select 42` +drop table t1; mysqltest: At line 1: Error running query 'failing query': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1 mysqltest: At line 1: Missing required argument 'filename' to command 'source' mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2 @@ -399,7 +403,9 @@ true-inner true-inner again true-outer Counter is greater than 0, (counter=10) +Counter should still be 10, is 10 Counter is not 0, (counter=0) +Not space var works Counter is true, (counter=alpha) Beta is true while with string, only once @@ -586,7 +592,7 @@ if things work as expected Some data for cat_file command of mysqltest -mysqltest: At line 1: command "cat_file" failed with error 1 +mysqltest: At line 1: command "cat_file" failed with error: 1 my_errno: 2 errno: 2 mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists' mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file' mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file' @@ -799,7 +805,7 @@ drop table t1; mysqltest: At line 1: change user failed: Unknown database 'inexistent' mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO) mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES) -file1.txt +REPLACED_FILE1.txt file1.txt file2.txt file11.txt diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 8e65557d690..27ada9d1129 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1778,7 +1778,7 @@ c1 bigint, c2 set('sweet'), key (c2,c1,c0), key(c0) -) engine=myisam partition by hash (month(c0)) partitions 5; +) engine=myisam partition by hash (c0) partitions 5; insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019; insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644; select c1 from t1 group by (select c0 from t1 limit 1); diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index ea74f476ceb..0426ce42071 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -1,5 +1,643 @@ drop table if exists t1; # +# Bug#54483: valgrind errors when making warnings for multiline inserts +# into partition +# +CREATE TABLE t1 (a VARBINARY(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a CHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIMESTAMP) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 +SHOW WARNINGS; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +SHOW WARNINGS; +Level Code Message +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +DROP TABLE t1; +CREATE TABLE t1 (a TIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +SHOW WARNINGS; +Level Code Message +Error 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFMONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFMONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFMONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFYEAR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFYEAR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFYEAR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (HOUR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (HOUR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (HOUR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MINUTE(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MINUTE(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MINUTE(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (QUARTER(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (QUARTER(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (QUARTER(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (SECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (SECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (SECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (YEARWEEK(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (YEARWEEK(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (YEARWEEK(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (WEEKDAY(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (WEEKDAY(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (WEEKDAY(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# TO_SECONDS() is added in 5.5. +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_SECONDS(a)); +ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2 +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: The PARTITION function returns the wrong type +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: The PARTITION function returns the wrong type +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MICROSECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MICROSECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MICROSECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# Bug#57071 +CREATE TABLE t1 +(`date` date, +`extracted_week` int, +`yearweek` int, +`week` int, +`default_week_format` int) +PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3) +(PARTITION p0 VALUES IN (0), +PARTITION p1 VALUES IN (1), +PARTITION p2 VALUES IN (2)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 +(`date` date, +`extracted_week` int, +`yearweek` int, +`week` int, +`default_week_format` int); +SET @old_default_week_format := @@default_week_format; +SET default_week_format = 0; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 1; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 2; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 3; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 4; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 5; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 6; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 7; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SELECT * FROM t1; +date extracted_week yearweek week default_week_format +2000-01-01 0 199952 0 0 +2000-01-01 0 199952 0 1 +2000-01-01 52 199952 52 2 +2000-01-01 52 199952 52 3 +2000-01-01 0 199952 0 4 +2000-01-01 0 199952 0 5 +2000-01-01 52 199952 52 6 +2000-01-01 52 199952 52 7 +SET default_week_format = @old_default_week_format; +DROP TABLE t1; +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# EXTRACT(WEEK...) is disallowed, see bug#57071. +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE, b VARCHAR(10)) +PARTITION BY HASH (DATEDIFF(a, b)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) # CREATE TABLE t1 (a INT) PARTITION BY HASH (a); diff --git a/mysql-test/r/partition_federated.result b/mysql-test/r/partition_federated.result deleted file mode 100644 index 2d98e366c95..00000000000 --- a/mysql-test/r/partition_federated.result +++ /dev/null @@ -1,6 +0,0 @@ -drop table if exists t1; -create table t1 (s1 int) engine=federated -connection='mysql://root@localhost/federated/t1' partition by list (s1) -(partition p1 values in (1), partition p2 values in (2)); -ERROR HY000: Engine cannot be used in partitioned tables -End of 5.1 tests diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result index dd91eee316a..f6b5ce84338 100644 --- a/mysql-test/r/partition_innodb_plugin.result +++ b/mysql-test/r/partition_innodb_plugin.result @@ -1,3 +1,76 @@ +call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal"); +# +# Bug#55091: Server crashes on ADD PARTITION after a failed attempt +# +SET @old_innodb_file_format_check = @@global.innodb_file_format_check; +SET @old_innodb_file_format = @@global.innodb_file_format; +SET @old_innodb_file_per_table = @@global.innodb_file_per_table; +SET @old_innodb_strict_mode = @@global.innodb_strict_mode; +SET @@global.innodb_file_format = Barracuda, +@@global.innodb_file_per_table = ON, +@@global.innodb_strict_mode = ON; +# Connection con1 +CREATE TABLE t1 (id INT NOT NULL +PRIMARY KEY, +user_num CHAR(10) +) ENGINE = InnoDB +KEY_BLOCK_SIZE=4 +PARTITION BY HASH(id) PARTITIONS 1; +t1#P#p0.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `user_num` char(10) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +/*!50100 PARTITION BY HASH (id) +PARTITIONS 1 */ +SET GLOBAL innodb_file_per_table = OFF; +# Connection con2 +LOCK TABLE t1 WRITE; +# ALTER fails because COMPRESSED/KEY_BLOCK_SIZE +# are incompatible with innodb_file_per_table = OFF; +ALTER TABLE t1 ADD PARTITION PARTITIONS 1; +ERROR HY000: Got error 1478 from storage engine +t1#P#p0.ibd +t1.frm +t1.par +# This SET is not needed to reproduce the bug, +# it is here just to make the test case more realistic +SET innodb_strict_mode = OFF; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +t1.frm +t1.par +ALTER TABLE t1 REBUILD PARTITION p0; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +UNLOCK TABLES; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `user_num` char(10) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +/*!50100 PARTITION BY HASH (id) +PARTITIONS 3 */ +DROP TABLE t1; +# Connection default +SET @@global.innodb_strict_mode = @old_innodb_strict_mode; +SET @@global.innodb_file_format = @old_innodb_file_format; +SET @@global.innodb_file_per_table = @old_innodb_file_per_table; +SET @@global.innodb_file_format_check = @old_innodb_file_format_check; SET NAMES utf8; CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a)) ENGINE=InnoDB diff --git a/mysql-test/r/plugin_not_embedded.result b/mysql-test/r/plugin_not_embedded.result index 82cfe7b23b8..27553366660 100644 --- a/mysql-test/r/plugin_not_embedded.result +++ b/mysql-test/r/plugin_not_embedded.result @@ -8,3 +8,5 @@ ERROR 42000: DELETE command denied to user 'bug51770'@'localhost' for table 'plu GRANT DELETE ON mysql.plugin TO bug51770@localhost; UNINSTALL PLUGIN example; DROP USER bug51770@localhost; +INSTALL PLUGIN example SONAME '../ha_example.so'; +ERROR HY000: No paths allowed for shared library diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index c1aa5704f56..f8df72c6709 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4796,4 +4796,83 @@ SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; 1 1 DROP TABLE t1; +# +# Bug #702310: usage of 2 join buffers after ref access to an empty table +# +CREATE TABLE t1 (f1 int) ; +INSERT INTO t1 VALUES (9); +CREATE TABLE t2 (f1 int); +INSERT INTO t2 VALUES (3),(7),(18); +INSERT INTO t2 VALUES (3),(7),(18); +INSERT INTO t2 VALUES (3),(7),(18); +INSERT INTO t2 VALUES (3),(7),(18); +CREATE TABLE t3 (f1 int); +INSERT INTO t3 VALUES (17); +CREATE TABLE t4 (f1 int PRIMARY KEY, f2 varchar(1024)) ; +CREATE TABLE t5 (f1 int) ; +INSERT INTO t5 VALUES (20),(5); +CREATE TABLE t6(f1 int); +INSERT INTO t6 VALUES (9),(7); +SET SESSION join_buffer_size = 9000; +EXPLAIN +SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 ALL NULL NULL NULL NULL 12 +1 SIMPLE t3 ALL NULL NULL NULL NULL 1 +1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 const 1 +1 SIMPLE t5 ALL NULL NULL NULL NULL 2 Using join buffer +1 SIMPLE t6 ALL NULL NULL NULL NULL 2 Using join buffer +SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; +f1 f1 f1 f1 f2 f1 f1 +3 9 NULL NULL NULL 20 9 +7 9 NULL NULL NULL 20 9 +18 9 NULL NULL NULL 20 9 +3 9 NULL NULL NULL 20 9 +7 9 NULL NULL NULL 20 9 +18 9 NULL NULL NULL 20 9 +3 9 NULL NULL NULL 20 9 +3 9 NULL NULL NULL 20 7 +7 9 NULL NULL NULL 20 7 +18 9 NULL NULL NULL 20 7 +3 9 NULL NULL NULL 20 7 +7 9 NULL NULL NULL 20 7 +18 9 NULL NULL NULL 20 7 +3 9 NULL NULL NULL 20 7 +3 9 NULL NULL NULL 5 9 +7 9 NULL NULL NULL 5 9 +18 9 NULL NULL NULL 5 9 +3 9 NULL NULL NULL 5 9 +7 9 NULL NULL NULL 5 9 +18 9 NULL NULL NULL 5 9 +3 9 NULL NULL NULL 5 9 +3 9 NULL NULL NULL 5 7 +7 9 NULL NULL NULL 5 7 +18 9 NULL NULL NULL 5 7 +3 9 NULL NULL NULL 5 7 +7 9 NULL NULL NULL 5 7 +18 9 NULL NULL NULL 5 7 +3 9 NULL NULL NULL 5 7 +7 9 NULL NULL NULL 20 9 +18 9 NULL NULL NULL 20 9 +3 9 NULL NULL NULL 20 9 +7 9 NULL NULL NULL 20 9 +18 9 NULL NULL NULL 20 9 +7 9 NULL NULL NULL 5 9 +18 9 NULL NULL NULL 5 9 +7 9 NULL NULL NULL 20 7 +18 9 NULL NULL NULL 20 7 +3 9 NULL NULL NULL 20 7 +7 9 NULL NULL NULL 20 7 +18 9 NULL NULL NULL 20 7 +7 9 NULL NULL NULL 5 7 +18 9 NULL NULL NULL 5 7 +3 9 NULL NULL NULL 5 9 +7 9 NULL NULL NULL 5 9 +18 9 NULL NULL NULL 5 9 +3 9 NULL NULL NULL 5 7 +7 9 NULL NULL NULL 5 7 +18 9 NULL NULL NULL 5 7 +SET SESSION join_buffer_size = DEFAULT; +DROP TABLE t1,t2,t3,t4,t5,t6; End of 5.1 tests diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index c1aa5704f56..f8df72c6709 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -4796,4 +4796,83 @@ SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; 1 1 DROP TABLE t1; +# +# Bug #702310: usage of 2 join buffers after ref access to an empty table +# +CREATE TABLE t1 (f1 int) ; +INSERT INTO t1 VALUES (9); +CREATE TABLE t2 (f1 int); +INSERT INTO t2 VALUES (3),(7),(18); +INSERT INTO t2 VALUES (3),(7),(18); +INSERT INTO t2 VALUES (3),(7),(18); +INSERT INTO t2 VALUES (3),(7),(18); +CREATE TABLE t3 (f1 int); +INSERT INTO t3 VALUES (17); +CREATE TABLE t4 (f1 int PRIMARY KEY, f2 varchar(1024)) ; +CREATE TABLE t5 (f1 int) ; +INSERT INTO t5 VALUES (20),(5); +CREATE TABLE t6(f1 int); +INSERT INTO t6 VALUES (9),(7); +SET SESSION join_buffer_size = 9000; +EXPLAIN +SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 ALL NULL NULL NULL NULL 12 +1 SIMPLE t3 ALL NULL NULL NULL NULL 1 +1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 const 1 +1 SIMPLE t5 ALL NULL NULL NULL NULL 2 Using join buffer +1 SIMPLE t6 ALL NULL NULL NULL NULL 2 Using join buffer +SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; +f1 f1 f1 f1 f2 f1 f1 +3 9 NULL NULL NULL 20 9 +7 9 NULL NULL NULL 20 9 +18 9 NULL NULL NULL 20 9 +3 9 NULL NULL NULL 20 9 +7 9 NULL NULL NULL 20 9 +18 9 NULL NULL NULL 20 9 +3 9 NULL NULL NULL 20 9 +3 9 NULL NULL NULL 20 7 +7 9 NULL NULL NULL 20 7 +18 9 NULL NULL NULL 20 7 +3 9 NULL NULL NULL 20 7 +7 9 NULL NULL NULL 20 7 +18 9 NULL NULL NULL 20 7 +3 9 NULL NULL NULL 20 7 +3 9 NULL NULL NULL 5 9 +7 9 NULL NULL NULL 5 9 +18 9 NULL NULL NULL 5 9 +3 9 NULL NULL NULL 5 9 +7 9 NULL NULL NULL 5 9 +18 9 NULL NULL NULL 5 9 +3 9 NULL NULL NULL 5 9 +3 9 NULL NULL NULL 5 7 +7 9 NULL NULL NULL 5 7 +18 9 NULL NULL NULL 5 7 +3 9 NULL NULL NULL 5 7 +7 9 NULL NULL NULL 5 7 +18 9 NULL NULL NULL 5 7 +3 9 NULL NULL NULL 5 7 +7 9 NULL NULL NULL 20 9 +18 9 NULL NULL NULL 20 9 +3 9 NULL NULL NULL 20 9 +7 9 NULL NULL NULL 20 9 +18 9 NULL NULL NULL 20 9 +7 9 NULL NULL NULL 5 9 +18 9 NULL NULL NULL 5 9 +7 9 NULL NULL NULL 20 7 +18 9 NULL NULL NULL 20 7 +3 9 NULL NULL NULL 20 7 +7 9 NULL NULL NULL 20 7 +18 9 NULL NULL NULL 20 7 +7 9 NULL NULL NULL 5 7 +18 9 NULL NULL NULL 5 7 +3 9 NULL NULL NULL 5 9 +7 9 NULL NULL NULL 5 9 +18 9 NULL NULL NULL 5 9 +3 9 NULL NULL NULL 5 7 +7 9 NULL NULL NULL 5 7 +18 9 NULL NULL NULL 5 7 +SET SESSION join_buffer_size = DEFAULT; +DROP TABLE t1,t2,t3,t4,t5,t6; End of 5.1 tests diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 31c612500d9..b7697eb6563 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -658,6 +658,8 @@ flush tables; SHOW TABLE STATUS like 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm' +Warnings: +Warning 1033 Incorrect information in file: './test/t1.frm' show create table t1; ERROR HY000: Incorrect information in file: './test/t1.frm' drop table if exists t1; diff --git a/mysql-test/r/sp-bugs.result b/mysql-test/r/sp-bugs.result index 2374b433fba..507c73c2683 100644 --- a/mysql-test/r/sp-bugs.result +++ b/mysql-test/r/sp-bugs.result @@ -73,4 +73,40 @@ CALL p1 (); ERROR HY000: Trigger does not exist DROP TABLE t1; DROP PROCEDURE p1; +# +# Bug#54375: Error in stored procedure leaves connection +# in different default schema +# +SET @@SQL_MODE = 'STRICT_ALL_TABLES'; +DROP DATABASE IF EXISTS db1; +CREATE DATABASE db1; +USE db1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES (1); +CREATE FUNCTION f1 ( +some_value int +) +RETURNS smallint +DETERMINISTIC +BEGIN +INSERT INTO t1 SET c1 = some_value; +RETURN(LAST_INSERT_ID()); +END$$ +DROP DATABASE IF EXISTS db2; +CREATE DATABASE db2; +USE db2; +SELECT DATABASE(); +DATABASE() +db2 +SELECT db1.f1(1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT DATABASE(); +DATABASE() +db2 +USE test; +DROP FUNCTION db1.f1; +DROP TABLE db1.t1; +DROP DATABASE db1; +DROP DATABASE db2; End of 5.1 tests diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 6d8cb7f5b9a..6710b8fc941 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4749,4 +4749,15 @@ sum(a) sub 1 3 deallocate prepare stmt1; drop table t1,t2; +# +# Bug LP#693935/#58727: Assertion failure with +# a single row subquery returning more than one row +# +create table t1 (a char(1) charset utf8); +insert into t1 values ('a'), ('b'); +create table t2 (a binary(1)); +insert into t2 values ('x'), ('y'); +select * from t2 where a=(select a from t1) and a='x'; +ERROR 21000: Subquery returns more than 1 row +drop table t1,t2; End of 5.1 tests diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 50c0d14968a..8385ee6f4c0 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -186,5 +186,16 @@ a b 2 NULL DROP TABLE t1, t2, t3, t4, t5; # +# Bug#58207: invalid memory reads when using default column value and +# tmptable needed +# +CREATE TABLE t(a VARCHAR(245) DEFAULT +'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),(''); +SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d; +default(a) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t; +# # End of 5.1 tests. # diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result index 395b0be7e34..6c713946b27 100644 --- a/mysql-test/r/table_elim.result +++ b/mysql-test/r/table_elim.result @@ -535,3 +535,34 @@ HAVING field4 != 6; field1 field2 field3 field4 field5 field6 drop table t0,t1,t2,t3,t4,t5,t6; +# +# BUG#675118: Elimination of a table results in an invalid execution plan +# +CREATE TABLE t1 (f1 int(11), PRIMARY KEY (f1)) ; +CREATE TABLE t2 (f4 varchar(1024), KEY (f4)) ; +Warnings: +Warning 1071 Specified key was too long; max key length is 1000 bytes +INSERT IGNORE INTO t2 VALUES ('xcddwntkbxyorzdv'), +('cnxxcddwntkbxyor'),('r'),('r'), ('did'),('I'),('when'), +('hczkfqjeggivdvac'),('e'),('okay'),('up'); +CREATE TABLE t3 (f4 varchar(1024), f1 int(11), f2 int(11)) ; +INSERT IGNORE INTO t3 VALUES ('f','4','0'),('n','5','-996540416'); +CREATE TABLE t4 (f1 int(11), f3 varchar(10)) ; +INSERT IGNORE INTO t4 VALUES ('8','n'),('9','nwzcerzsgx'),('10','c'); +CREATE TABLE t5 (f5 int(11), KEY (f5)) ; +EXPLAIN +SELECT t3.f2 +FROM t2 +LEFT JOIN t3 +LEFT JOIN t4 +LEFT JOIN t1 ON t4.f1 = t1.f1 +JOIN t5 ON t4.f3 ON t3.f1 = t5.f5 ON t2.f4 = t3.f4 +WHERE t3.f2 ; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t5 ref f5 f5 5 test.t3.f1 2 Using index +1 SIMPLE t4 ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 ALL f4 NULL NULL NULL 11 Using where; Using join buffer +# ^^ The above must not produce a QEP of t3,t5,t2,t4 +# as that violates the "no interleaving of outer join nests" rule. +DROP TABLE t1,t2,t3,t4,t5; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 08c30d884fd..e6fd49b4247 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -974,3 +974,14 @@ ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967 explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) End of 5.0 tests +# Bug #52160: crash and inconsistent results when grouping +# by a function and column +CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1; +CREATE TABLE t1(a CHAR(1)); +INSERT INTO t1 VALUES ('0'), ('0'); +SELECT COUNT(*) FROM t1 GROUP BY f1(), a; +COUNT(*) +2 +DROP FUNCTION f1; +DROP TABLE t1; +End of 5.1 tests diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result index 8948214f565..2dc491c6166 100644 --- a/mysql-test/r/type_year.result +++ b/mysql-test/r/type_year.result @@ -341,4 +341,18 @@ ta_y s tb_y s 2001 2001 2001 2001 DROP TABLE t1; # +# Bug #59211: Select Returns Different Value for min(year) Function +# +CREATE TABLE t1(c1 YEAR(4)); +INSERT INTO t1 VALUES (1901),(2155),(0000); +SELECT * FROM t1; +c1 +1901 +2155 +0000 +SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1; +total_rows min_value MAX(c1) +3 0 2155 +DROP TABLE t1; +# End of 5.1 tests diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 56266a46e20..374520ff610 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -447,4 +447,13 @@ IF( count(*), 1) 1 DROP TABLE t1; +select @v:=@v:=sum(1) from dual; +@v:=@v:=sum(1) +1 +CREATE TABLE t1(a DECIMAL(31,21)); +INSERT INTO t1 VALUES (0); +SELECT (@v:=a) <> (@v:=1) FROM t1; +(@v:=a) <> (@v:=1) +1 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/variables-big.result b/mysql-test/r/variables-big.result index 960fc6d22f4..71b32393d82 100644 --- a/mysql-test/r/variables-big.result +++ b/mysql-test/r/variables-big.result @@ -1,20 +1,20 @@ SET SESSION transaction_prealloc_size=1024*1024*1024*1; SHOW PROCESSLIST; Id User Host db Command Time State Info -<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST +<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST SET SESSION transaction_prealloc_size=1024*1024*1024*2; SHOW PROCESSLIST; Id User Host db Command Time State Info -<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST +<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST SET SESSION transaction_prealloc_size=1024*1024*1024*3; SHOW PROCESSLIST; Id User Host db Command Time State Info -<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST +<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST SET SESSION transaction_prealloc_size=1024*1024*1024*4; SHOW PROCESSLIST; Id User Host db Command Time State Info -<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST +<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST SET SESSION transaction_prealloc_size=1024*1024*1024*5; SHOW PROCESSLIST; Id User Host db Command Time State Info -<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST +<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 832c679f8d5..822d866cf65 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -1501,4 +1501,37 @@ SELECT @@skip_name_resolve; SHOW VARIABLES LIKE 'skip_name_resolve'; Variable_name Value skip_name_resolve OFF +# +# Bug #43233 : Some server variables are clipped during "update," +# not "check" stage +# +SET @kbs=@@global.key_buffer_size; +SET @kcbs=@@global.key_cache_block_size; +throw errors in STRICT mode +SET SQL_MODE=STRICT_ALL_TABLES; +SET @@global.max_binlog_cache_size=-1; +ERROR 42000: Variable 'max_binlog_cache_size' can't be set to the value of '-1' +SET @@global.max_join_size=0; +ERROR 42000: Variable 'max_join_size' can't be set to the value of '0' +SET @@global.key_buffer_size=0; +ERROR HY000: Cannot drop default keycache +SET @@global.key_cache_block_size=0; +ERROR 42000: Variable 'key_cache_block_size' can't be set to the value of '0' +throw warnings in default mode +SET SQL_MODE=DEFAULT; +SET @@global.max_binlog_cache_size=-1; +Warnings: +Warning 1292 Truncated incorrect max_binlog_cache_size value: '-1' +SET @@global.max_join_size=0; +Warnings: +Warning 1292 Truncated incorrect max_join_size value: '0' +SET @@global.key_buffer_size=0; +ERROR HY000: Cannot drop default keycache +SET @@global.key_cache_block_size=0; +Warnings: +Warning 1292 Truncated incorrect key_cache_block_size value: '0' +SET @@global.max_binlog_cache_size=DEFAULT; +SET @@global.max_join_size=DEFAULT; +SET @@global.key_buffer_size=@kbs; +SET @@global.key_cache_block_size=@kcbs; End of 5.1 tests diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index b2065ed20d1..5341ad0bdd5 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -840,6 +840,8 @@ show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL View 'test.v1' references invalid table(s) or column(s) or function(s) or define +Warnings: +Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them drop view v1; drop table t1; create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1; @@ -3882,6 +3884,19 @@ CREATE VIEW v1 AS SELECT 1 from t1 WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); DROP VIEW v1; DROP TABLE t1; +# +# Bug#57703 create view cause Assertion failed: 0, file .\item_subselect.cc, line 846 +# +CREATE TABLE t1(a int); +CREATE VIEW v1 AS SELECT 1 FROM t1 GROUP BY +SUBSTRING(1 FROM (SELECT 3 FROM t1 WHERE a >= ANY(SELECT 1))); +DROP VIEW v1; +DROP TABLE t1; +# +# Bug#57352 valgrind warnings when creating view +# +CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f; +DROP VIEW v1; # ----------------------------------------------------------------- # -- End of 5.1 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 52c8bc8a3d5..0348a8428a5 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -1248,3 +1248,129 @@ Note 1449 The user specified as a definer ('unknown'@'unknown') does not exist LOCK TABLES v1 READ; ERROR HY000: The user specified as a definer ('unknown'@'unknown') does not exist DROP VIEW v1; +# +# Bug #58499 "DEFINER-security view selecting from INVOKER-security view +# access check wrong". +# +# Check that we correctly handle privileges for various combinations +# of INVOKER and DEFINER-security views using each other. +DROP DATABASE IF EXISTS mysqltest1; +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE TABLE t1 (i INT); +CREATE TABLE t2 (j INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (2); +# +# 1) DEFINER-security view uses INVOKER-security view (covers +# scenario originally described in the bug report). +CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2; +CREATE USER 'mysqluser1'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%'; +GRANT SELECT ON t1 TO 'mysqluser1'@'%'; +# To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%'; +# +# Connection 'mysqluser1'. +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +# +# Connection 'default'. +CREATE USER 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%'; +GRANT SELECT ON t2 TO 'mysqluser2'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%'; +# Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +# +# Connection 'mysqluser2'. +# The below statement should succeed thanks to suid nature of v2_uses_t1. +SELECT * FROM v2_uses_t1; +i +1 +# The below statement should fail due to suid nature of v2_uses_t2. +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# +# 2) INVOKER-security view uses INVOKER-security view. +# +# Connection 'default'. +DROP VIEW v2_uses_t1, v2_uses_t2; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%'; +# +# Connection 'mysqluser1'. +# For both versions of 'v2' 'mysqluser1' privileges should be used. +SELECT * FROM v2_uses_t1; +i +1 +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# +# Connection 'mysqluser2'. +# And now for both versions of 'v2' 'mysqluser2' privileges should +# be used. +SELECT * FROM v2_uses_t1; +ERROR HY000: View 'mysqltest1.v2_uses_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT * FROM v2_uses_t2; +j +2 +# +# 3) INVOKER-security view uses DEFINER-security view. +# +# Connection 'default'. +DROP VIEW v1_uses_t1, v1_uses_t2; +# To be able create 'v1_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +# +# Connection 'mysqluser1'. +CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2; +# +# Connection 'default'. +# Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +# +# Connection 'mysqluser2'. +# Due to suid nature of v1_uses_t1 and v1_uses_t2 the first +# select should succeed and the second select should fail. +SELECT * FROM v2_uses_t1; +i +1 +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# +# 4) DEFINER-security view uses DEFINER-security view. +# +# Connection 'default'. +DROP VIEW v2_uses_t1, v2_uses_t2; +# To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +# +# Connection 'mysqluser2'. +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +# +# Connection 'default'. +# Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +# +# Connection 'mysqluser2'. +# Again privileges of creator of innermost views should apply. +SELECT * FROM v2_uses_t1; +i +1 +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +USE test; +DROP DATABASE mysqltest1; +DROP USER 'mysqluser1'@'%'; +DROP USER 'mysqluser2'@'%'; diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index fad2cab0e57..92f84381415 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1093,4 +1093,24 @@ Warnings: Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT' Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT' DROP TABLE t1; +# +# Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +# +SET NAMES utf8; +SELECT REPLACE(EXTRACTVALUE('1', '/a'),'ds',''); +REPLACE(EXTRACTVALUE('1', '/a'),'ds','') + +# +# Bug #57820 extractvalue crashes +# +SELECT AVG(DISTINCT EXTRACTVALUE((''),('$@k'))); +AVG(DISTINCT EXTRACTVALUE((''),('$@k'))) +NULL +# +# Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0 +# +SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1); +ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing +SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1)); +ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing End of 5.1 tests diff --git a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result deleted file mode 100644 index 8226469fcf7..00000000000 --- a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result +++ /dev/null @@ -1,42 +0,0 @@ -SET @old_relay_log_purge= @@global.relay_log_purge; -change master to -MASTER_HOST='dummy.localdomain', -RELAY_LOG_FILE='slave-relay-bin.000001', -RELAY_LOG_POS=4; -start slave sql_thread; -select MASTER_POS_WAIT('master-bin.000001', 3776); -# Result on slave -SELECT * FROM t1; -id -5 -6 -7 -8 -9 -10 -11 -SELECT * FROM t2; -id -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -DROP TABLE IF EXISTS t1, t2; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP FUNCTION IF EXISTS f1; -DROP TRIGGER IF EXISTS tr1; -stop slave sql_thread; -reset slave; -SET @@global.relay_log_purge= @old_relay_log_purge; diff --git a/mysql-test/suite/rpl/r/rpl_drop_if_exists.result b/mysql-test/suite/binlog/r/binlog_drop_if_exists.result index e2d4c727c98..e2d4c727c98 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_if_exists.result +++ b/mysql-test/suite/binlog/r/binlog_drop_if_exists.result diff --git a/mysql-test/suite/binlog/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result index e2688a15899..21a290bfc3b 100644 --- a/mysql-test/suite/binlog/r/binlog_index.result +++ b/mysql-test/suite/binlog/r/binlog_index.result @@ -2,8 +2,10 @@ call mtr.add_suppression('Attempting backtrace'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file'); call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); +call mtr.add_suppression('Could not open .*'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); flush tables; +RESET MASTER; flush logs; flush logs; flush logs; @@ -118,11 +120,31 @@ master-bin.000011 # This should put the server in unsafe state and stop # accepting any command. If we inject a fault at this # point and continue the execution the server crashes. -# Besides the flush command does not report an error. # +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 + # fault_injection_registering_index SET SESSION debug="+d,fault_injection_registering_index"; flush logs; +ERROR HY000: Can't open file: 'master-bin.000012' (errno: 1) +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 + SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); SELECT @index; @index @@ -137,6 +159,18 @@ master-bin.000012 # fault_injection_updating_index SET SESSION debug="+d,fault_injection_updating_index"; flush logs; +ERROR HY000: Can't open file: 'master-bin.000013' (errno: 1) +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 +master-bin.000012 + SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); SELECT @index; @index diff --git a/mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result b/mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result index dfc08d76a6a..4078103b1f7 100644 --- a/mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result +++ b/mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result @@ -1,3 +1,4 @@ +RESET MASTER; ################################################################################### # CONFIGURATION ################################################################################### diff --git a/mysql-test/suite/binlog/r/binlog_old_versions.result b/mysql-test/suite/binlog/r/binlog_old_versions.result index 77289252b4c..a4850b835c8 100644 --- a/mysql-test/suite/binlog/r/binlog_old_versions.result +++ b/mysql-test/suite/binlog/r/binlog_old_versions.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1, t2, t3; ==== Read modern binlog (version 5.1.23) ==== SELECT * FROM t1 ORDER BY a; a b diff --git a/mysql-test/suite/rpl/r/rpl_binlog_query_filter_rules.result b/mysql-test/suite/binlog/r/binlog_query_filter_rules.result index 520d500ed7c..520d500ed7c 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_query_filter_rules.result +++ b/mysql-test/suite/binlog/r/binlog_query_filter_rules.result diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index d612e7adde1..1678f8add58 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -1330,3 +1330,62 @@ Log_name Pos Event_type Server_id End_log_pos Info # # Write_rows 1 # table_id: # flags: STMT_END_F # # Query 1 # COMMIT DROP TABLE t1; + +# BUG#54903 BINLOG statement toggles session variables +# ---------------------------------------------------------------------- +# This test verify that BINLOG statement doesn't change current session's +# variables foreign_key_checks and unique_checks. + +CREATE TABLE t1 (c1 INT KEY); +SET @@SESSION.foreign_key_checks= ON; +SET @@SESSION.unique_checks= ON; +# INSERT INTO t1 VALUES (1) +# foreign_key_checks=0 and unique_checks=0 +BINLOG ' +dfLtTBMBAAAAKQAAANcAAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA== +'; +SELECT * FROM t1; +c1 +1 +# Their values should be ON +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks ON +unique_checks ON + +SET @@SESSION.foreign_key_checks= OFF; +SET @@SESSION.unique_checks= OFF; +# INSERT INTO t1 VALUES(2) +# foreign_key_checks=1 and unique_checks=1 +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; +SELECT * FROM t1; +c1 +1 +2 +# Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks OFF +unique_checks OFF +# INSERT INTO t1 VALUES(2) +# foreign_key_checks=1 and unique_checks=1 +# It should not change current session's variables, even error happens +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +SELECT * FROM t1; +c1 +1 +2 +# Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks OFF +unique_checks OFF +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result b/mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result index 45c8640d3e3..2d493397ffd 100644 --- a/mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result +++ b/mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result @@ -1,3 +1,4 @@ +RESET MASTER; ################################################################################### # CONFIGURATION ################################################################################### diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result index 5a6fbc953b4..5e48f13932d 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result +++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result @@ -159,7 +159,6 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -use new_test1/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; BEGIN @@ -354,7 +353,6 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -use new_test1/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; BEGIN diff --git a/mysql-test/suite/rpl/r/rpl_server_id.result b/mysql-test/suite/binlog/r/binlog_server_id.result index 1e74394c122..1e74394c122 100644 --- a/mysql-test/suite/rpl/r/rpl_server_id.result +++ b/mysql-test/suite/binlog/r/binlog_server_id.result diff --git a/mysql-test/suite/rpl/r/rpl_sf.result b/mysql-test/suite/binlog/r/binlog_sf.result index 085ba1ebb8a..085ba1ebb8a 100644 --- a/mysql-test/suite/rpl/r/rpl_sf.result +++ b/mysql-test/suite/binlog/r/binlog_sf.result diff --git a/mysql-test/suite/binlog/r/binlog_sql_mode.result b/mysql-test/suite/binlog/r/binlog_sql_mode.result index e306040502d..4477c94a95e 100644 --- a/mysql-test/suite/binlog/r/binlog_sql_mode.result +++ b/mysql-test/suite/binlog/r/binlog_sql_mode.result @@ -1,9 +1,3 @@ -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 @old_sql_mode= @@global.sql_mode; SET @old_binlog_format=@@session.binlog_format; SET SESSION sql_mode=8; @@ -27,7 +21,7 @@ DO BEGIN UPDATE t1 SET id = id +1; END;| -Chceck Result +Check Result select (@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog")) is not null; diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index 2c8ccf9c846..92531d9fb54 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -803,3 +803,62 @@ Log_name Pos Event_type Server_id End_log_pos Info # # Write_rows 1 # table_id: # flags: STMT_END_F # # Query 1 # COMMIT DROP TABLE t1; + +# BUG#54903 BINLOG statement toggles session variables +# ---------------------------------------------------------------------- +# This test verify that BINLOG statement doesn't change current session's +# variables foreign_key_checks and unique_checks. + +CREATE TABLE t1 (c1 INT KEY); +SET @@SESSION.foreign_key_checks= ON; +SET @@SESSION.unique_checks= ON; +# INSERT INTO t1 VALUES (1) +# foreign_key_checks=0 and unique_checks=0 +BINLOG ' +dfLtTBMBAAAAKQAAANcAAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA== +'; +SELECT * FROM t1; +c1 +1 +# Their values should be ON +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks ON +unique_checks ON + +SET @@SESSION.foreign_key_checks= OFF; +SET @@SESSION.unique_checks= OFF; +# INSERT INTO t1 VALUES(2) +# foreign_key_checks=1 and unique_checks=1 +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; +SELECT * FROM t1; +c1 +1 +2 +# Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks OFF +unique_checks OFF +# INSERT INTO t1 VALUES(2) +# foreign_key_checks=1 and unique_checks=1 +# It should not change current session's variables, even error happens +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +SELECT * FROM t1; +c1 +1 +2 +# Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks OFF +unique_checks OFF +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index e8f7d828766..5ddcd9b407d 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -1,8 +1,8 @@ ==== Setup tables ==== CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a CHAR(40)); +CREATE TABLE t2 (a TEXT); CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY); -CREATE TABLE trigger_table (a CHAR(7)); +CREATE TABLE trigger_table (a TEXT); CREATE TABLE trigger_table2 (a INT); ==== Non-deterministic statements ==== INSERT DELAYED INTO t1 VALUES (5); @@ -271,7 +271,7 @@ INSERT INTO t1 SELECT * FROM t2 LIMIT 1; DROP TABLE t1,t2; "Should NOT have any warning message issued in the following func7() and trig" CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a CHAR(40)); +CREATE TABLE t2 (a TEXT); CREATE TABLE trigger_table (a CHAR(7)); CREATE FUNCTION func7() RETURNS INT diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt deleted file mode 100644 index 74e71a8e558..00000000000 --- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt +++ /dev/null @@ -1 +0,0 @@ ---replicate-same-server-id --relay-log=slave-relay-bin --skip-slave-start diff --git a/mysql-test/suite/rpl/t/rpl_drop_if_exists.test b/mysql-test/suite/binlog/t/binlog_drop_if_exists.test index 6b2b37ae791..6b2b37ae791 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_if_exists.test +++ b/mysql-test/suite/binlog/t/binlog_drop_if_exists.test diff --git a/mysql-test/suite/binlog/t/binlog_index-master.opt b/mysql-test/suite/binlog/t/binlog_index-master.opt index 26cd87ef8c3..ff2ad57a9e9 100644 --- a/mysql-test/suite/binlog/t/binlog_index-master.opt +++ b/mysql-test/suite/binlog/t/binlog_index-master.opt @@ -1 +1 @@ ---skip-stack-trace --test-expect-abort --log-warnings=0 +--force-restart --skip-stack-trace --test-expect-abort --log-warnings=0 diff --git a/mysql-test/suite/binlog/t/binlog_index-master.opt.moved b/mysql-test/suite/binlog/t/binlog_index-master.opt.moved new file mode 100644 index 00000000000..26cd87ef8c3 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_index-master.opt.moved @@ -0,0 +1 @@ +--skip-stack-trace --test-expect-abort --log-warnings=0 diff --git a/mysql-test/suite/binlog/t/binlog_index.test b/mysql-test/suite/binlog/t/binlog_index.test index 3847e40aeb2..c2b8efce57f 100644 --- a/mysql-test/suite/binlog/t/binlog_index.test +++ b/mysql-test/suite/binlog/t/binlog_index.test @@ -10,11 +10,14 @@ call mtr.add_suppression('Attempting backtrace'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file'); call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); +call mtr.add_suppression('Could not open .*'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); flush tables; let $old=`select @@debug`; +RESET MASTER; + let $MYSQLD_DATADIR= `select @@datadir`; let $INDEX=$MYSQLD_DATADIR/master-bin.index; @@ -208,12 +211,26 @@ SELECT @index; --echo # This should put the server in unsafe state and stop --echo # accepting any command. If we inject a fault at this --echo # point and continue the execution the server crashes. ---echo # Besides the flush command does not report an error. --echo # +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + --echo # fault_injection_registering_index SET SESSION debug="+d,fault_injection_registering_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE flush logs; + +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + --source include/restart_mysqld.inc --chmod 0644 $INDEX @@ -224,7 +241,16 @@ SELECT @index; --echo # fault_injection_updating_index SET SESSION debug="+d,fault_injection_updating_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE flush logs; + +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + --source include/restart_mysqld.inc --chmod 0644 $INDEX diff --git a/mysql-test/suite/binlog/t/binlog_old_versions.test b/mysql-test/suite/binlog/t/binlog_old_versions.test index 32c27fe8f89..0675bbf746d 100644 --- a/mysql-test/suite/binlog/t/binlog_old_versions.test +++ b/mysql-test/suite/binlog/t/binlog_old_versions.test @@ -25,9 +25,6 @@ source include/have_log_bin.inc; source include/not_embedded.inc; ---disable_warnings -DROP TABLE IF EXISTS t1, t2, t3; - --echo ==== Read modern binlog (version 5.1.23) ==== @@ -162,3 +159,4 @@ DROP TABLE t1, t2, t3; #SELECT * FROM t1 ORDER BY a; #SELECT * FROM t2 ORDER BY a; #SELECT COUNT(*) FROM t3; +#--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules-master.opt b/mysql-test/suite/binlog/t/binlog_query_filter_rules-master.opt index 33632bf98e8..33632bf98e8 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules-master.opt +++ b/mysql-test/suite/binlog/t/binlog_query_filter_rules-master.opt diff --git a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test b/mysql-test/suite/binlog/t/binlog_query_filter_rules.test index d56a32ce2bd..d56a32ce2bd 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test +++ b/mysql-test/suite/binlog/t/binlog_query_filter_rules.test diff --git a/mysql-test/suite/rpl/t/rpl_server_id.test b/mysql-test/suite/binlog/t/binlog_server_id.test index 6e98ec6ee6d..6e98ec6ee6d 100644 --- a/mysql-test/suite/rpl/t/rpl_server_id.test +++ b/mysql-test/suite/binlog/t/binlog_server_id.test diff --git a/mysql-test/suite/rpl/t/rpl_sf.test b/mysql-test/suite/binlog/t/binlog_sf.test index 4d12f3839a2..05b31afcb58 100644 --- a/mysql-test/suite/rpl/t/rpl_sf.test +++ b/mysql-test/suite/binlog/t/binlog_sf.test @@ -1,5 +1,9 @@ -- source include/have_log_bin.inc +# We change binlog format inside the test, so no need to re-run with +# more than one binlog_format. +-- source include/have_binlog_format_statement.inc + # Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR # BUG#41166 stored function requires "deterministic" if binlog_format is "statement" diff --git a/mysql-test/suite/binlog/t/binlog_sql_mode.test b/mysql-test/suite/binlog/t/binlog_sql_mode.test index 1777f8cb561..ab4f6450543 100644 --- a/mysql-test/suite/binlog/t/binlog_sql_mode.test +++ b/mysql-test/suite/binlog/t/binlog_sql_mode.test @@ -8,7 +8,6 @@ # Scan binlog file to check if the sql_mode is still set to 0 before generating binlog event # --- source include/master-slave.inc -- source include/have_log_bin.inc # BUG#39526 sql_mode not retained in binary log for CREATE PROCEDURE @@ -50,10 +49,10 @@ CREATE EVENT testEvent ON SCHEDULE END;| DELIMITER ;| ---echo Chceck Result +--echo Check Result let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog +--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog")) diff --git a/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt b/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt index ad2c6a647b5..377e2114039 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt +++ b/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt @@ -1 +1,2 @@ -O max_binlog_size=4096 +--force-restart diff --git a/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt b/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt index e2cfcb299cf..2a1187d3fe4 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt +++ b/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt @@ -1 +1,2 @@ --binlog-do-db=b42829 +--force-restart diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test index 358ae189004..7f64eaca77f 100644 --- a/mysql-test/suite/binlog/t/binlog_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_unsafe.test @@ -71,9 +71,9 @@ source include/have_binlog_format_statement.inc; --echo ==== Setup tables ==== CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a CHAR(40)); +CREATE TABLE t2 (a TEXT); CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY); -CREATE TABLE trigger_table (a CHAR(7)); +CREATE TABLE trigger_table (a TEXT); CREATE TABLE trigger_table2 (a INT); @@ -329,7 +329,7 @@ DROP TABLE t1,t2; --echo "Should NOT have any warning message issued in the following func7() and trig" CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a CHAR(40)); +CREATE TABLE t2 (a TEXT); CREATE TABLE trigger_table (a CHAR(7)); DELIMITER |; CREATE FUNCTION func7() diff --git a/mysql-test/suite/binlog/t/disabled.def b/mysql-test/suite/binlog/t/disabled.def index d261364756e..85313982869 100644 --- a/mysql-test/suite/binlog/t/disabled.def +++ b/mysql-test/suite/binlog/t/disabled.def @@ -10,5 +10,4 @@ # ############################################################################## binlog_truncate_innodb : BUG#57291 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed - - +binlog_row_failure_mixing_engines : BUG#58416 2010-11-23 ramil Fails on win x86 debug_max diff --git a/mysql-test/suite/bugs/t/rpl_bug12691.test b/mysql-test/suite/bugs/t/rpl_bug12691.test index 28d7f16935e..038f3e57b75 100644 --- a/mysql-test/suite/bugs/t/rpl_bug12691.test +++ b/mysql-test/suite/bugs/t/rpl_bug12691.test @@ -1,6 +1,4 @@ # Bug#12691: Exec_master_log_pos corrupted with SQL_SLAVE_SKIP_COUNTER -# Date: 01/31/2008 -# Added: Serge Kozlov <skozlov@mysql.com> --source include/master-slave.inc --connection master @@ -47,5 +45,5 @@ SELECT COUNT(*) FROM t1; --echo --echo **** On Master **** DROP TABLE t1; ---sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/bugs/t/rpl_bug23533.test b/mysql-test/suite/bugs/t/rpl_bug23533.test index 397f1102f0e..337dddcef3d 100644 --- a/mysql-test/suite/bugs/t/rpl_bug23533.test +++ b/mysql-test/suite/bugs/t/rpl_bug23533.test @@ -1,7 +1,4 @@ ############################################################# -# Author: Serge Kozlov <skozlov@mysql.com> -# Date: 02/26/2008 -# Purpose: testing bug report # Bug#23533: CREATE SELECT max_binlog_cache_size test # case needed ############################################################# @@ -10,11 +7,6 @@ --source include/have_binlog_format_row.inc --source include/master-slave.inc - ---disable_warnings -DROP TABLE IF EXISTS t1,t2; ---enable_warnings - SET AUTOCOMMIT=0; SET GLOBAL max_binlog_cache_size=4096; SHOW VARIABLES LIKE 'max_binlog_cache_size'; @@ -41,3 +33,4 @@ SHOW TABLES LIKE 't%'; # 5.1 End of Test +--source include/rpl_end.inc diff --git a/mysql-test/suite/bugs/t/rpl_bug31582.test b/mysql-test/suite/bugs/t/rpl_bug31582.test index 7ba15eec8ce..6bff8ef4172 100644 --- a/mysql-test/suite/bugs/t/rpl_bug31582.test +++ b/mysql-test/suite/bugs/t/rpl_bug31582.test @@ -21,5 +21,5 @@ SELECT * FROM t1 ORDER BY a; connection master; DROP TABLE t1; -sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/bugs/t/rpl_bug31583.test b/mysql-test/suite/bugs/t/rpl_bug31583.test index 657e4984b77..ee5b7698016 100644 --- a/mysql-test/suite/bugs/t/rpl_bug31583.test +++ b/mysql-test/suite/bugs/t/rpl_bug31583.test @@ -21,5 +21,5 @@ SELECT * FROM t1 ORDER BY a; connection master; DROP TABLE t1; -sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/bugs/t/rpl_bug33029.test b/mysql-test/suite/bugs/t/rpl_bug33029.test index 494cef42ce0..f5aad4de8df 100644 --- a/mysql-test/suite/bugs/t/rpl_bug33029.test +++ b/mysql-test/suite/bugs/t/rpl_bug33029.test @@ -23,3 +23,4 @@ insert into `t1` values (); sync_slave_with_master; select * from t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/bugs/t/rpl_bug36391.test b/mysql-test/suite/bugs/t/rpl_bug36391.test index 8bca9a46c5a..3961082273d 100644 --- a/mysql-test/suite/bugs/t/rpl_bug36391.test +++ b/mysql-test/suite/bugs/t/rpl_bug36391.test @@ -15,8 +15,6 @@ --source include/master-slave.inc -drop table if exists t1; - create table t1(id int); show tables; @@ -28,3 +26,4 @@ flush logs; --exec $MYSQL_BINLOG $MYSQL_TEST_DIR/var/log/master-bin.000001 | $MYSQL test drop table t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/bugs/t/rpl_bug37426.test b/mysql-test/suite/bugs/t/rpl_bug37426.test index d2bad0fa0c1..4c7729ab837 100644 --- a/mysql-test/suite/bugs/t/rpl_bug37426.test +++ b/mysql-test/suite/bugs/t/rpl_bug37426.test @@ -1,6 +1,4 @@ ############################################################# -# Author: Mats Kindahl <mats@mysql.com> -# Date: 2008-06-18 # Purpose: Test for BUG#37426 # RBR breaks for CHAR() UTF8 fields > 85 chars ############################################################# @@ -20,3 +18,4 @@ SELECT * FROM char128_utf8; sync_slave_with_master; SELECT * FROM char128_utf8; +--source include/rpl_end.inc diff --git a/mysql-test/suite/bugs/t/rpl_bug38205.test b/mysql-test/suite/bugs/t/rpl_bug38205.test index 52b36636e79..550746719f4 100644 --- a/mysql-test/suite/bugs/t/rpl_bug38205.test +++ b/mysql-test/suite/bugs/t/rpl_bug38205.test @@ -163,4 +163,4 @@ start slave sql_thread; connection master; drop table t1i, t2m; -sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_000015.result b/mysql-test/suite/engines/funcs/r/rpl_000015.result index 8cd48141127..eee3b505ad6 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_000015.result +++ b/mysql-test/suite/engines/funcs/r/rpl_000015.result @@ -10,25 +10,166 @@ File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 stop slave; reset slave; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry # Master_Log_File Read_Master_Log_Pos 4 +Relay_Log_File # +Relay_Log_Pos # Relay_Master_Log_File +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 Exec_Master_Log_Pos 0 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error change master to master_host='127.0.0.1'; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry # Master_Log_File Read_Master_Log_Pos 4 +Relay_Log_File # +Relay_Log_Pos # Relay_Master_Log_File +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 Exec_Master_Log_Pos 0 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry # Master_Log_File Read_Master_Log_Pos 4 +Relay_Log_File # +Relay_Log_Pos # Relay_Master_Log_File +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 Exec_Master_Log_Pos 0 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error start slave; +show slave status; +Slave_IO_State Waiting for master to send event +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 Master_Log_File master-bin.000001 +Read_Master_Log_Pos 106 +Relay_Log_File slave-relay-bin.000002 +Relay_Log_Pos 252 Relay_Master_Log_File master-bin.000001 -Checking that both slave threads are running. +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 106 +Relay_Log_Space 407 +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error drop table if exists t1; create table t1 (n int, PRIMARY KEY(n)); insert into t1 values (10),(45),(90); diff --git a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result index b6cb2c0e7de..7a901b65810 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result +++ b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result @@ -4,7 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -SHOW SLAVE STATUS;; +SHOW SLAVE STATUS; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error SHOW SLAVE HOSTS; Server_id Host Port Rpl_recovery_rank Master_id 2 127.0.0.1 SLAVE_PORT 0 1 diff --git a/mysql-test/suite/engines/funcs/r/rpl_change_master.result b/mysql-test/suite/engines/funcs/r/rpl_change_master.result index 2258a35a869..62c5ffdd4f8 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_change_master.result +++ b/mysql-test/suite/engines/funcs/r/rpl_change_master.result @@ -11,7 +11,13 @@ stop slave sql_thread; insert into t1 values(1); insert into t1 values(2); stop slave; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No 0 0 change master to master_user='root'; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No 0 0 start slave; select * from t1; n diff --git a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result index f71411c68dd..b5e14d3adac 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result +++ b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result @@ -4,6 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error load table t1 from master; ERROR 08S01: Error connecting to master: Master is not configured load table t1 from master; diff --git a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result index ef4d7797dbf..c894ad0135b 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result +++ b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result @@ -17,6 +17,43 @@ let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes% --source include/wait_slave_status.inc flush logs; -Relay_Log_File mysqld-relay-bin.000003 -Checking that both slave threads are running. +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port SLAVE_PORT +Connect_Retry 60 +Master_Log_File slave-bin.000001 +Read_Master_Log_Pos 106 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File slave-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table # +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 106 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error STOP SLAVE; diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result index 779a3af9631..d858ced1352 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result +++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result @@ -10,6 +10,6 @@ load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; select count(*) from test.t1; count(*) 2 -show binlog events from <binlog_start>; +show binlog events from 106; Log_name Pos Event_type Server_id End_log_pos Info drop table test.t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result index 1b2ded26f66..f26f4350cf1 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result +++ b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result @@ -4,23 +4,39 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 106 <Binlog_Ignore_DB> +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # No 0 0 stop slave; -change master to master_log_pos=MASTER_LOG_POS; +change master to master_log_pos=106; start slave; stop slave; -change master to master_log_pos=MASTER_LOG_POS; +change master to master_log_pos=106; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No 0 0 106 # None 0 No # No 0 0 start slave; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # No 0 0 stop slave; -# impossible position leads to an error -change master to master_log_pos=MASTER_LOG_POS; +change master to master_log_pos=177; start slave; -Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position' +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 177 # # master-bin.000001 No Yes 0 0 177 # None 0 No # No 1236 Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position' 0 +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 106 <Binlog_Ignore_DB> create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); stop slave; -change master to master_log_pos=MASTER_LOG_POS; +change master to master_log_pos=206; start slave; select * from t1 ORDER BY n; n diff --git a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result index ced1693bdc8..b4b04d35208 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result +++ b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result @@ -14,16 +14,47 @@ MIXED MIXED CREATE TABLE t1 (a INT, b LONG); INSERT INTO t1 VALUES (1,1), (2,2); INSERT INTO t1 VALUES (3,UUID()), (4,UUID()); -show binlog events from <binlog_start>; +SHOW BINLOG EVENTS; **** On Slave **** -show binlog events from <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -show binlog events from <binlog_start>; +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error +SHOW BINLOG EVENTS; DROP TABLE IF EXISTS t1; SET GLOBAL BINLOG_FORMAT=@saved_binlog_format; diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result index 048e07271b3..89654ebf165 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result @@ -41,11 +41,12 @@ t1 t2 **** On Master **** DROP TABLE t1,t2; -show binlog events from <binlog_start>; +SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int) -master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int) -master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4 +master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a int) +master-bin.000001 192 Query 1 278 use `test`; CREATE TABLE t2 (a int) +master-bin.000001 278 Query 1 382 use `test`; DROP TABLE `t1` /* generated by server */ SHOW TABLES; Tables_in_test t2 diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result index cd7528280d0..ad192b530a7 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result @@ -17,5 +17,43 @@ a 0 drop table t1; insert into t1 values (1); -Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table test.t2 +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1146 +Last_Error Error 'Table 'test.t1' doesn't exist' on opening tables +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 1146 +Last_SQL_Error Error 'Table 'test.t1' doesn't exist' on opening tables drop table t1, t2; diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_until.result b/mysql-test/suite/engines/funcs/r/rpl_row_until.result index 72dd1a6a7c3..5091a9f6468 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result @@ -12,39 +12,193 @@ create table t2(n int not null auto_increment primary key); insert into t2 values (1),(2); insert into t2 values (3),(4); drop table t2; -start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; +start slave until master_log_file='master-bin.000001', master_log_pos=311; select * from t1; n 1 2 3 4 -start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition Master +Until_Log_File master-bin.000001 +Until_Log_Pos 311 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error +start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; select * from t1; -n -1 -2 -3 -4 -start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS; +n 1 +n 2 +n 3 +n 4 +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition Master +Until_Log_File master-no-such-bin.000001 +Until_Log_Pos 291 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error +start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; select * from t2; -n -1 -2 +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition Relay +Until_Log_File slave-relay-bin.000004 +Until_Log_Pos 728 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error start slave; stop slave; -start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; -start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS; +start slave until master_log_file='master-bin.000001', master_log_pos=740; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition Master +Until_Log_File master-bin.000001 +Until_Log_Pos 740 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error +start slave until master_log_file='master-bin', master_log_pos=561; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL -start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS; +start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL start slave until master_log_file='master-bin.000001'; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL start slave until relay_log_file='slave-relay-bin.000002'; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL -start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=MASTER_LOG_POS; +start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL start slave sql_thread; -start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; +start slave until master_log_file='master-bin.000001', master_log_pos=740; Warnings: -Note 1254 Slave is already running +Level Note +Code 1254 +Message Slave is already running diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result index 1e7108d7961..47c2a522094 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result +++ b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result @@ -8,8 +8,10 @@ create table t1 (n int); reset master; stop slave; change master to master_port=SLAVE_PORT; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error + 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 106 None 0 No NULL No 0 0 start slave; -Last_IO_Error = Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it). insert into t1 values (1); show status like "slave_running"; Variable_name Value diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result index 066b563c4e8..d50814022d8 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result +++ b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result @@ -8,6 +8,9 @@ create table t1 (n int); reset master; stop slave; change master to master_port=SLAVE_PORT; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error + 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 106 None 0 No NULL No 0 0 start slave; insert into t1 values (1); select * from t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result index c4dc7686045..dfc82f61e68 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result +++ b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result @@ -18,5 +18,44 @@ drop user rpl@127.0.0.1; flush privileges; stop slave; start slave; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User rpl +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running No +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master NULL +Master_SSL_Verify_Server_Cert No +Last_IO_Errno # +Last_IO_Error # +Last_SQL_Errno 0 +Last_SQL_Error drop table t1; drop table t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp.result b/mysql-test/suite/engines/funcs/r/rpl_sp.result index c7b869c32e3..efbfde15020 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_sp.result +++ b/mysql-test/suite/engines/funcs/r/rpl_sp.result @@ -176,7 +176,7 @@ end| ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) set global log_bin_trust_routine_creators=1; Warnings: -Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.6. Please use '@@log_bin_trust_function_creators' instead +Warning 1287 '@@log_bin_trust_routine_creators' is deprecated and will be removed in a future release. Please use '@@log_bin_trust_function_creators' instead set global log_bin_trust_function_creators=0; set global log_bin_trust_function_creators=1; set global log_bin_trust_function_creators=1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result index 61d77c0dc2a..466302000af 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result @@ -376,7 +376,7 @@ CREATE TABLE t12 (data LONG); LOCK TABLES t12 WRITE; INSERT INTO t12 VALUES(UUID()); UNLOCK TABLES; -show binlog events from <binlog_start>; -show binlog events from <binlog_start>; +show binlog events; +show binlog events; drop database mysqltest1; set global binlog_format= @saved_binlog_format; diff --git a/mysql-test/suite/engines/funcs/t/disabled.def b/mysql-test/suite/engines/funcs/t/disabled.def index 2aca7006b4e..5b6e3f6a281 100644 --- a/mysql-test/suite/engines/funcs/t/disabled.def +++ b/mysql-test/suite/engines/funcs/t/disabled.def @@ -5,3 +5,92 @@ crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value +rpl_create_database : Result Difference Due to Change in .inc file +rpl_loaddata_m : Result Difference Due to Change in .inc file +rpl_sp_effects : Result Difference Due to Change in .inc file +rpl_variables : Result Difference Due to Change in .inc file +rpl_loaddata_s : Result Difference Due to Change in .inc file +rpl_server_id2 : Result Difference Due to Change in .inc file +rpl000010 : Result Difference Due to Change in .inc file +rpl_init_slave : Result Difference Due to Change in .inc file +rpl_dual_pos_advance : Result Difference Due to Change in .inc file +rpl_empty_master_crash : Result Difference Due to Change in .inc file +rpl000011 : Result Difference Due to Change in .inc file +rpl000013 : Result Difference Due to Change in .inc file +rpl_000015 : Result Difference Due to Change in .inc file +rpl_LD_INFILE : Result Difference Due to Change in .inc file +rpl_REDIRECT : Result Difference Due to Change in .inc file +rpl_alter : Result Difference Due to Change in .inc file +rpl_alter_db : Result Difference Due to Change in .inc file +rpl_bit : Result Difference Due to Change in .inc file +rpl_bit_npk : Result Difference Due to Change in .inc file +rpl_change_master : Result Difference Due to Change in .inc file +rpl_do_grant : Result Difference Due to Change in .inc file +rpl_drop : Result Difference Due to Change in .inc file +rpl_drop_db : Result Difference Due to Change in .inc file +rpl_flushlog_loop : Result Difference Due to Change in .inc file +rpl_get_lock : Result Difference Due to Change in .inc file +rpl_insert : Result Difference Due to Change in .inc file +rpl_insert_select : Result Difference Due to Change in .inc file +rpl_loaddata2 : Result Difference Due to Change in .inc file +rpl_loaddatalocal : Result Difference Due to Change in .inc file +rpl_loadfile : Result Difference Due to Change in .inc file +rpl_log_pos : Result Difference Due to Change in .inc file +rpl_many_optimize : Result Difference Due to Change in .inc file +rpl_master_pos_wait : Result Difference Due to Change in .inc file +rpl_misc_functions : Result Difference Due to Change in .inc file +rpl_ps : Result Difference Due to Change in .inc file +rpl_rbr_to_sbr : Result Difference Due to Change in .inc file +rpl_row_max_relay_size : Result Difference Due to Change in .inc file +rpl_server_id1 : Result Difference Due to Change in .inc file +rpl_session_var : Result Difference Due to Change in .inc file +rpl_sf : Result Difference Due to Change in .inc file +rpl_slave_status : Result Difference Due to Change in .inc file +rpl_sp004 : Result Difference Due to Change in .inc file +rpl_start_stop_slave : Result Difference Due to Change in .inc file +rpl_stm_max_relay_size : Result Difference Due to Change in .inc file +rpl_stm_mystery22 : Result Difference Due to Change in .inc file +rpl_stm_no_op : Result Difference Due to Change in .inc file +rpl_stm_reset_slave : Result Difference Due to Change in .inc file +rpl_temp_table : Result Difference Due to Change in .inc file +rpl_temporary : Result Difference Due to Change in .inc file +rpl_trigger : Result Difference Due to Change in .inc file +rpl_trunc_temp : Result Difference Due to Change in .inc file +rpl_user_variables : Result Difference Due to Change in .inc file +rpl_relayspace : Result Difference Due to Change in .inc file +rpl_multi_delete2 : Result Difference Due to Change in .inc file +rpl_view : Result Difference Due to Change in .inc file +rpl_ignore_table_update : Result Difference Due to Change in .inc file +rpl_err_ignoredtable : Result Difference Due to Change in .inc file +rpl_multi_update4 : Result Difference Due to Change in .inc file +rpl_multi_delete : Result Difference Due to Change in .inc file +rpl_ignore_grant : Result Difference Due to Change in .inc file +rpl_ignore_revoke : Result Difference Due to Change in .inc file +rpl_free_items : Result Difference Due to Change in .inc file +rpl_replicate_ignore_db : Result Difference Due to Change in .inc file +rpl000017 : Result Difference Due to Change in .inc file +rpl_skip_error : Result Difference Due to Change in .inc file +rpl_sp : Result Difference Due to Change in .inc file + +rpl_row_until : Test Present in rpl suite as well . Test Fails with table t2 not found. +rpl_loaddata_s : Test Present in rpl suite as well . Test Fails due to bin log truncation. +rpl_log_pos : Test Present in rpl suite as well . Test Fails due to bin log truncation. +rpl_row_NOW : Result Difference Due to Change in .inc file +rpl_row_USER : Result Difference Due to Change in .inc file +rpl_row_drop : Result Difference Due to Change in .inc file +rpl_row_func001 : Result Difference Due to Change in .inc file +rpl_row_reset_slave : Result Difference Due to Change in .inc file +rpl_row_sp001 : Result Difference Due to Change in .inc file +rpl_row_sp005 : Result Difference Due to Change in .inc file +rpl_row_sp008 : Result Difference Due to Change in .inc file +rpl_row_sp009 : Result Difference Due to Change in .inc file +rpl_row_sp010 : Result Difference Due to Change in .inc file +rpl_row_sp011 : Result Difference Due to Change in .inc file +rpl_row_sp012 : Result Difference Due to Change in .inc file +rpl_row_stop_middle : Result Difference Due to Change in .inc file +rpl_row_trig001 : Result Difference Due to Change in .inc file +rpl_row_trig002 : Result Difference Due to Change in .inc file +rpl_row_trig003 : Result Difference Due to Change in .inc file +rpl_row_view01 : Result Difference Due to Change in .inc file +rpl_switch_stm_row_mixed : Result Difference Due to Change in .inc file +rpl_row_inexist_tbl : Result Difference Due to Change in .inc file diff --git a/mysql-test/suite/engines/funcs/t/rpl_000015.test b/mysql-test/suite/engines/funcs/t/rpl_000015.test index 6c18e66a3a6..817ed6f407c 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_000015.test +++ b/mysql-test/suite/engines/funcs/t/rpl_000015.test @@ -11,25 +11,31 @@ save_master_pos; connection slave; stop slave; reset slave; -let $status_items= Master_Log_File, Read_Master_Log_Pos, Relay_Master_Log_File, Exec_Master_Log_Pos; -source include/show_slave_status.inc; +--vertical_results +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 5 # 8 # 9 # 23 # 33 # +show slave status; change master to master_host='127.0.0.1'; # The following needs to be cleaned up when change master is fixed -source include/show_slave_status.inc; - +--vertical_results +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 5 # 8 # 9 # 23 # 33 # +show slave status; --replace_result $MASTER_MYPORT MASTER_PORT eval change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=$MASTER_MYPORT; -source include/show_slave_status.inc; - +--vertical_results +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 5 # 8 # 9 # 23 # 33 # +show slave status; start slave; sync_with_master; -let $status_items= Master_Log_File, Relay_Master_Log_File; -source include/show_slave_status.inc; -source include/check_slave_is_running.inc; - --vertical_results +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 5 # 8 # 9 # 23 # 33 # +--replace_column 33 # +show slave status; connection master; --disable_warnings drop table if exists t1; diff --git a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test index 7644b18ee7e..078d1048794 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test +++ b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test @@ -7,11 +7,15 @@ source include/master-slave.inc; --disable_ps_protocol #first, make sure the slave has had enough time to register -sync_slave_with_master; +save_master_pos; +connection slave; +sync_with_master; #discover slaves connection master; ---query_vertical SHOW SLAVE STATUS; +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 16 # 23 # 33 # +SHOW SLAVE STATUS; --replace_result $SLAVE_MYPORT SLAVE_PORT SHOW SLAVE HOSTS; rpl_probe; @@ -21,7 +25,9 @@ enable_rpl_parse; create table t1 ( n int); insert into t1 values (1),(2),(3),(4); disable_rpl_parse; -sync_slave_with_master; +save_master_pos; +connection slave; +sync_with_master; insert into t1 values(5); connection master; enable_rpl_parse; diff --git a/mysql-test/suite/engines/funcs/t/rpl_change_master.test b/mysql-test/suite/engines/funcs/t/rpl_change_master.test index ce8c921c2ad..c031464c95e 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_change_master.test +++ b/mysql-test/suite/engines/funcs/t/rpl_change_master.test @@ -18,26 +18,13 @@ save_master_pos; connection slave; --real_sleep 3 # wait for I/O thread to have read updates stop slave; -source include/wait_for_slave_to_stop.inc; - -let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); -if (`SELECT $read_pos = $exec_pos`) -{ - source include/show_rpl_debug_info.inc; - echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos'; - die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos; -} +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 8 # 9 # 23 # 33 # +show slave status; change master to master_user='root'; -let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); -if (`SELECT $read_pos <> $exec_pos`) -{ - source include/show_rpl_debug_info.inc; - echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos'; - die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos; -} - +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 8 # 9 # 23 # 33 # +show slave status; start slave; sync_with_master; select * from t1; diff --git a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test index 863b450a6d9..707d1eca8c2 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test +++ b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test @@ -1,5 +1,8 @@ source include/master-slave.inc; +--replace_column 1 # 8 # 9 # 16 # 23 # 33 # +show slave status; + # # Load table should not succeed on the master as this is not a slave # diff --git a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test index 0b71817226a..2e481f5e5e7 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test +++ b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test @@ -41,7 +41,8 @@ sleep 5; # # Show status of slave # ---let status_items= Relay_Log_File ---source include/show_slave_status.inc ---source include/check_slave_is_running.inc +--replace_result $SLAVE_MYPORT SLAVE_PORT +--replace_column 1 # 8 # 9 # 16 # 23 # 33 # +--vertical_results +SHOW SLAVE STATUS; STOP SLAVE; diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test index 2dd2218eb5c..791fe84420f 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test +++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test @@ -20,7 +20,9 @@ save_master_pos; connection slave; sync_with_master; select count(*) from test.t1; # check that LOAD was replicated -source include/show_binlog_events.inc; +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ +show binlog events from 106; # should be nothing # Cleanup connection master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test index e07f0d5f2a7..13083e47bcf 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test +++ b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test @@ -11,41 +11,36 @@ # Passes with rbr no problem, removed statement include [jbm] source include/master-slave.inc; -let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1); +--replace_column 3 <Binlog_Ignore_DB> +show master status; sync_slave_with_master; +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 23 # 33 # +show slave status; stop slave; - ---replace_result $master_log_pos MASTER_LOG_POS -eval change master to master_log_pos=$master_log_pos; +change master to master_log_pos=106; start slave; sleep 5; stop slave; - ---replace_result $master_log_pos MASTER_LOG_POS -eval change master to master_log_pos=$master_log_pos; ---let $slave_param= Read_Master_Log_Pos ---let $slave_param_value= $master_log_pos ---source include/wait_for_slave_param.inc - +change master to master_log_pos=106; +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 23 # 33 # +show slave status; start slave; sleep 5; ---let $slave_param= Read_Master_Log_Pos ---let $slave_param_value= $master_log_pos ---source include/wait_for_slave_param.inc ---source include/check_slave_no_error.inc - +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 23 # 33 # +show slave status; stop slave; ---echo # impossible position leads to an error ---replace_result 177 MASTER_LOG_POS change master to master_log_pos=177; start slave; sleep 2; -let $slave_io_errno= 1236; -let $show_slave_io_error= 1; -source include/wait_for_slave_io_error.inc; +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 23 # 33 # +show slave status; connection master; - -let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1); +--replace_column 3 <Binlog_Ignore_DB> +show master status; create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); @@ -53,9 +48,7 @@ insert into t1 values (1),(2),(3); save_master_pos; connection slave; stop slave; - ---replace_result $master_log_pos MASTER_LOG_POS -eval change master to master_log_pos=$master_log_pos; +change master to master_log_pos=206; start slave; sync_with_master; select * from t1 ORDER BY n; diff --git a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test index c9d27d1ea6a..d466382dc92 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test +++ b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test @@ -15,17 +15,25 @@ SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT; CREATE TABLE t1 (a INT, b LONG); INSERT INTO t1 VALUES (1,1), (2,2); INSERT INTO t1 VALUES (3,UUID()), (4,UUID()); +let $VERSION=`select version()`; +--replace_result $VERSION VERSION +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ # Different number of binlog events are generated by different engines --disable_result_log -source include/show_binlog_events.inc; +SHOW BINLOG EVENTS; --enable_result_log sync_slave_with_master; --echo **** On Slave **** -source include/show_binlog_events.inc; - +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--query_vertical SHOW SLAVE STATUS +--replace_result $VERSION VERSION +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ # Different number of binlog events are generated by different engines --disable_result_log -source include/show_binlog_events.inc; +SHOW BINLOG EVENTS; --enable_result_log --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test index d18ebc2846b..20c217a7c3a 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test @@ -30,7 +30,10 @@ connection master; --echo **** On Master **** # Should drop the non-temporary table t1 and the temporary table t2 DROP TABLE t1,t2; -source include/show_binlog_events.inc; +let $VERSION=`select version()`; +--replace_result $VERSION VERSION +--replace_regex /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS; SHOW TABLES; sync_slave_with_master; --echo **** On Slave **** diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test index dca2894c9da..736071a8ece 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test @@ -22,11 +22,13 @@ connection master; insert into t1 values (1); connection slave; -# slave should have stopped because can't find table t1 +# slave should have stopped because can't find table t1 +wait_for_slave_to_stop; # see if we have a good error message: ---let $slave_sql_errno= 1146 ---let $show_slave_sql_error= 1 ---source include/wait_for_slave_sql_error.inc +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--vertical_results +show slave status; # cleanup connection master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test index b60734317c6..ccd9ce11637 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test @@ -18,50 +18,44 @@ connection master; # create some events on master create table t1(n int not null auto_increment primary key); insert into t1 values (1),(2),(3),(4); -let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1); drop table t1; - create table t2(n int not null auto_increment primary key); insert into t2 values (1),(2); -let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1); insert into t2 values (3),(4); drop table t2; # try to replicate all queries until drop of t1 connection slave; ---replace_result $master_log_pos_1 MASTER_LOG_POS -eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_1; +start slave until master_log_file='master-bin.000001', master_log_pos=311; sleep 2; wait_for_slave_to_stop; # here table should be still not deleted select * from t1; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_log_pos_1 ---source include/check_slave_param.inc +--vertical_results +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 # +show slave status; # this should fail right after start ---replace_result 291 MASTER_LOG_POS start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; # again this table should be still not deleted select * from t1; sleep 2; wait_for_slave_to_stop; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_log_pos_1 ---source include/check_slave_param.inc +--vertical_results +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 # +show slave status; # try replicate all up to and not including the second insert to t2; -let $master_log_pos= $master_log_pos_2; -let $relay_log_file= slave-relay-bin.000004; ---source include/get_relay_log_pos.inc ---replace_result $relay_log_pos RELAY_LOG_POS -eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos; +start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; sleep 2; wait_for_slave_to_stop; select * from t2; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_log_pos ---source include/check_slave_param.inc +--vertical_results +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 # +show slave status; # clean up start slave; @@ -71,32 +65,27 @@ connection slave; sync_with_master; stop slave; ---let $exec_log_pos_1= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) # this should stop immediately as we are already there ---replace_result $master_log_pos_2 MASTER_LOG_POS -eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_2; +start slave until master_log_file='master-bin.000001', master_log_pos=740; sleep 2; wait_for_slave_to_stop; # here the sql slave thread should be stopped ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $exec_log_pos_1 ---source include/check_slave_param.inc +--vertical_results +--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004 +--replace_column 1 # 7 # 9 # 22 # 23 # 33 # +show slave status; #testing various error conditions ---replace_result 561 MASTER_LOG_POS --error 1277 start slave until master_log_file='master-bin', master_log_pos=561; ---replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS --error 1277 start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; --error 1277 start slave until master_log_file='master-bin.000001'; --error 1277 start slave until relay_log_file='slave-relay-bin.000002'; ---replace_result 561 MASTER_LOG_POS --error 1277 start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; # Warning should be given for second command start slave sql_thread; ---replace_result 740 MASTER_LOG_POS start slave until master_log_file='master-bin.000001', master_log_pos=740; diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test index 014f38d3544..71310750b60 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test +++ b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test @@ -12,13 +12,10 @@ reset master; stop slave; --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_port=$SLAVE_MYPORT; -source include/check_slave_no_error.inc; - +--replace_result $SLAVE_MYPORT SLAVE_PORT +--replace_column 16 # 18 # +show slave status; start slave; -let $slave_io_errno= 1593; -let $show_slave_io_error= 1; -source include/wait_for_slave_io_error.inc; - insert into t1 values (1); # can't MASTER_POS_WAIT(), it does not work in this weird setup # (when slave is its own master without --replicate-same-server-id) diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test index 5b8683ecfb1..0f2eb560d18 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test +++ b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test @@ -9,6 +9,9 @@ reset master; stop slave; --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_port=$SLAVE_MYPORT; +--replace_result $SLAVE_MYPORT SLAVE_PORT +--replace_column 18 # +show slave status; start slave; insert into t1 values (1); save_master_pos; diff --git a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test index cc3fbf6abee..b3d6e49e215 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test +++ b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test @@ -22,7 +22,9 @@ drop table if exists t1; --enable_warnings create table t1 (n int); insert into t1 values (1); -sync_slave_with_master; +save_master_pos; +connection slave; +sync_with_master; select * from t1; # 3. Delete new replication user @@ -38,8 +40,12 @@ stop slave; start slave; # 5. Make sure Slave_IO_Running = No -let $slave_io_errno= 1045; -source include/wait_for_slave_io_error.inc; +--replace_result $MASTER_MYPORT MASTER_MYPORT +# Column 1 is replaced, since the output can be either +# "Connecting to master" or "Waiting for master update" +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 # +--vertical_results +show slave status; # Cleanup (Note that slave IO thread is not running) connection slave; diff --git a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test index eb2e2a828f3..d89765fb28d 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test @@ -501,7 +501,9 @@ INSERT INTO t12 VALUES(UUID()); UNLOCK TABLES; --disable_result_log -source include/show_binlog_events.inc; +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ +show binlog events; --enable_result_log sync_slave_with_master; @@ -518,7 +520,9 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_ connection master; --disable_result_log -source include/show_binlog_events.inc; +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ +show binlog events; --enable_result_log # Now test that mysqlbinlog works fine on a binlog generated by the diff --git a/mysql-test/suite/engines/iuds/t/insert_year.test b/mysql-test/suite/engines/iuds/t/insert_year.test index 60a4029df18..392b4544376 100644 --- a/mysql-test/suite/engines/iuds/t/insert_year.test +++ b/mysql-test/suite/engines/iuds/t/insert_year.test @@ -226,6 +226,7 @@ SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t2; + --sorted_result SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2; --sorted_result @@ -300,6 +301,7 @@ SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t2; + --sorted_result SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2; --sorted_result diff --git a/mysql-test/suite/federated/federated_bug_35333.result b/mysql-test/suite/federated/federated_bug_35333.result new file mode 100644 index 00000000000..e1319cfeeae --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_35333.result @@ -0,0 +1,41 @@ +# +# Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata" +# +# Queries such as SHOW TABLE STATUS and SELECT * FROM INFORMATION_SCHEMA.TABLES fail +# when encountering a federated table that cannot connect to its remote table. +# +# The fix is to store the error text in the TABLE COMMENTS column of I_S.TABLES, clear +# the remote connection error and push a warning instead. This allows the SELECT operation +# to complete while still indicating a problem. This fix applies to any non-fatal system +# error that occurs during a query against I_S.TABLES.de +CREATE DATABASE federated; +CREATE DATABASE federated; +DROP TABLE IF EXISTS federated.t0; +# +# Create a MyISAM table then corrupt the file +# +CREATE TABLE t1 (c1 int) ENGINE=MYISAM; +# +# Corrupt the MyISAM table by deleting the base file +# +# +# Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query +# +SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT +FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT +test t1 BASE TABLE NULL NULL NULL NULL Can't find file: 't1' (errno: 2) +Warnings: +Warning 1017 Can't find file: 't1' (errno: 2) +SHOW WARNINGS; +Level Code Message +Warning 1017 Can't find file: 't1' (errno: 2) +DROP TABLE t1; +ERROR 42S02: Unknown table 't1' +# +# Cleanup +# +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_bug_35333.test b/mysql-test/suite/federated/federated_bug_35333.test new file mode 100644 index 00000000000..8bce63c34e5 --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_35333.test @@ -0,0 +1,77 @@ +--echo # +--echo # Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata" +--echo # +--echo # Queries such as SHOW TABLE STATUS and SELECT * FROM INFORMATION_SCHEMA.TABLES fail +--echo # when encountering a federated table that cannot connect to its remote table. +--echo # +--echo # The fix is to store the error text in the TABLE COMMENTS column of I_S.TABLES, clear +--echo # the remote connection error and push a warning instead. This allows the SELECT operation +--echo # to complete while still indicating a problem. This fix applies to any non-fatal system +--echo # error that occurs during a query against I_S.TABLES.de + +--source federated.inc + +--disable_warnings +# Federated database exists +DROP TABLE IF EXISTS federated.t0; +--enable_warnings + +--disable_parsing +# This test doesn't work with federatedx, as it doesn't allow wrong connections + +--echo # +--echo # Create the base table to be referenced +--echo # +CREATE TABLE realdb.t0 (a text, b text) ENGINE=MYISAM; + +--echo # +--echo # Create a federated table with a bogus port number +--echo # +CREATE TABLE federated.t0 (a text, b text) ENGINE=FEDERATED + CONNECTION='mysql://root@127.0.0.1:63333/realdb/t0'; + +#--warning ER_CONNECT_TO_FOREIGN_DATA_SOURCE + +--echo # +--echo # Trigger a federated system error during a INFORMATION_SCHEMA.TABLES query +--echo # +# Remove O/S-specific socket error +--replace_regex /\(.*\)/(socket errno)/ +SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT + FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'realdb' or TABLE_SCHEMA = 'federated'; + +# Remove O/S-specific socket error +--replace_regex /\(.*\)/(socket errno)/ +SHOW WARNINGS; +DROP TABLE federated.t0; + +--enable_parsing + +--echo # +--echo # Create a MyISAM table then corrupt the file +--echo # +CREATE TABLE t1 (c1 int) ENGINE=MYISAM; +--echo # +--echo # Corrupt the MyISAM table by deleting the base file +--echo # +let $MYSQLD_DATADIR= `SELECT @@datadir`; +--remove_file $MYSQLD_DATADIR/test/t1.MYD +--remove_file $MYSQLD_DATADIR/test/t1.MYI + +--echo # +--echo # Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query +--echo # +SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT + FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; + +SHOW WARNINGS; +--disable_warnings +--error 1051 +DROP TABLE t1; +--enable_warnings + +--echo # +--echo # Cleanup +--echo # + +--source federated_cleanup.inc diff --git a/mysql-test/suite/federated/federated_bug_585688.result b/mysql-test/suite/federated/federated_bug_585688.result new file mode 100644 index 00000000000..d846e3a26cf --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_585688.result @@ -0,0 +1,26 @@ +CREATE DATABASE federated; +CREATE DATABASE federated; +# +# Bug #585688: maridb crashes in federatedx code +# +CREATE TABLE federated.t1(a TEXT); +INSERT INTO federated.t1 VALUES('abc'), ('gh'), ('f'), ('ijk'), ('de'); +flush tables; +CREATE TABLE federated.t1(a TEXT) ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +flush tables; +describe federated.t1; +Field Type Null Key Default Extra +a text YES NULL +show table status from federated; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 FEDERATED 10 Dynamic 5 20 X X X X X X X X latin1_swedish_ci NULL +show table status from federated; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 FEDERATED 10 Dynamic 5 20 X X X X X X X X latin1_swedish_ci NULL +DROP TABLE federated.t1; +DROP TABLE federated.t1; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_bug_585688.test b/mysql-test/suite/federated/federated_bug_585688.test new file mode 100644 index 00000000000..6566125c419 --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_585688.test @@ -0,0 +1,53 @@ +source federated.inc; + +--echo # +--echo # Bug #585688: maridb crashes in federatedx code +--echo # +connection slave; +CREATE TABLE federated.t1(a TEXT); +INSERT INTO federated.t1 VALUES('abc'), ('gh'), ('f'), ('ijk'), ('de'); + +connect (conn_1,127.0.0.1,root,,,$MASTER_MYPORT); + +connection master; +flush tables; + +connection conn_1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1(a TEXT) ENGINE=FEDERATED + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +disconnect conn_1; + +connection master; +flush tables; + +connect (conn_2,127.0.0.1,root,,,$MASTER_MYPORT); +connect (conn_3,127.0.0.1,root,,,$MASTER_MYPORT); + +connection conn_2; +describe federated.t1; + +connection conn_3; +--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X +show table status from federated; + +disconnect conn_2; +connect (conn_4,127.0.0.1,root,,,$MASTER_MYPORT); + +connection conn_4; +--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X +show table status from federated; + +disconnect conn_3; +disconnect conn_4; + +connection master; +DROP TABLE federated.t1; + +connection slave; +DROP TABLE federated.t1; + +connection default; + +source federated_cleanup.inc; + diff --git a/mysql-test/suite/federated/federated_debug.test b/mysql-test/suite/federated/federated_debug.test index 4152d2975b3..d63c1007088 100644 --- a/mysql-test/suite/federated/federated_debug.test +++ b/mysql-test/suite/federated/federated_debug.test @@ -1,4 +1,5 @@ --source include/have_debug.inc +--source include/long_test.inc --source federated.inc --echo # diff --git a/mysql-test/suite/federated/federated_partition-slave.opt b/mysql-test/suite/federated/federated_partition-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/federated/federated_partition-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/suite/federated/federated_partition.result b/mysql-test/suite/federated/federated_partition.result new file mode 100644 index 00000000000..26a6443ffad --- /dev/null +++ b/mysql-test/suite/federated/federated_partition.result @@ -0,0 +1,43 @@ +CREATE DATABASE federated; +CREATE DATABASE federated; +drop table if exists t1; +create table federated.t1_1 (s1 int primary key) engine=myisam; +create table federated.t1_2 (s1 int primary key) engine=innodb; +create table t1 (s1 int primary key) engine=federated +partition by list (s1) +(partition p1 values in (1,3) +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1', +partition p2 values in (2,4) +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `s1` int(11) NOT NULL, + PRIMARY KEY (`s1`) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (s1) +(PARTITION p1 VALUES IN (1,3) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED, + PARTITION p2 VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED) */ +insert into t1 values (1), (2), (3), (4); +select * from t1; +s1 +1 +3 +2 +4 +select * from federated.t1_1; +s1 +1 +3 +select * from federated.t1_2; +s1 +2 +4 +drop table t1; +drop table federated.t1_1; +drop table federated.t1_2; +End of 5.1 tests +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_partition.test b/mysql-test/suite/federated/federated_partition.test new file mode 100644 index 00000000000..6f093bfb63d --- /dev/null +++ b/mysql-test/suite/federated/federated_partition.test @@ -0,0 +1,52 @@ +# +# Tests for partitioned FEDERATED +# +source include/have_partition.inc; +source include/have_innodb.inc; +source federated.inc; + +disable_warnings; +drop table if exists t1; +enable_warnings; + +# +# Federated + partition +# +# Create 2 tables on the Slave, we can use different storage engines. +# Then create a Federated table on the Master, using different connect +# string to specify the two different target partitions we want to use. +# + +connection slave; +create table federated.t1_1 (s1 int primary key) engine=myisam; +create table federated.t1_2 (s1 int primary key) engine=innodb; + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table t1 (s1 int primary key) engine=federated + partition by list (s1) + (partition p1 values in (1,3) + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_1', + partition p2 values in (2,4) + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_2'); + +--replace_result $SLAVE_MYPORT SLAVE_PORT +show create table t1; + +insert into t1 values (1), (2), (3), (4); +select * from t1; + +connection slave; +select * from federated.t1_1; +select * from federated.t1_2; + +connection master; +drop table t1; + +connection slave; +drop table federated.t1_1; +drop table federated.t1_2; + +--echo End of 5.1 tests + +source federated_cleanup.inc; diff --git a/mysql-test/suite/federated/federated_server.result b/mysql-test/suite/federated/federated_server.result index 05782c6ef81..2c1dd96d612 100644 --- a/mysql-test/suite/federated/federated_server.result +++ b/mysql-test/suite/federated/federated_server.result @@ -54,7 +54,7 @@ PASSWORD '', PORT SLAVE_PORT, SOCKET '', OWNER 'root'); -select * from mysql.servers; +select * from mysql.servers order by db; Server_name Host Db Username Password Port Socket Wrapper Owner server_one 127.0.0.1 first_db root SLAVE_PORT mysql root server_two 127.0.0.1 second_db root SLAVE_PORT mysql root @@ -154,7 +154,7 @@ id name drop table federated.t1; drop server 'server_one'; drop server 'server_two'; -select * from mysql.servers; +select * from mysql.servers order by db; Server_name Host Db Username Password Port Socket Wrapper Owner drop table first_db.t1; drop table second_db.t1; diff --git a/mysql-test/suite/federated/federated_server.test b/mysql-test/suite/federated/federated_server.test index d03c2d26014..ba1df04b62f 100644 --- a/mysql-test/suite/federated/federated_server.test +++ b/mysql-test/suite/federated/federated_server.test @@ -66,7 +66,7 @@ eval create server 'server_two' foreign data wrapper 'mysql' options OWNER 'root'); --replace_result $SLAVE_MYPORT SLAVE_PORT -eval select * from mysql.servers; +eval select * from mysql.servers order by db; DROP TABLE IF EXISTS federated.old; --replace_result $SLAVE_MYPORT SLAVE_PORT @@ -151,7 +151,7 @@ drop table federated.t1; drop server 'server_one'; drop server 'server_two'; -select * from mysql.servers; +select * from mysql.servers order by db; connection slave; drop table first_db.t1; diff --git a/mysql-test/suite/funcs_1/r/myisam_views.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result index 9b07a0ae45b..9b07a0ae45b 100644 --- a/mysql-test/suite/funcs_1/r/myisam_views.result +++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result diff --git a/mysql-test/suite/funcs_1/t/myisam_views.test b/mysql-test/suite/funcs_1/t/myisam_views-big.test index fe72843cfaf..21613e78b24 100644 --- a/mysql-test/suite/funcs_1/t/myisam_views.test +++ b/mysql-test/suite/funcs_1/t/myisam_views-big.test @@ -1,6 +1,9 @@ #### suite/funcs_1/t/myisam_views.test --source include/no_valgrind_without_big.inc +# because of a pair of slow Solaris Sparc machines in pb2, +# this test is marked as big: +--source include/big_test.inc # MyISAM tables should be used # diff --git a/mysql-test/suite/handler/aria.result b/mysql-test/suite/handler/aria.result new file mode 100644 index 00000000000..a912a2559e3 --- /dev/null +++ b/mysql-test/suite/handler/aria.result @@ -0,0 +1,671 @@ +SET SESSION STORAGE_ENGINE = Aria; +drop table if exists t1,t3,t4,t5; +create table t1 (a int, b char(10), key a (a), key b (a,b)); +insert into t1 values +(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), +(14,"aaa"),(16,"ccc"),(16,"xxx"), +(20,"ggg"),(21,"hhh"),(22,"iii"); +handler t1 open as t2; +handler t2 read a first; +a b +14 aaa +handler t2 read a next; +a b +16 ccc +handler t2 read a next; +a b +16 xxx +handler t2 read a prev; +a b +16 ccc +handler t2 read a last; +a b +22 iii +handler t2 read a prev; +a b +21 hhh +handler t2 read a prev; +a b +20 ggg +handler t2 read a first; +a b +14 aaa +handler t2 read a prev; +a b +handler t2 read a last; +a b +22 iii +handler t2 read a prev; +a b +21 hhh +handler t2 read a next; +a b +22 iii +handler t2 read a next; +a b +handler t2 read a=(15); +a b +handler t2 read a=(16); +a b +16 ccc +handler t2 read a=(19,"fff"); +ERROR 42000: Too many key parts specified; max 1 parts allowed +handler t2 read b=(19,"fff"); +a b +19 fff +handler t2 read b=(19,"yyy"); +a b +19 yyy +handler t2 read b=(19); +a b +19 fff +handler t1 read a last; +ERROR 42S02: Unknown table 't1' in HANDLER +handler t2 read a=(11); +a b +handler t2 read a>=(11); +a b +14 aaa +handler t2 read a=(18); +a b +18 eee +handler t2 read a>=(18); +a b +18 eee +handler t2 read a>(18); +a b +19 fff +handler t2 read a<=(18); +a b +18 eee +handler t2 read a<(18); +a b +17 ddd +handler t2 read a=(15); +a b +handler t2 read a>=(15); +a b +16 ccc +handler t2 read a>(15); +a b +16 ccc +handler t2 read a<=(15); +a b +14 aaa +handler t2 read a<(15); +a b +14 aaa +handler t2 read a=(54); +a b +handler t2 read a>=(54); +a b +handler t2 read a>(54); +a b +handler t2 read a<=(54); +a b +22 iii +handler t2 read a<(54); +a b +22 iii +handler t2 read a=(1); +a b +handler t2 read a>=(1); +a b +14 aaa +handler t2 read a>(1); +a b +14 aaa +handler t2 read a<=(1); +a b +handler t2 read a<(1); +a b +handler t2 read a first limit 5; +a b +14 aaa +16 ccc +16 xxx +17 ddd +18 eee +handler t2 read a next limit 3; +a b +19 fff +19 yyy +20 ggg +handler t2 read a prev limit 10; +a b +19 yyy +19 fff +18 eee +17 ddd +16 xxx +16 ccc +14 aaa +handler t2 read a>=(16) limit 4; +a b +16 ccc +16 xxx +17 ddd +18 eee +handler t2 read a>=(16) limit 2,2; +a b +17 ddd +18 eee +handler t2 read a last limit 3; +a b +22 iii +21 hhh +20 ggg +handler t2 read a=(19); +a b +19 fff +handler t2 read a=(19) where b="yyy"; +a b +19 yyy +handler t2 read first; +a b +17 ddd +handler t2 read next; +a b +18 eee +handler t2 read next; +a b +19 fff +handler t2 close; +handler t1 open; +handler t1 read a next; +a b +14 aaa +handler t1 read a next; +a b +16 ccc +handler t1 close; +handler t1 open; +handler t1 read a prev; +a b +22 iii +handler t1 read a prev; +a b +21 hhh +handler t1 close; +handler t1 open as t2; +handler t2 read first; +a b +17 ddd +alter table t1 engine = Aria; +handler t2 read first; +ERROR 42S02: Unknown table 't2' in HANDLER +handler t1 open as t2; +drop table t1; +create table t1 (a int not null); +insert into t1 values (17); +handler t2 read first; +ERROR 42S02: Unknown table 't2' in HANDLER +handler t1 open as t2; +alter table t1 engine=CSV; +handler t2 read first; +ERROR 42S02: Unknown table 't2' in HANDLER +drop table t1; +create table t1 (a int); +insert into t1 values (1),(2),(3),(4),(5),(6); +delete from t1 limit 2; +handler t1 open; +handler t1 read first; +a +3 +handler t1 read first limit 1,1; +a +4 +handler t1 read first limit 2,2; +a +5 +6 +delete from t1 limit 3; +handler t1 read first; +a +6 +drop table t1; +create table t1(a int, index (a)); +insert into t1 values (1), (2), (3); +handler t1 open; +handler t1 read a=(W); +ERROR 42S22: Unknown column 'W' in 'field list' +handler t1 read a=(a); +ERROR HY000: Incorrect arguments to HANDLER ... READ +drop table t1; +create table t1 (a char(5)); +insert into t1 values ("Ok"); +handler t1 open as t; +handler t read first; +a +Ok +use mysql; +handler t read first; +a +Ok +handler t close; +handler test.t1 open as t; +handler t read first; +a +Ok +handler t close; +use test; +drop table t1; +create table t1 ( a int, b int, INDEX a (a) ); +insert into t1 values (1,2), (2,1); +handler t1 open; +handler t1 read a=(1) where b=2; +a b +1 2 +handler t1 read a=(1) where b=3; +a b +handler t1 read a=(1) where b=1; +a b +handler t1 close; +drop table t1; +create table t1 (c1 char(20)); +insert into t1 values ("t1"); +handler t1 open as h1; +handler h1 read first limit 9; +c1 +t1 +create table t2 (c1 char(20)); +insert into t2 values ("t2"); +handler t2 open as h2; +handler h2 read first limit 9; +c1 +t2 +create table t3 (c1 char(20)); +insert into t3 values ("t3"); +handler t3 open as h3; +handler h3 read first limit 9; +c1 +t3 +create table t4 (c1 char(20)); +insert into t4 values ("t4"); +handler t4 open as h4; +handler h4 read first limit 9; +c1 +t4 +create table t5 (c1 char(20)); +insert into t5 values ("t5"); +handler t5 open as h5; +handler h5 read first limit 9; +c1 +t5 +alter table t1 engine=MyISAM; +handler h1 read first limit 9; +ERROR 42S02: Unknown table 'h1' in HANDLER +handler h2 read first limit 9; +c1 +t2 +handler h3 read first limit 9; +c1 +t3 +handler h4 read first limit 9; +c1 +t4 +handler h5 read first limit 9; +c1 +t5 +alter table t5 engine=MyISAM; +handler h1 read first limit 9; +ERROR 42S02: Unknown table 'h1' in HANDLER +handler h2 read first limit 9; +c1 +t2 +handler h3 read first limit 9; +c1 +t3 +handler h4 read first limit 9; +c1 +t4 +handler h5 read first limit 9; +ERROR 42S02: Unknown table 'h5' in HANDLER +alter table t3 engine=MyISAM; +handler h1 read first limit 9; +ERROR 42S02: Unknown table 'h1' in HANDLER +handler h2 read first limit 9; +c1 +t2 +handler h3 read first limit 9; +ERROR 42S02: Unknown table 'h3' in HANDLER +handler h4 read first limit 9; +c1 +t4 +handler h5 read first limit 9; +ERROR 42S02: Unknown table 'h5' in HANDLER +handler h2 close; +handler h4 close; +handler t1 open as h1_1; +handler t1 open as h1_2; +handler t1 open as h1_3; +handler h1_1 read first limit 9; +c1 +t1 +handler h1_2 read first limit 9; +c1 +t1 +handler h1_3 read first limit 9; +c1 +t1 +alter table t1 engine=Aria; +handler h1_1 read first limit 9; +ERROR 42S02: Unknown table 'h1_1' in HANDLER +handler h1_2 read first limit 9; +ERROR 42S02: Unknown table 'h1_2' in HANDLER +handler h1_3 read first limit 9; +ERROR 42S02: Unknown table 'h1_3' in HANDLER +drop table t1; +drop table t2; +drop table t3; +drop table t4; +drop table t5; +create table t1 (c1 int); +insert into t1 values (1); +handler t1 open; +handler t1 read first; +c1 +1 +send the below to another connection, do not wait for the result +optimize table t1; +proceed with the normal connection +handler t1 read next; +c1 +1 +handler t1 close; +read the result from the other connection +Table Op Msg_type Msg_text +test.t1 optimize status OK +proceed with the normal connection +drop table t1; +CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)); +INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2); +HANDLER t1 OPEN; +HANDLER t1 READ `primary` = (1, 1000); +no1 no2 +HANDLER t1 READ `primary` PREV; +no1 no2 +1 275 +HANDLER t1 READ `primary` = (1, 1000); +no1 no2 +HANDLER t1 READ `primary` NEXT; +no1 no2 +2 6 +DROP TABLE t1; +create table t1 (c1 int); +insert into t1 values (14397); +flush tables with read lock; +drop table t1; +ERROR HY000: Can't execute the query because you have a conflicting read lock +send the below to another connection, do not wait for the result +drop table t1; +proceed with the normal connection +select * from t1; +c1 +14397 +unlock tables; +read the result from the other connection +proceed with the normal connection +select * from t1; +ERROR 42S02: Table 'test.t1' doesn't exist +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +create table t1 (a int not null) ENGINE=CSV; +--> client 2 +handler t1 open; +ERROR HY000: Table storage engine for 't1' doesn't have this option +--> client 1 +drop table t1; +create table t1 (a int); +handler t1 open as t1_alias; +handler t1_alias read a next; +ERROR 42000: Key 'a' doesn't exist in table 't1_alias' +handler t1_alias READ a next where inexistent > 0; +ERROR 42S22: Unknown column 'inexistent' in 'field list' +handler t1_alias read a next; +ERROR 42000: Key 'a' doesn't exist in table 't1_alias' +handler t1_alias READ a next where inexistent > 0; +ERROR 42S22: Unknown column 'inexistent' in 'field list' +handler t1_alias close; +drop table t1; +create temporary table t1 (a int, b char(1), key a (a), key b(a,b)); +insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), +(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"),(9,'k'); +select a,b from t1; +a b +0 a +1 b +2 c +3 d +4 e +5 f +6 g +7 h +8 i +9 j +9 k +handler t1 open as a1; +handler a1 read a=(1); +a b +1 b +handler a1 read a next; +a b +2 c +handler a1 read a next; +a b +3 d +select a,b from t1; +ERROR HY000: Can't reopen table: 'a1' +handler a1 read a prev; +a b +2 c +handler a1 read a prev; +a b +1 b +handler a1 read a=(6) where b="g"; +a b +6 g +handler a1 close; +select a,b from t1; +a b +0 a +1 b +2 c +3 d +4 e +5 f +6 g +7 h +8 i +9 j +9 k +handler t1 open as a2; +handler a2 read a=(9); +a b +9 j +handler a2 read a next; +a b +9 k +handler a2 read a prev limit 2; +a b +9 j +8 i +handler a2 read a last; +a b +9 k +handler a2 read a prev; +a b +9 j +handler a2 close; +drop table t1; +create table t1 (a int); +create temporary table t2 (a int, key (a)); +handler t1 open as a1; +handler t2 open as a2; +handler a2 read a first; +a +drop table t1, t2; +handler a2 read a next; +ERROR 42S02: Unknown table 'a2' in HANDLER +handler a1 close; +ERROR 42S02: Unknown table 'a1' in HANDLER +create table t1 (a int, key (a)); +create table t2 like t1; +handler t1 open as a1; +handler t2 open as a2; +handler a1 read a first; +a +handler a2 read a first; +a +alter table t1 add b int; +handler a1 close; +ERROR 42S02: Unknown table 'a1' in HANDLER +handler a2 close; +drop table t1, t2; +create table t1 (a int, key (a)); +handler t1 open as a1; +handler a1 read a first; +a +rename table t1 to t2; +handler a1 read a first; +ERROR 42S02: Unknown table 'a1' in HANDLER +drop table t2; +create table t1 (a int, key (a)); +create table t2 like t1; +handler t1 open as a1; +handler t2 open as a2; +handler a1 read a first; +a +handler a2 read a first; +a +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +handler a1 close; +ERROR 42S02: Unknown table 'a1' in HANDLER +handler a2 close; +drop table t1, t2; +# +# BUG#51877 - HANDLER interface causes invalid memory read +# +CREATE TABLE t1(a INT, KEY (a)); +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +a +INSERT INTO t1 VALUES(1); +HANDLER t1 READ a NEXT; +a +1 +HANDLER t1 CLOSE; +DROP TABLE t1; +# +# BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash +# +CREATE TABLE t1 AS SELECT 1 AS f1; +HANDLER t1 OPEN; +TRUNCATE t1; +HANDLER t1 READ FIRST; +ERROR 42S02: Unknown table 't1' in HANDLER +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 AS SELECT 1 AS f1; +HANDLER t1 OPEN; +TRUNCATE t1; +HANDLER t1 READ FIRST; +ERROR 42S02: Unknown table 't1' in HANDLER +DROP TABLE t1; +# +# Bug #54007: assert in ha_myisam::index_next , HANDLER +# +CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b)); +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +a b +HANDLER t1 READ `PRIMARY` NEXT; +a b +HANDLER t1 READ ab NEXT; +a b +HANDLER t1 READ b NEXT; +a b +HANDLER t1 READ NEXT; +a b +HANDLER t1 CLOSE; +INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30); +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +a b +2 20 +HANDLER t1 READ NEXT; +a b +1 10 +HANDLER t1 READ `PRIMARY` NEXT; +a b +1 10 +HANDLER t1 READ `PRIMARY` NEXT; +a b +2 20 +HANDLER t1 READ ab NEXT; +a b +1 10 +HANDLER t1 READ ab NEXT; +a b +2 20 +HANDLER t1 READ b NEXT; +a b +1 10 +HANDLER t1 READ b NEXT; +a b +2 20 +HANDLER t1 READ b NEXT; +a b +3 30 +HANDLER t1 READ b NEXT; +a b +4 40 +HANDLER t1 READ b NEXT; +a b +HANDLER t1 READ NEXT; +a b +2 20 +HANDLER t1 READ NEXT; +a b +1 10 +HANDLER t1 READ NEXT; +a b +4 40 +HANDLER t1 CLOSE; +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +a b +2 20 +HANDLER t1 READ `PRIMARY` PREV; +a b +4 40 +HANDLER t1 READ `PRIMARY` PREV; +a b +3 30 +HANDLER t1 READ b PREV; +a b +4 40 +HANDLER t1 READ b PREV; +a b +3 30 +HANDLER t1 CLOSE; +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +a b +2 20 +HANDLER t1 READ `PRIMARY` PREV LIMIT 3; +a b +4 40 +3 30 +2 20 +HANDLER t1 READ b NEXT LIMIT 5; +a b +1 10 +2 20 +3 30 +4 40 +HANDLER t1 CLOSE; +DROP TABLE t1; +End of 5.1 tests diff --git a/mysql-test/suite/handler/aria.test b/mysql-test/suite/handler/aria.test new file mode 100644 index 00000000000..1913d2b791c --- /dev/null +++ b/mysql-test/suite/handler/aria.test @@ -0,0 +1,82 @@ +# t/handler_innodb.test +# +# test of HANDLER ... +# +# Last update: +# 2006-07-31 ML test refactored (MySQL 5.1) +# code of t/handler.test and t/innodb_handler.test united +# main testing code put into handler.inc +# rename t/innodb_handler.test to t/handler_innodb.test +# + +--source include/have_maria.inc +let $engine_type= Aria; + +--source init.inc +--source handler.inc + +--echo # +--echo # BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash +--echo # +CREATE TABLE t1 AS SELECT 1 AS f1; +HANDLER t1 OPEN; +TRUNCATE t1; +--error ER_UNKNOWN_TABLE +HANDLER t1 READ FIRST; +DROP TABLE t1; + +CREATE TEMPORARY TABLE t1 AS SELECT 1 AS f1; +HANDLER t1 OPEN; +TRUNCATE t1; +--error ER_UNKNOWN_TABLE +HANDLER t1 READ FIRST; +DROP TABLE t1; + +--echo # +--echo # Bug #54007: assert in ha_myisam::index_next , HANDLER +--echo # +CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b)); + +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +HANDLER t1 READ `PRIMARY` NEXT; +HANDLER t1 READ ab NEXT; +HANDLER t1 READ b NEXT; +HANDLER t1 READ NEXT; +HANDLER t1 CLOSE; + +INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30); +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +HANDLER t1 READ NEXT; +HANDLER t1 READ `PRIMARY` NEXT; +HANDLER t1 READ `PRIMARY` NEXT; +HANDLER t1 READ ab NEXT; +HANDLER t1 READ ab NEXT; +HANDLER t1 READ b NEXT; +HANDLER t1 READ b NEXT; +HANDLER t1 READ b NEXT; +HANDLER t1 READ b NEXT; +HANDLER t1 READ b NEXT; +HANDLER t1 READ NEXT; +HANDLER t1 READ NEXT; +HANDLER t1 READ NEXT; +HANDLER t1 CLOSE; + +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +HANDLER t1 READ `PRIMARY` PREV; +HANDLER t1 READ `PRIMARY` PREV; +HANDLER t1 READ b PREV; +HANDLER t1 READ b PREV; +HANDLER t1 CLOSE; + +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +HANDLER t1 READ `PRIMARY` PREV LIMIT 3; +HANDLER t1 READ b NEXT LIMIT 5; +HANDLER t1 CLOSE; + +DROP TABLE t1; + +--echo End of 5.1 tests diff --git a/mysql-test/include/handler.inc b/mysql-test/suite/handler/handler.inc index 6e7f53ba9b2..48ed2ce0b8a 100644 --- a/mysql-test/include/handler.inc +++ b/mysql-test/suite/handler/handler.inc @@ -1,5 +1,7 @@ -# include/handler.inc +# handler.inc # +# See init.inc for setup of variables for this script +# # The variables # $engine_type -- storage engine to be tested # $other_engine_type -- storage engine <> $engine_type @@ -8,31 +10,19 @@ # 2. $other_handler_engine_type must point to an all # time available storage engine # 2006-08 MySQL 5.1 MyISAM and MEMORY only -# have to be set before sourcing this script. --- source include/not_embedded.inc # # test of HANDLER ... # # Last update: # 2006-07-31 ML test refactored (MySQL 5.1) # code of t/handler.test and t/innodb_handler.test united -# main testing code put into include/handler.inc +# main testing code put into handler.inc # -eval SET SESSION STORAGE_ENGINE = $engine_type; - ---disable_warnings -drop table if exists t1,t3,t4,t5; ---enable_warnings - -create table t1 (a int, b char(10), key a(a), key b(a,b)); -insert into t1 values -(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), -(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"), -(20,"ggg"),(21,"hhh"),(22,"iii"); +# +# Start testing the table created in init.inc +# handler t1 open as t2; --- error 1064 -handler t2 read a=(SELECT 1); handler t2 read a first; handler t2 read a next; handler t2 read a next; @@ -65,12 +55,34 @@ handler t1 read a last; handler t2 read a=(11); handler t2 read a>=(11); +# Search on something we ca nfind handler t2 read a=(18); handler t2 read a>=(18); handler t2 read a>(18); handler t2 read a<=(18); handler t2 read a<(18); +# Search on something we can't find +handler t2 read a=(15); +handler t2 read a>=(15); +handler t2 read a>(15); +handler t2 read a<=(15); +handler t2 read a<(15); + +# Search from upper end +handler t2 read a=(54); +handler t2 read a>=(54); +handler t2 read a>(54); +handler t2 read a<=(54); +handler t2 read a<(54); + +# Search from lower end +handler t2 read a=(1); +handler t2 read a>=(1); +handler t2 read a>(1); +handler t2 read a<=(1); +handler t2 read a<(1); + handler t2 read a first limit 5; handler t2 read a next limit 3; handler t2 read a prev limit 10; @@ -85,8 +97,6 @@ handler t2 read a=(19) where b="yyy"; handler t2 read first; handler t2 read next; handler t2 read next; ---error 1064 -handler t2 read last; handler t2 close; handler t1 open; @@ -110,7 +120,7 @@ handler t2 read first; # handler t1 open as t2; drop table t1; -create table t1 (a int); +create table t1 (a int not null); insert into t1 values (17); --error 1109 handler t2 read first; @@ -137,7 +147,7 @@ drop table t1; # # Test for #751 # -create table t1(a int, index(a)); +eval create table t1(a int, index $key_type (a)); insert into t1 values (1), (2), (3); handler t1 open; --error 1054 @@ -164,7 +174,7 @@ drop table t1; # # BUG#3649 # -create table t1 ( a int, b int, INDEX a (a) ); +eval create table t1 ( a int, b int, INDEX a $key_type (a) ); insert into t1 values (1,2), (2,1); handler t1 open; handler t1 read a=(1) where b=2; @@ -174,143 +184,6 @@ handler t1 close; drop table t1; # -# Check if two database names beginning the same are seen as different. -# -# This database begins like the usual 'test' database. -# ---disable_warnings -drop database if exists test_test; ---enable_warnings -create database test_test; -use test_test; -create table t1(table_id char(20) primary key); -insert into t1 values ('test_test.t1'); -insert into t1 values (''); -handler t1 open; -handler t1 read first limit 9; -create table t2(table_id char(20) primary key); -insert into t2 values ('test_test.t2'); -insert into t2 values (''); -handler t2 open; -handler t2 read first limit 9; -# -# This is the usual 'test' database. -# -use test; ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1(table_id char(20) primary key); -insert into t1 values ('test.t1'); -insert into t1 values (''); ---error 1066 -handler t1 open; -# -# Check accesibility of all the tables. -# -use test; ---error 1064 -handler test.t1 read first limit 9; ---error 1064 -handler test_test.t1 read first limit 9; -handler t1 read first limit 9; ---error 1064 -handler test_test.t2 read first limit 9; -handler t2 read first limit 9; - -# -# Cleanup. -# - ---error 1064 -handler test_test.t1 close; -handler t1 close; -drop table test_test.t1; ---error 1064 -handler test_test.t2 close; -handler t2 close; -drop table test_test.t2; -drop database test_test; - -# -use test; ---error 1064 -handler test.t1 close; ---error 1109 -handler t1 close; -drop table test.t1; - -# -# BUG#4335 -# ---disable_warnings -drop database if exists test_test; -drop table if exists t1; -drop table if exists t2; -drop table if exists t3; ---enable_warnings -create database test_test; -use test_test; -create table t1 (c1 char(20)); -insert into t1 values ('test_test.t1'); -create table t3 (c1 char(20)); -insert into t3 values ('test_test.t3'); -handler t1 open; -handler t1 read first limit 9; -handler t1 open h1; -handler h1 read first limit 9; -use test; -create table t1 (c1 char(20)); -create table t2 (c1 char(20)); -create table t3 (c1 char(20)); -insert into t1 values ('t1'); -insert into t2 values ('t2'); -insert into t3 values ('t3'); ---error 1066 -handler t1 open; ---error 1066 -handler t2 open t1; ---error 1066 -handler t3 open t1; -handler t1 read first limit 9; ---error 1064 -handler test.t1 close; ---error 1066 -handler test.t1 open h1; ---error 1066 -handler test_test.t1 open h1; -handler test_test.t3 open h3; -handler test.t1 open h2; -handler t1 read first limit 9; -handler h1 read first limit 9; -handler h2 read first limit 9; -handler h3 read first limit 9; -handler h2 read first limit 9; ---error 1064 -handler test.h1 close; -handler t1 close; -handler h1 close; -handler h2 close; ---error 1109 -handler t1 read first limit 9; ---error 1109 -handler h1 read first limit 9; ---error 1109 -handler h2 read first limit 9; -handler h3 read first limit 9; -handler h3 read first limit 9; -use test_test; -handler h3 read first limit 9; ---error 1064 -handler test.h3 read first limit 9; -handler h3 close; -use test; -drop table t3; -drop table t2; -drop table t1; -drop database test_test; - -# # Test if fix for BUG#4286 correctly closes handler tables. # create table t1 (c1 char(20)); @@ -410,11 +283,13 @@ reap; connection default; drop table t1; -CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)); +eval CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY $key_type (no1,no2)); INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2); HANDLER t1 OPEN; HANDLER t1 READ `primary` = (1, 1000); HANDLER t1 READ `primary` PREV; +HANDLER t1 READ `primary` = (1, 1000); +HANDLER t1 READ `primary` NEXT; DROP TABLE t1; # End of 4.1 tests @@ -468,10 +343,7 @@ drop table if exists t1; # # Bug#25856 - HANDLER table OPEN in one connection lock DROP TABLE in another one # ---disable_warnings -drop table if exists t1; ---enable_warnings -eval create table t1 (a int) ENGINE=$other_engine_type; +eval create table t1 (a int not null) ENGINE=$other_engine_type; --echo --> client 2 connection con2; --error 1031 @@ -484,9 +356,6 @@ disconnect con2; # # Bug#30632 HANDLER read failure causes hang # ---disable_warnings -drop table if exists t1; ---enable_warnings create table t1 (a int); handler t1 open as t1_alias; --error 1176 @@ -501,89 +370,18 @@ handler t1_alias close; drop table t1; # -# Bug#21587 FLUSH TABLES causes server crash when used with HANDLER statements -# - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings -create table t1 (c1 int); -create table t2 (c1 int); -insert into t1 values (1); -insert into t2 values (2); ---echo connection: default -handler t1 open; -handler t1 read first; -connect (flush,localhost,root,,); -connection flush; ---echo connection: flush ---send flush tables; -connection default; ---echo connection: default -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Flushing tables"; ---source include/wait_condition.inc -handler t2 open; -handler t2 read first; -handler t1 read next; -handler t1 close; -handler t2 close; -connection flush; -reap; -connection default; -drop table t1,t2; -disconnect flush; - -# -# Bug#31409 RENAME TABLE causes server crash or deadlock when used with HANDLER statements -# - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings -create table t1 (c1 int); ---echo connection: default -handler t1 open; -handler t1 read first; -connect (flush,localhost,root,,); -connection flush; ---echo connection: flush ---send rename table t1 to t2; -connection default; ---echo connection: default -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t2"; ---source include/wait_condition.inc -handler t2 open; -handler t2 read first; ---error ER_NO_SUCH_TABLE -handler t1 read next; -handler t1 close; -handler t2 close; -connection flush; -reap; -connection default; -drop table t2; -disconnect flush; - -# # Bug#30882 Dropping a temporary table inside a stored function may cause a server crash # # Test HANDLER statements in conjunction with temporary tables. While the temporary table # is open by a HANDLER, no other statement can access it. # ---disable_warnings -drop table if exists t1; ---enable_warnings -create temporary table t1 (a int, b char(1), key a(a), key b(a,b)); +eval create temporary table t1 (a int, b char(1), key a $key_type (a), key b(a,b)); insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), - (5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); + (5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"),(9,'k'); select a,b from t1; handler t1 open as a1; -handler a1 read a first; +handler a1 read a=(1); handler a1 read a next; handler a1 read a next; --error ER_CANT_REOPEN_TABLE @@ -594,41 +392,19 @@ handler a1 read a=(6) where b="g"; handler a1 close; select a,b from t1; handler t1 open as a2; -handler a2 read a first; +handler a2 read a=(9); +handler a2 read a next; +handler a2 read a prev limit 2; +--error 0,1031 handler a2 read a last; handler a2 read a prev; handler a2 close; drop table t1; -# -# Bug#31397 Inconsistent drop table behavior of handler tables. -# - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings -create table t1 (a int); -handler t1 open as t1_alias; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -flush tables; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -handler t1_alias close; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -handler t1_alias read first; -drop table t1; ---error ER_UNKNOWN_TABLE -handler t1_alias read next; - # Test that temporary tables associated with handlers are properly dropped. create table t1 (a int); -create temporary table t2 (a int, key(a)); +eval create temporary table t2 (a int, key $key_type (a)); handler t1 open as a1; handler t2 open as a2; handler a2 read a first; @@ -640,7 +416,7 @@ handler a1 close; # Alter table drop handlers -create table t1 (a int, key(a)); +eval create table t1 (a int, key $key_type (a)); create table t2 like t1; handler t1 open as a1; handler t2 open as a2; @@ -654,7 +430,7 @@ drop table t1, t2; # Rename table drop handlers -create table t1 (a int, key(a)); +eval create table t1 (a int, key $key_type (a)); handler t1 open as a1; handler a1 read a first; rename table t1 to t2; @@ -664,7 +440,7 @@ drop table t2; # Optimize table drop handlers -create table t1 (a int, key(a)); +eval create table t1 (a int, key $key_type (a)); create table t2 like t1; handler t1 open as a1; handler t2 open as a2; @@ -676,56 +452,14 @@ handler a1 close; handler a2 close; drop table t1, t2; -# Flush tables causes handlers reopen - -create table t1 (a int, b char(1), key a(a), key b(a,b)); -insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), - (5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); -handler t1 open; -handler t1 read a first; -handler t1 read a next; -flush tables; -handler t1 read a next; -handler t1 read a next; -flush tables with read lock; -handler t1 read a next; -unlock tables; -drop table t1; ---error ER_UNKNOWN_TABLE -handler t1 read a next; - -# -# Bug#41110: crash with handler command when used concurrently with alter table -# Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table -# - ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1 (a int); -insert into t1 values (1); -handler t1 open; -connect(con1,localhost,root,,); -send alter table t1 engine=memory; -connection default; -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "rename result table" and info = "alter table t1 engine=memory"; ---source include/wait_condition.inc ---error ER_ILLEGAL_HA -handler t1 read a next; -handler t1 close; -connection con1; ---reap -drop table t1; -disconnect con1; ---source include/wait_until_disconnected.inc -connection default; - -# -# Bug#44151 using handler commands on information_schema tables crashes server -# -USE information_schema; ---error ER_WRONG_USAGE -HANDLER COLUMNS OPEN; -USE test; +--echo # +--echo # BUG#51877 - HANDLER interface causes invalid memory read +--echo # +eval CREATE TABLE t1(a INT, KEY $key_type (a)); +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +INSERT INTO t1 VALUES(1); +--error 0,ER_CHECKREAD +HANDLER t1 READ a NEXT; +HANDLER t1 CLOSE; +DROP TABLE t1; diff --git a/mysql-test/suite/handler/init.inc b/mysql-test/suite/handler/init.inc new file mode 100644 index 00000000000..32c6010f95b --- /dev/null +++ b/mysql-test/suite/handler/init.inc @@ -0,0 +1,33 @@ +# Setup things for handler.inc +# +# Input variables +# $engine_type -- storage engine to be tested +# $key_type -- set if you want a non standard key type +# +# This scripts sets up default values for: +# $other_engine_type -- storage engine <> $engine_type +# $other_handler_engine_type -- storage engine <> $engine_type, if possible +# 1. $other_handler_engine_type must support handler +# 2. $other_handler_engine_type must point to an all +# time available storage engine +# have to be set before sourcing this script. +# +# Handler tests don't work with embedded server +# +-- source include/not_embedded.inc + +eval SET SESSION STORAGE_ENGINE = $engine_type; +let $other_engine_type= CSV; +let $other_handler_engine_type= MyISAM; + +--disable_warnings +drop table if exists t1,t3,t4,t5; +--enable_warnings + +# Create default test table + +eval create table t1 (a int, b char(10), key a $key_type (a), key b $key_type (a,b)); +insert into t1 values +(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), +(14,"aaa"),(16,"ccc"),(16,"xxx"), +(20,"ggg"),(21,"hhh"),(22,"iii"); diff --git a/mysql-test/r/handler_innodb.result b/mysql-test/suite/handler/innodb.result index 957fc30acef..2cdaa0c4664 100644 --- a/mysql-test/r/handler_innodb.result +++ b/mysql-test/suite/handler/innodb.result @@ -1,25 +1,23 @@ SET SESSION STORAGE_ENGINE = InnoDB; drop table if exists t1,t3,t4,t5; -create table t1 (a int, b char(10), key a(a), key b(a,b)); +create table t1 (a int, b char(10), key a (a), key b (a,b)); insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), -(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"), +(14,"aaa"),(16,"ccc"),(16,"xxx"), (20,"ggg"),(21,"hhh"),(22,"iii"); handler t1 open as t2; -handler t2 read a=(SELECT 1); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1)' at line 1 handler t2 read a first; a b 14 aaa handler t2 read a next; a b -15 bbb +16 ccc handler t2 read a next; a b -16 ccc +16 xxx handler t2 read a prev; a b -15 bbb +16 ccc handler t2 read a last; a b 22 iii @@ -47,7 +45,6 @@ handler t2 read a next; a b handler t2 read a=(15); a b -15 bbb handler t2 read a=(16); a b 16 ccc @@ -84,26 +81,64 @@ a b handler t2 read a<(18); a b 17 ddd +handler t2 read a=(15); +a b +handler t2 read a>=(15); +a b +16 ccc +handler t2 read a>(15); +a b +16 ccc +handler t2 read a<=(15); +a b +14 aaa +handler t2 read a<(15); +a b +14 aaa +handler t2 read a=(54); +a b +handler t2 read a>=(54); +a b +handler t2 read a>(54); +a b +handler t2 read a<=(54); +a b +22 iii +handler t2 read a<(54); +a b +22 iii +handler t2 read a=(1); +a b +handler t2 read a>=(1); +a b +14 aaa +handler t2 read a>(1); +a b +14 aaa +handler t2 read a<=(1); +a b +handler t2 read a<(1); +a b handler t2 read a first limit 5; a b 14 aaa -15 bbb 16 ccc 16 xxx 17 ddd +18 eee handler t2 read a next limit 3; a b -18 eee 19 fff 19 yyy +20 ggg handler t2 read a prev limit 10; a b +19 yyy 19 fff 18 eee 17 ddd 16 xxx 16 ccc -15 bbb 14 aaa handler t2 read a>=(16) limit 4; a b @@ -135,8 +170,6 @@ a b handler t2 read next; a b 19 fff -handler t2 read last; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 handler t2 close; handler t1 open; handler t1 read a next; @@ -144,7 +177,7 @@ a b 14 aaa handler t1 read a next; a b -15 bbb +16 ccc handler t1 close; handler t1 open; handler t1 read a prev; @@ -163,12 +196,12 @@ handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER handler t1 open as t2; drop table t1; -create table t1 (a int); +create table t1 (a int not null); insert into t1 values (17); handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER handler t1 open as t2; -alter table t1 engine=MEMORY; +alter table t1 engine=CSV; handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER drop table t1; @@ -191,7 +224,7 @@ handler t1 read first; a 6 drop table t1; -create table t1(a int, index(a)); +create table t1(a int, index (a)); insert into t1 values (1), (2), (3); handler t1 open; handler t1 read a=(W); @@ -217,7 +250,7 @@ Ok handler t close; use test; drop table t1; -create table t1 ( a int, b int, INDEX a (a) ); +create table t1 ( a int, b int, INDEX a (a) ); insert into t1 values (1,2), (2,1); handler t1 open; handler t1 read a=(1) where b=2; @@ -229,148 +262,6 @@ handler t1 read a=(1) where b=1; a b handler t1 close; drop table t1; -drop database if exists test_test; -create database test_test; -use test_test; -create table t1(table_id char(20) primary key); -insert into t1 values ('test_test.t1'); -insert into t1 values (''); -handler t1 open; -handler t1 read first limit 9; -table_id - -test_test.t1 -create table t2(table_id char(20) primary key); -insert into t2 values ('test_test.t2'); -insert into t2 values (''); -handler t2 open; -handler t2 read first limit 9; -table_id - -test_test.t2 -use test; -drop table if exists t1; -create table t1(table_id char(20) primary key); -insert into t1 values ('test.t1'); -insert into t1 values (''); -handler t1 open; -ERROR 42000: Not unique table/alias: 't1' -use test; -handler test.t1 read first limit 9; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 -handler test_test.t1 read first limit 9; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 -handler t1 read first limit 9; -table_id - -test_test.t1 -handler test_test.t2 read first limit 9; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 -handler t2 read first limit 9; -table_id - -test_test.t2 -handler test_test.t1 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler t1 close; -drop table test_test.t1; -handler test_test.t2 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler t2 close; -drop table test_test.t2; -drop database test_test; -use test; -handler test.t1 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler t1 close; -ERROR 42S02: Unknown table 't1' in HANDLER -drop table test.t1; -drop database if exists test_test; -drop table if exists t1; -drop table if exists t2; -drop table if exists t3; -create database test_test; -use test_test; -create table t1 (c1 char(20)); -insert into t1 values ('test_test.t1'); -create table t3 (c1 char(20)); -insert into t3 values ('test_test.t3'); -handler t1 open; -handler t1 read first limit 9; -c1 -test_test.t1 -handler t1 open h1; -handler h1 read first limit 9; -c1 -test_test.t1 -use test; -create table t1 (c1 char(20)); -create table t2 (c1 char(20)); -create table t3 (c1 char(20)); -insert into t1 values ('t1'); -insert into t2 values ('t2'); -insert into t3 values ('t3'); -handler t1 open; -ERROR 42000: Not unique table/alias: 't1' -handler t2 open t1; -ERROR 42000: Not unique table/alias: 't1' -handler t3 open t1; -ERROR 42000: Not unique table/alias: 't1' -handler t1 read first limit 9; -c1 -test_test.t1 -handler test.t1 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler test.t1 open h1; -ERROR 42000: Not unique table/alias: 'h1' -handler test_test.t1 open h1; -ERROR 42000: Not unique table/alias: 'h1' -handler test_test.t3 open h3; -handler test.t1 open h2; -handler t1 read first limit 9; -c1 -test_test.t1 -handler h1 read first limit 9; -c1 -test_test.t1 -handler h2 read first limit 9; -c1 -t1 -handler h3 read first limit 9; -c1 -test_test.t3 -handler h2 read first limit 9; -c1 -t1 -handler test.h1 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler t1 close; -handler h1 close; -handler h2 close; -handler t1 read first limit 9; -ERROR 42S02: Unknown table 't1' in HANDLER -handler h1 read first limit 9; -ERROR 42S02: Unknown table 'h1' in HANDLER -handler h2 read first limit 9; -ERROR 42S02: Unknown table 'h2' in HANDLER -handler h3 read first limit 9; -c1 -test_test.t3 -handler h3 read first limit 9; -c1 -test_test.t3 -use test_test; -handler h3 read first limit 9; -c1 -test_test.t3 -handler test.h3 read first limit 9; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 -handler h3 close; -use test; -drop table t3; -drop table t2; -drop table t1; -drop database test_test; create table t1 (c1 char(20)); insert into t1 values ("t1"); handler t1 open as h1; @@ -496,6 +387,11 @@ no1 no2 HANDLER t1 READ `primary` PREV; no1 no2 1 275 +HANDLER t1 READ `primary` = (1, 1000); +no1 no2 +HANDLER t1 READ `primary` NEXT; +no1 no2 +2 8 DROP TABLE t1; create table t1 (c1 int); insert into t1 values (14397); @@ -516,14 +412,12 @@ ERROR 42S02: Table 'test.t1' doesn't exist drop table if exists t1; Warnings: Note 1051 Unknown table 't1' -drop table if exists t1; -create table t1 (a int) ENGINE=MEMORY; +create table t1 (a int not null) ENGINE=CSV; --> client 2 handler t1 open; ERROR HY000: Table storage engine for 't1' doesn't have this option --> client 1 drop table t1; -drop table if exists t1; create table t1 (a int); handler t1 open as t1_alias; handler t1_alias read a next; @@ -536,50 +430,9 @@ handler t1_alias READ a next where inexistent > 0; ERROR 42S22: Unknown column 'inexistent' in 'field list' handler t1_alias close; drop table t1; -drop table if exists t1,t2; -create table t1 (c1 int); -create table t2 (c1 int); -insert into t1 values (1); -insert into t2 values (2); -connection: default -handler t1 open; -handler t1 read first; -c1 -1 -connection: flush -flush tables;; -connection: default -handler t2 open; -handler t2 read first; -c1 -2 -handler t1 read next; -c1 -1 -handler t1 close; -handler t2 close; -drop table t1,t2; -drop table if exists t1,t2; -create table t1 (c1 int); -connection: default -handler t1 open; -handler t1 read first; -c1 -connection: flush -rename table t1 to t2;; -connection: default -handler t2 open; -handler t2 read first; -c1 -handler t1 read next; -ERROR 42S02: Table 'test.t1' doesn't exist -handler t1 close; -handler t2 close; -drop table t2; -drop table if exists t1; -create temporary table t1 (a int, b char(1), key a(a), key b(a,b)); +create temporary table t1 (a int, b char(1), key a (a), key b(a,b)); insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), -(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); +(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"),(9,'k'); select a,b from t1; a b 0 a @@ -592,24 +445,25 @@ a b 7 h 8 i 9 j +9 k handler t1 open as a1; -handler a1 read a first; -a b -0 a -handler a1 read a next; +handler a1 read a=(1); a b 1 b handler a1 read a next; a b 2 c +handler a1 read a next; +a b +3 d select a,b from t1; ERROR HY000: Can't reopen table: 'a1' handler a1 read a prev; a b -1 b +2 c handler a1 read a prev; a b -0 a +1 b handler a1 read a=(6) where b="g"; a b 6 g @@ -626,39 +480,28 @@ a b 7 h 8 i 9 j +9 k handler t1 open as a2; -handler a2 read a first; +handler a2 read a=(9); a b -0 a -handler a2 read a last; +9 j +handler a2 read a next; +a b +9 k +handler a2 read a prev limit 2; a b 9 j +8 i +handler a2 read a last; +a b +9 k handler a2 read a prev; a b -8 i +9 j handler a2 close; drop table t1; -drop table if exists t1,t2; -create table t1 (a int); -handler t1 open as t1_alias; -drop table t1; create table t1 (a int); -handler t1 open as t1_alias; -flush tables; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -handler t1_alias close; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -handler t1_alias read first; -a -drop table t1; -handler t1_alias read next; -ERROR 42S02: Unknown table 't1_alias' in HANDLER -create table t1 (a int); -create temporary table t2 (a int, key(a)); +create temporary table t2 (a int, key (a)); handler t1 open as a1; handler t2 open as a2; handler a2 read a first; @@ -668,7 +511,7 @@ handler a2 read a next; ERROR 42S02: Unknown table 'a2' in HANDLER handler a1 close; ERROR 42S02: Unknown table 'a1' in HANDLER -create table t1 (a int, key(a)); +create table t1 (a int, key (a)); create table t2 like t1; handler t1 open as a1; handler t2 open as a2; @@ -681,7 +524,7 @@ handler a1 close; ERROR 42S02: Unknown table 'a1' in HANDLER handler a2 close; drop table t1, t2; -create table t1 (a int, key(a)); +create table t1 (a int, key (a)); handler t1 open as a1; handler a1 read a first; a @@ -689,7 +532,7 @@ rename table t1 to t2; handler a1 read a first; ERROR 42S02: Unknown table 'a1' in HANDLER drop table t2; -create table t1 (a int, key(a)); +create table t1 (a int, key (a)); create table t2 like t1; handler t1 open as a1; handler t2 open as a2; @@ -705,41 +548,25 @@ handler a1 close; ERROR 42S02: Unknown table 'a1' in HANDLER handler a2 close; drop table t1, t2; -create table t1 (a int, b char(1), key a(a), key b(a,b)); -insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), -(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); -handler t1 open; -handler t1 read a first; -a b -0 a -handler t1 read a next; -a b -1 b -flush tables; -handler t1 read a next; -a b -0 a -handler t1 read a next; -a b -1 b -flush tables with read lock; -handler t1 read a next; -a b -0 a -unlock tables; -drop table t1; -handler t1 read a next; -ERROR 42S02: Unknown table 't1' in HANDLER -drop table if exists t1; -create table t1 (a int); -insert into t1 values (1); -handler t1 open; -alter table t1 engine=memory; -handler t1 read a next; -ERROR HY000: Table storage engine for 't1' doesn't have this option -handler t1 close; -drop table t1; -USE information_schema; -HANDLER COLUMNS OPEN; -ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema -USE test; +# +# BUG#51877 - HANDLER interface causes invalid memory read +# +CREATE TABLE t1(a INT, KEY (a)); +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +a +INSERT INTO t1 VALUES(1); +HANDLER t1 READ a NEXT; +a +HANDLER t1 CLOSE; +DROP TABLE t1; +CREATE TABLE t1 (f1 integer, f2 integer, primary key (f1), key (f2)) engine=innodb; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3); +HANDLER t1 OPEN; +HANDLER t1 READ FIRST WHERE f2 <= 1; +f1 f2 +1 1 +HANDLER t1 READ `PRIMARY` PREV; +f1 f2 +3 3 +DROP TABLE t1; diff --git a/mysql-test/suite/handler/innodb.test b/mysql-test/suite/handler/innodb.test new file mode 100644 index 00000000000..6527c4bb8bb --- /dev/null +++ b/mysql-test/suite/handler/innodb.test @@ -0,0 +1,28 @@ +# t/handler_innodb.test +# +# test of HANDLER ... +# +# Last update: +# 2006-07-31 ML test refactored (MySQL 5.1) +# code of t/handler.test and t/innodb_handler.test united +# main testing code put into handler.inc +# rename t/innodb_handler.test to t/handler_innodb.test +# + +--source include/have_innodb.inc + +let $engine_type= InnoDB; + +--source init.inc +--source handler.inc + +# +# LP#697610 ha_index_prev(uchar*): Assertion `inited==INDEX' +# + +CREATE TABLE t1 (f1 integer, f2 integer, primary key (f1), key (f2)) engine=innodb; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3); +HANDLER t1 OPEN; +HANDLER t1 READ FIRST WHERE f2 <= 1; +HANDLER t1 READ `PRIMARY` PREV; +DROP TABLE t1; diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result new file mode 100644 index 00000000000..0b5a4447739 --- /dev/null +++ b/mysql-test/suite/handler/interface.result @@ -0,0 +1,259 @@ +drop table if exists t1,t3,t4,t5; +drop database if exists test_test; +SET SESSION STORAGE_ENGINE = MyISAM; +drop table if exists t1,t3,t4,t5; +create table t1 (a int, b char(10), key a (a), key b (a,b)); +insert into t1 values +(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), +(14,"aaa"),(16,"ccc"),(16,"xxx"), +(20,"ggg"),(21,"hhh"),(22,"iii"); +handler t1 open; +handler t1 read a=(SELECT 1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1)' at line 1 +handler t1 read a=(1) FIRST; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FIRST' at line 1 +handler t1 read a=(1) NEXT; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NEXT' at line 1 +handler t1 read last; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +handler t1 close; +drop table t1; +CREATE TABLE t1(a INT, PRIMARY KEY(a)); +insert into t1 values(1),(2); +handler t1 open; +handler t1 read primary=(1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'primary=(1)' at line 1 +handler t1 read `primary`=(1); +a +1 +handler t1 close; +drop table t1; +create database test_test; +use test_test; +create table t1(table_id char(20), primary key (table_id)); +insert into t1 values ('test_test.t1'); +insert into t1 values (''); +handler t1 open; +handler t1 read first limit 9; +table_id +test_test.t1 + +create table t2(table_id char(20), primary key (table_id)); +insert into t2 values ('test_test.t2'); +insert into t2 values (''); +handler t2 open; +handler t2 read first limit 9; +table_id +test_test.t2 + +use test; +create table t1(table_id char(20), primary key (table_id)); +insert into t1 values ('test.t1'); +insert into t1 values (''); +handler t1 open; +ERROR 42000: Not unique table/alias: 't1' +use test; +handler test.t1 read first limit 9; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 +handler test_test.t1 read first limit 9; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 +handler t1 read first limit 9; +table_id +test_test.t1 + +handler test_test.t2 read first limit 9; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 +handler t2 read first limit 9; +table_id +test_test.t2 + +handler test_test.t1 close; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 +handler t1 close; +drop table test_test.t1; +handler test_test.t2 close; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 +handler t2 close; +drop table test_test.t2; +drop database test_test; +use test; +handler test.t1 close; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 +handler t1 close; +ERROR 42S02: Unknown table 't1' in HANDLER +drop table test.t1; +create database test_test; +use test_test; +create table t1 (c1 char(20)); +insert into t1 values ('test_test.t1'); +create table t3 (c1 char(20)); +insert into t3 values ('test_test.t3'); +handler t1 open; +handler t1 read first limit 9; +c1 +test_test.t1 +handler t1 open h1; +handler h1 read first limit 9; +c1 +test_test.t1 +use test; +create table t1 (c1 char(20)); +create table t2 (c1 char(20)); +create table t3 (c1 char(20)); +insert into t1 values ('t1'); +insert into t2 values ('t2'); +insert into t3 values ('t3'); +handler t1 open; +ERROR 42000: Not unique table/alias: 't1' +handler t2 open t1; +ERROR 42000: Not unique table/alias: 't1' +handler t3 open t1; +ERROR 42000: Not unique table/alias: 't1' +handler t1 read first limit 9; +c1 +test_test.t1 +handler test.t1 close; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 +handler test.t1 open h1; +ERROR 42000: Not unique table/alias: 'h1' +handler test_test.t1 open h1; +ERROR 42000: Not unique table/alias: 'h1' +handler test_test.t3 open h3; +handler test.t1 open h2; +handler t1 read first limit 9; +c1 +test_test.t1 +handler h1 read first limit 9; +c1 +test_test.t1 +handler h2 read first limit 9; +c1 +t1 +handler h3 read first limit 9; +c1 +test_test.t3 +handler h2 read first limit 9; +c1 +t1 +handler test.h1 close; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 +handler t1 close; +handler h1 close; +handler h2 close; +handler t1 read first limit 9; +ERROR 42S02: Unknown table 't1' in HANDLER +handler h1 read first limit 9; +ERROR 42S02: Unknown table 'h1' in HANDLER +handler h2 read first limit 9; +ERROR 42S02: Unknown table 'h2' in HANDLER +handler h3 read first limit 9; +c1 +test_test.t3 +handler h3 read first limit 9; +c1 +test_test.t3 +use test_test; +handler h3 read first limit 9; +c1 +test_test.t3 +handler test.h3 read first limit 9; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 +handler h3 close; +use test; +drop table t3; +drop table t2; +drop table t1; +drop database test_test; +create table t1 (c1 int); +create table t2 (c1 int); +insert into t1 values (1); +insert into t2 values (2); +connection: default +handler t1 open; +handler t1 read first; +c1 +1 +connection: flush +flush tables;; +connection: default +handler t2 open; +handler t2 read first; +c1 +2 +handler t1 read next; +c1 +1 +handler t1 close; +handler t2 close; +drop table t1,t2; +create table t1 (a int); +handler t1 open as t1_alias; +drop table t1; +create table t1 (a int); +handler t1 open as t1_alias; +flush tables; +drop table t1; +create table t1 (a int); +handler t1 open as t1_alias; +handler t1_alias close; +drop table t1; +create table t1 (a int); +handler t1 open as t1_alias; +handler t1_alias read first; +a +drop table t1; +handler t1_alias read next; +ERROR 42S02: Unknown table 't1_alias' in HANDLER +create table t1 (c1 int); +connection: default +handler t1 open; +handler t1 read first; +c1 +connection: flush +rename table t1 to t2;; +connection: default +handler t2 open; +handler t2 read first; +c1 +handler t1 read next; +ERROR 42S02: Table 'test.t1' doesn't exist +handler t1 close; +handler t2 close; +drop table t2; +create table t1 (a int, b char(1), key a (a), key b (a,b)); +insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), +(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); +handler t1 open; +handler t1 read a first; +a b +0 a +handler t1 read a next; +a b +1 b +flush tables; +handler t1 read a next; +a b +0 a +handler t1 read a next; +a b +1 b +flush tables with read lock; +handler t1 read a next; +a b +0 a +unlock tables; +drop table t1; +handler t1 read a next; +ERROR 42S02: Unknown table 't1' in HANDLER +drop table if exists t1; +create table t1 (a int not null); +insert into t1 values (1); +handler t1 open; +alter table t1 engine=csv; +handler t1 read a next; +ERROR HY000: Table storage engine for 't1' doesn't have this option +handler t1 close; +drop table t1; +USE information_schema; +HANDLER COLUMNS OPEN; +ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema diff --git a/mysql-test/suite/handler/interface.test b/mysql-test/suite/handler/interface.test new file mode 100644 index 00000000000..809f0228f98 --- /dev/null +++ b/mysql-test/suite/handler/interface.test @@ -0,0 +1,307 @@ +# +# Tests of handler interface that are system independent +# +# Handler tests don't work yet with embedded server +# +-- source include/not_embedded.inc + +--disable_warnings +drop table if exists t1,t3,t4,t5; +drop database if exists test_test; +--enable_warnings + +# Run tests with myisam (any engine should be ok) + +let $engine_type= MyISAM; + +--source init.inc + +# +# Do some syntax checking +# + +handler t1 open; +--error ER_PARSE_ERROR +handler t1 read a=(SELECT 1); +--error ER_PARSE_ERROR +handler t1 read a=(1) FIRST; +--error ER_PARSE_ERROR +handler t1 read a=(1) NEXT; +--error ER_PARSE_ERROR +handler t1 read last; +handler t1 close; +drop table t1; + +CREATE TABLE t1(a INT, PRIMARY KEY(a)); +insert into t1 values(1),(2); +handler t1 open; +--error ER_PARSE_ERROR +handler t1 read primary=(1); +handler t1 read `primary`=(1); +handler t1 close; +drop table t1; + +# +# Check if two database names beginning the same are seen as different. +# +# This database begins like the usual 'test' database. +# +create database test_test; +use test_test; +eval create table t1(table_id char(20), primary key $key_type (table_id)); +insert into t1 values ('test_test.t1'); +insert into t1 values (''); +handler t1 open; +handler t1 read first limit 9; +eval create table t2(table_id char(20), primary key $key_type (table_id)); +insert into t2 values ('test_test.t2'); +insert into t2 values (''); +handler t2 open; +handler t2 read first limit 9; +# +# This is the usual 'test' database. +# +use test; +eval create table t1(table_id char(20), primary key $key_type (table_id)); +insert into t1 values ('test.t1'); +insert into t1 values (''); +--error 1066 +handler t1 open; +# +# Check accessibility of all the tables. +# +use test; +--error 1064 +handler test.t1 read first limit 9; +--error 1064 +handler test_test.t1 read first limit 9; +handler t1 read first limit 9; +--error 1064 +handler test_test.t2 read first limit 9; +handler t2 read first limit 9; + +# +# Cleanup. +# + +--error 1064 +handler test_test.t1 close; +handler t1 close; +drop table test_test.t1; +--error 1064 +handler test_test.t2 close; +handler t2 close; +drop table test_test.t2; +drop database test_test; + +# +use test; +--error 1064 +handler test.t1 close; +--error 1109 +handler t1 close; +drop table test.t1; + +# +# BUG#4335 one name can be handler open'ed many times +# + +create database test_test; +use test_test; +create table t1 (c1 char(20)); +insert into t1 values ('test_test.t1'); +create table t3 (c1 char(20)); +insert into t3 values ('test_test.t3'); +handler t1 open; +handler t1 read first limit 9; +handler t1 open h1; +handler h1 read first limit 9; +use test; +create table t1 (c1 char(20)); +create table t2 (c1 char(20)); +create table t3 (c1 char(20)); +insert into t1 values ('t1'); +insert into t2 values ('t2'); +insert into t3 values ('t3'); +--error 1066 +handler t1 open; +--error 1066 +handler t2 open t1; +--error 1066 +handler t3 open t1; +handler t1 read first limit 9; +--error 1064 +handler test.t1 close; +--error 1066 +handler test.t1 open h1; +--error 1066 +handler test_test.t1 open h1; +handler test_test.t3 open h3; +handler test.t1 open h2; +handler t1 read first limit 9; +handler h1 read first limit 9; +handler h2 read first limit 9; +handler h3 read first limit 9; +handler h2 read first limit 9; +--error 1064 +handler test.h1 close; +handler t1 close; +handler h1 close; +handler h2 close; +--error 1109 +handler t1 read first limit 9; +--error 1109 +handler h1 read first limit 9; +--error 1109 +handler h2 read first limit 9; +handler h3 read first limit 9; +handler h3 read first limit 9; +use test_test; +handler h3 read first limit 9; +--error 1064 +handler test.h3 read first limit 9; +handler h3 close; +use test; +drop table t3; +drop table t2; +drop table t1; +drop database test_test; + +# +# Bug#21587 FLUSH TABLES causes server crash when used with HANDLER statements +# + +create table t1 (c1 int); +create table t2 (c1 int); +insert into t1 values (1); +insert into t2 values (2); +--echo connection: default +handler t1 open; +handler t1 read first; +connect (flush,localhost,root,,); +connection flush; +--echo connection: flush +--send flush tables; +connection default; +--echo connection: default +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Flushing tables"; +--source include/wait_condition.inc +handler t2 open; +handler t2 read first; +handler t1 read next; +handler t1 close; +handler t2 close; +connection flush; +reap; +connection default; +drop table t1,t2; +disconnect flush; + +# +# Bug#31397 Inconsistent drop table behavior of handler tables. +# + +create table t1 (a int); +handler t1 open as t1_alias; +drop table t1; +create table t1 (a int); +handler t1 open as t1_alias; +flush tables; +drop table t1; +create table t1 (a int); +handler t1 open as t1_alias; +handler t1_alias close; +drop table t1; +create table t1 (a int); +handler t1 open as t1_alias; +handler t1_alias read first; +drop table t1; +--error ER_UNKNOWN_TABLE +handler t1_alias read next; + +# +# Bug#31409 RENAME TABLE causes server crash or deadlock when used with +# HANDLER statements +# + +create table t1 (c1 int); +--echo connection: default +handler t1 open; +handler t1 read first; +connect (flush,localhost,root,,); +connection flush; +--echo connection: flush +--send rename table t1 to t2; +connection default; +--echo connection: default +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table" and info = "rename table t1 to t2"; +--source include/wait_condition.inc +handler t2 open; +handler t2 read first; +--error ER_NO_SUCH_TABLE +handler t1 read next; +handler t1 close; +handler t2 close; +connection flush; +reap; +connection default; +drop table t2; +disconnect flush; + +# Flush tables causes handlers reopen + +eval create table t1 (a int, b char(1), key a $key_type (a), key b $key_type (a,b)); +insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), + (5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); +handler t1 open; +handler t1 read a first; +handler t1 read a next; +flush tables; +handler t1 read a next; +handler t1 read a next; +flush tables with read lock; +handler t1 read a next; +unlock tables; +drop table t1; +--error ER_UNKNOWN_TABLE +handler t1 read a next; + +# +# Bug#41110: crash with handler command when used concurrently with alter table +# Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table +# + +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int not null); +insert into t1 values (1); +handler t1 open; +connect(con1,localhost,root,,); +send alter table t1 engine=csv; +connection default; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "rename result table" and info = "alter table t1 engine=csv"; +--source include/wait_condition.inc +--error ER_ILLEGAL_HA +handler t1 read a next; +handler t1 close; +connection con1; +--reap +drop table t1; +disconnect con1; +--source include/wait_until_disconnected.inc +connection default; + +# +# Bug#44151 using handler commands on information_schema tables crashes server +# + +USE information_schema; +--error ER_WRONG_USAGE +HANDLER COLUMNS OPEN; diff --git a/mysql-test/r/handler_myisam.result b/mysql-test/suite/handler/myisam.result index b20b8dbb138..bd356d6e81d 100644 --- a/mysql-test/r/handler_myisam.result +++ b/mysql-test/suite/handler/myisam.result @@ -1,25 +1,23 @@ SET SESSION STORAGE_ENGINE = MyISAM; drop table if exists t1,t3,t4,t5; -create table t1 (a int, b char(10), key a(a), key b(a,b)); +create table t1 (a int, b char(10), key a (a), key b (a,b)); insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), -(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"), +(14,"aaa"),(16,"ccc"),(16,"xxx"), (20,"ggg"),(21,"hhh"),(22,"iii"); handler t1 open as t2; -handler t2 read a=(SELECT 1); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1)' at line 1 handler t2 read a first; a b 14 aaa handler t2 read a next; a b -15 bbb +16 ccc handler t2 read a next; a b -16 ccc +16 xxx handler t2 read a prev; a b -15 bbb +16 ccc handler t2 read a last; a b 22 iii @@ -47,7 +45,6 @@ handler t2 read a next; a b handler t2 read a=(15); a b -15 bbb handler t2 read a=(16); a b 16 ccc @@ -84,26 +81,64 @@ a b handler t2 read a<(18); a b 17 ddd +handler t2 read a=(15); +a b +handler t2 read a>=(15); +a b +16 ccc +handler t2 read a>(15); +a b +16 ccc +handler t2 read a<=(15); +a b +14 aaa +handler t2 read a<(15); +a b +14 aaa +handler t2 read a=(54); +a b +handler t2 read a>=(54); +a b +handler t2 read a>(54); +a b +handler t2 read a<=(54); +a b +22 iii +handler t2 read a<(54); +a b +22 iii +handler t2 read a=(1); +a b +handler t2 read a>=(1); +a b +14 aaa +handler t2 read a>(1); +a b +14 aaa +handler t2 read a<=(1); +a b +handler t2 read a<(1); +a b handler t2 read a first limit 5; a b 14 aaa -15 bbb 16 ccc 16 xxx 17 ddd +18 eee handler t2 read a next limit 3; a b -18 eee 19 fff 19 yyy +20 ggg handler t2 read a prev limit 10; a b +19 yyy 19 fff 18 eee 17 ddd 16 xxx 16 ccc -15 bbb 14 aaa handler t2 read a>=(16) limit 4; a b @@ -135,8 +170,6 @@ a b handler t2 read next; a b 19 fff -handler t2 read last; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 handler t2 close; handler t1 open; handler t1 read a next; @@ -144,7 +177,7 @@ a b 14 aaa handler t1 read a next; a b -15 bbb +16 ccc handler t1 close; handler t1 open; handler t1 read a prev; @@ -163,12 +196,12 @@ handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER handler t1 open as t2; drop table t1; -create table t1 (a int); +create table t1 (a int not null); insert into t1 values (17); handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER handler t1 open as t2; -alter table t1 engine=MEMORY; +alter table t1 engine=CSV; handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER drop table t1; @@ -191,7 +224,7 @@ handler t1 read first; a 6 drop table t1; -create table t1(a int, index(a)); +create table t1(a int, index (a)); insert into t1 values (1), (2), (3); handler t1 open; handler t1 read a=(W); @@ -217,7 +250,7 @@ Ok handler t close; use test; drop table t1; -create table t1 ( a int, b int, INDEX a (a) ); +create table t1 ( a int, b int, INDEX a (a) ); insert into t1 values (1,2), (2,1); handler t1 open; handler t1 read a=(1) where b=2; @@ -229,148 +262,6 @@ handler t1 read a=(1) where b=1; a b handler t1 close; drop table t1; -drop database if exists test_test; -create database test_test; -use test_test; -create table t1(table_id char(20) primary key); -insert into t1 values ('test_test.t1'); -insert into t1 values (''); -handler t1 open; -handler t1 read first limit 9; -table_id -test_test.t1 - -create table t2(table_id char(20) primary key); -insert into t2 values ('test_test.t2'); -insert into t2 values (''); -handler t2 open; -handler t2 read first limit 9; -table_id -test_test.t2 - -use test; -drop table if exists t1; -create table t1(table_id char(20) primary key); -insert into t1 values ('test.t1'); -insert into t1 values (''); -handler t1 open; -ERROR 42000: Not unique table/alias: 't1' -use test; -handler test.t1 read first limit 9; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 -handler test_test.t1 read first limit 9; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 -handler t1 read first limit 9; -table_id -test_test.t1 - -handler test_test.t2 read first limit 9; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 -handler t2 read first limit 9; -table_id -test_test.t2 - -handler test_test.t1 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler t1 close; -drop table test_test.t1; -handler test_test.t2 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler t2 close; -drop table test_test.t2; -drop database test_test; -use test; -handler test.t1 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler t1 close; -ERROR 42S02: Unknown table 't1' in HANDLER -drop table test.t1; -drop database if exists test_test; -drop table if exists t1; -drop table if exists t2; -drop table if exists t3; -create database test_test; -use test_test; -create table t1 (c1 char(20)); -insert into t1 values ('test_test.t1'); -create table t3 (c1 char(20)); -insert into t3 values ('test_test.t3'); -handler t1 open; -handler t1 read first limit 9; -c1 -test_test.t1 -handler t1 open h1; -handler h1 read first limit 9; -c1 -test_test.t1 -use test; -create table t1 (c1 char(20)); -create table t2 (c1 char(20)); -create table t3 (c1 char(20)); -insert into t1 values ('t1'); -insert into t2 values ('t2'); -insert into t3 values ('t3'); -handler t1 open; -ERROR 42000: Not unique table/alias: 't1' -handler t2 open t1; -ERROR 42000: Not unique table/alias: 't1' -handler t3 open t1; -ERROR 42000: Not unique table/alias: 't1' -handler t1 read first limit 9; -c1 -test_test.t1 -handler test.t1 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler test.t1 open h1; -ERROR 42000: Not unique table/alias: 'h1' -handler test_test.t1 open h1; -ERROR 42000: Not unique table/alias: 'h1' -handler test_test.t3 open h3; -handler test.t1 open h2; -handler t1 read first limit 9; -c1 -test_test.t1 -handler h1 read first limit 9; -c1 -test_test.t1 -handler h2 read first limit 9; -c1 -t1 -handler h3 read first limit 9; -c1 -test_test.t3 -handler h2 read first limit 9; -c1 -t1 -handler test.h1 close; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1 -handler t1 close; -handler h1 close; -handler h2 close; -handler t1 read first limit 9; -ERROR 42S02: Unknown table 't1' in HANDLER -handler h1 read first limit 9; -ERROR 42S02: Unknown table 'h1' in HANDLER -handler h2 read first limit 9; -ERROR 42S02: Unknown table 'h2' in HANDLER -handler h3 read first limit 9; -c1 -test_test.t3 -handler h3 read first limit 9; -c1 -test_test.t3 -use test_test; -handler h3 read first limit 9; -c1 -test_test.t3 -handler test.h3 read first limit 9; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1 -handler h3 close; -use test; -drop table t3; -drop table t2; -drop table t1; -drop database test_test; create table t1 (c1 char(20)); insert into t1 values ("t1"); handler t1 open as h1; @@ -495,6 +386,11 @@ no1 no2 HANDLER t1 READ `primary` PREV; no1 no2 1 275 +HANDLER t1 READ `primary` = (1, 1000); +no1 no2 +HANDLER t1 READ `primary` NEXT; +no1 no2 +2 6 DROP TABLE t1; create table t1 (c1 int); insert into t1 values (14397); @@ -515,14 +411,12 @@ ERROR 42S02: Table 'test.t1' doesn't exist drop table if exists t1; Warnings: Note 1051 Unknown table 't1' -drop table if exists t1; -create table t1 (a int) ENGINE=MEMORY; +create table t1 (a int not null) ENGINE=CSV; --> client 2 handler t1 open; ERROR HY000: Table storage engine for 't1' doesn't have this option --> client 1 drop table t1; -drop table if exists t1; create table t1 (a int); handler t1 open as t1_alias; handler t1_alias read a next; @@ -535,50 +429,9 @@ handler t1_alias READ a next where inexistent > 0; ERROR 42S22: Unknown column 'inexistent' in 'field list' handler t1_alias close; drop table t1; -drop table if exists t1,t2; -create table t1 (c1 int); -create table t2 (c1 int); -insert into t1 values (1); -insert into t2 values (2); -connection: default -handler t1 open; -handler t1 read first; -c1 -1 -connection: flush -flush tables;; -connection: default -handler t2 open; -handler t2 read first; -c1 -2 -handler t1 read next; -c1 -1 -handler t1 close; -handler t2 close; -drop table t1,t2; -drop table if exists t1,t2; -create table t1 (c1 int); -connection: default -handler t1 open; -handler t1 read first; -c1 -connection: flush -rename table t1 to t2;; -connection: default -handler t2 open; -handler t2 read first; -c1 -handler t1 read next; -ERROR 42S02: Table 'test.t1' doesn't exist -handler t1 close; -handler t2 close; -drop table t2; -drop table if exists t1; -create temporary table t1 (a int, b char(1), key a(a), key b(a,b)); +create temporary table t1 (a int, b char(1), key a (a), key b(a,b)); insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), -(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); +(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"),(9,'k'); select a,b from t1; a b 0 a @@ -591,24 +444,25 @@ a b 7 h 8 i 9 j +9 k handler t1 open as a1; -handler a1 read a first; -a b -0 a -handler a1 read a next; +handler a1 read a=(1); a b 1 b handler a1 read a next; a b 2 c +handler a1 read a next; +a b +3 d select a,b from t1; ERROR HY000: Can't reopen table: 'a1' handler a1 read a prev; a b -1 b +2 c handler a1 read a prev; a b -0 a +1 b handler a1 read a=(6) where b="g"; a b 6 g @@ -625,39 +479,28 @@ a b 7 h 8 i 9 j +9 k handler t1 open as a2; -handler a2 read a first; +handler a2 read a=(9); a b -0 a -handler a2 read a last; +9 j +handler a2 read a next; +a b +9 k +handler a2 read a prev limit 2; a b 9 j +8 i +handler a2 read a last; +a b +9 k handler a2 read a prev; a b -8 i +9 j handler a2 close; drop table t1; -drop table if exists t1,t2; -create table t1 (a int); -handler t1 open as t1_alias; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -flush tables; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -handler t1_alias close; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -handler t1_alias read first; -a -drop table t1; -handler t1_alias read next; -ERROR 42S02: Unknown table 't1_alias' in HANDLER create table t1 (a int); -create temporary table t2 (a int, key(a)); +create temporary table t2 (a int, key (a)); handler t1 open as a1; handler t2 open as a2; handler a2 read a first; @@ -667,7 +510,7 @@ handler a2 read a next; ERROR 42S02: Unknown table 'a2' in HANDLER handler a1 close; ERROR 42S02: Unknown table 'a1' in HANDLER -create table t1 (a int, key(a)); +create table t1 (a int, key (a)); create table t2 like t1; handler t1 open as a1; handler t2 open as a2; @@ -680,7 +523,7 @@ handler a1 close; ERROR 42S02: Unknown table 'a1' in HANDLER handler a2 close; drop table t1, t2; -create table t1 (a int, key(a)); +create table t1 (a int, key (a)); handler t1 open as a1; handler a1 read a first; a @@ -688,7 +531,7 @@ rename table t1 to t2; handler a1 read a first; ERROR 42S02: Unknown table 'a1' in HANDLER drop table t2; -create table t1 (a int, key(a)); +create table t1 (a int, key (a)); create table t2 like t1; handler t1 open as a1; handler t2 open as a2; @@ -703,44 +546,19 @@ handler a1 close; ERROR 42S02: Unknown table 'a1' in HANDLER handler a2 close; drop table t1, t2; -create table t1 (a int, b char(1), key a(a), key b(a,b)); -insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), -(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); -handler t1 open; -handler t1 read a first; -a b -0 a -handler t1 read a next; -a b -1 b -flush tables; -handler t1 read a next; -a b -0 a -handler t1 read a next; -a b -1 b -flush tables with read lock; -handler t1 read a next; -a b -0 a -unlock tables; -drop table t1; -handler t1 read a next; -ERROR 42S02: Unknown table 't1' in HANDLER -drop table if exists t1; -create table t1 (a int); -insert into t1 values (1); -handler t1 open; -alter table t1 engine=memory; -handler t1 read a next; -ERROR HY000: Table storage engine for 't1' doesn't have this option -handler t1 close; -drop table t1; -USE information_schema; -HANDLER COLUMNS OPEN; -ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema -USE test; +# +# BUG#51877 - HANDLER interface causes invalid memory read +# +CREATE TABLE t1(a INT, KEY (a)); +HANDLER t1 OPEN; +HANDLER t1 READ a FIRST; +a +INSERT INTO t1 VALUES(1); +HANDLER t1 READ a NEXT; +a +1 +HANDLER t1 CLOSE; +DROP TABLE t1; # # BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash # @@ -757,19 +575,6 @@ HANDLER t1 READ FIRST; ERROR 42S02: Unknown table 't1' in HANDLER DROP TABLE t1; # -# BUG#51877 - HANDLER interface causes invalid memory read -# -CREATE TABLE t1(a INT, KEY(a)); -HANDLER t1 OPEN; -HANDLER t1 READ a FIRST; -a -INSERT INTO t1 VALUES(1); -HANDLER t1 READ a NEXT; -a -1 -HANDLER t1 CLOSE; -DROP TABLE t1; -# # Bug #54007: assert in ha_myisam::index_next , HANDLER # CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b)); @@ -821,12 +626,13 @@ HANDLER t1 READ b NEXT; a b HANDLER t1 READ NEXT; a b -4 40 +2 20 HANDLER t1 READ NEXT; a b -3 30 +1 10 HANDLER t1 READ NEXT; a b +4 40 HANDLER t1 CLOSE; HANDLER t1 OPEN; HANDLER t1 READ FIRST; diff --git a/mysql-test/t/handler_myisam.test b/mysql-test/suite/handler/myisam.test index e78072ef8a0..c6acf1e822c 100644 --- a/mysql-test/t/handler_myisam.test +++ b/mysql-test/suite/handler/myisam.test @@ -5,20 +5,14 @@ # Last update: # 2006-07-31 ML test refactored (MySQL 5.1) # code of t/handler.test and t/innodb_handler.test united -# main testing code put into include/handler.inc +# main testing code put into handler.inc # rename t/handler.test to t/handler_myisam.test # -# should work in embedded server after mysqltest is fixed ---source include/not_embedded.inc - let $engine_type= MyISAM; -let $other_engine_type= MEMORY; -# There is unfortunately no other all time available storage engine -# which supports the handler interface -let $other_handler_engine_type= MyISAM; ---source include/handler.inc +--source init.inc +--source handler.inc --echo # --echo # BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash @@ -38,18 +32,6 @@ HANDLER t1 READ FIRST; DROP TABLE t1; --echo # ---echo # BUG#51877 - HANDLER interface causes invalid memory read ---echo # -CREATE TABLE t1(a INT, KEY(a)); -HANDLER t1 OPEN; -HANDLER t1 READ a FIRST; -INSERT INTO t1 VALUES(1); -HANDLER t1 READ a NEXT; -HANDLER t1 CLOSE; -DROP TABLE t1; - - ---echo # --echo # Bug #54007: assert in ha_myisam::index_next , HANDLER --echo # CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b)); diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result index 350c7ebd541..0c8d16f27fb 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -471,17 +471,12 @@ SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 2 auto_increment_offset 10 -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +ERROR HY000: Failed to read auto-increment value from storage engine SELECT * FROM t1; c1 1 18446744073709551603 -18446744073709551604 -18446744073709551606 -18446744073709551608 -18446744073709551610 -18446744073709551612 -18446744073709551614 DROP TABLE t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SET @@INSERT_ID=1; @@ -504,13 +499,12 @@ SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 5 auto_increment_offset 7 -INSERT INTO t1 VALUES (NULL),(NULL); +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +ERROR HY000: Failed to read auto-increment value from storage engine SELECT * FROM t1; c1 1 18446744073709551603 -18446744073709551607 -18446744073709551612 DROP TABLE t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SET @@INSERT_ID=1; @@ -572,12 +566,12 @@ SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 65535 auto_increment_offset 65535 -INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (NULL),(NULL); +ERROR 22003: Out of range value for column 't1' at row 167 SELECT * FROM t1; c1 1 18446744073709551610 -18446744073709551615 DROP TABLE t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SET @@INSERT_ID=1; diff --git a/mysql-test/suite/innodb/r/innodb_multi_update.result b/mysql-test/suite/innodb/r/innodb_multi_update.result index 7af9b030d1f..558fc3938a8 100644 --- a/mysql-test/suite/innodb/r/innodb_multi_update.result +++ b/mysql-test/suite/innodb/r/innodb_multi_update.result @@ -74,3 +74,11 @@ a b 4 14 5 15 drop table bug38999_1,bug38999_2; +# +# Bug#54475 improper error handling causes cascading crashing failures in innodb/ndb +# +CREATE TABLE t1(f1 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +UPDATE (SELECT ((SELECT 1 FROM t1), 1) FROM t1 WHERE (SELECT 1 FROM t1)) x, (SELECT 1) AS d SET d.f1 = 1; +ERROR 21000: Operand should contain 1 column(s) +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index 86a51b337ff..ffbf7debb23 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -2617,6 +2617,53 @@ rows 3 Extra Using index DROP TABLE t1; # +# ALTER TABLE IGNORE didn't ignore duplicates for unique add index +# +create table t1 (a int primary key, b int) engine = innodb; +insert into t1 values (1,1),(2,1); +alter ignore table t1 add unique `main` (b); +drop table t1; +# +# Bug#56862 Execution of a query that uses index merge returns a wrong result +# +CREATE TABLE t1 ( +pk int NOT NULL AUTO_INCREMENT PRIMARY KEY, +a int, +b int, +INDEX idx(a)) +ENGINE=INNODB; +INSERT INTO t1(a,b) VALUES +(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500), +(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800), +(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700), +(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000); +INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1; +INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1; +INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1 VALUES (1000000, 0, 0); +SET SESSION sort_buffer_size = 1024*36; +EXPLAIN +SELECT COUNT(*) FROM +(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) +WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 3537 Using sort_union(idx,PRIMARY); Using where +SELECT COUNT(*) FROM +(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) +WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; +COUNT(*) +1537 +SET SESSION sort_buffer_size = DEFAULT; +DROP TABLE t1; End of 5.1 tests # # Test for bug #39932 "create table fails if column for FK is in different @@ -2638,3 +2685,11 @@ t2 CREATE TABLE `t2` ( CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t2, t1; +# +# Test for bug #56619 - Assertion failed during +# ALTER TABLE RENAME, DISABLE KEYS +# +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb; +ALTER TABLE t1 RENAME TO t2, DISABLE KEYS; +DROP TABLE IF EXISTS t1, t2; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test index f4ba2feab73..8e425d0a41f 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc.test @@ -293,21 +293,8 @@ INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 SELECT * FROM t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't, it seems to be -# a MySQL server bug. It wraps around to 0 for the last value. -# See MySQL Bug# 39828 -# -# Instead of wrapping around, it asserts when MySQL is compiled --with-debug -# (see sql/handler.cc:handler::update_auto_increment()). Don't test for -# overflow until Bug #39828 is fixed. -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#endif +--error ER_AUTOINC_READ_FAILED +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); SELECT * FROM t1; DROP TABLE t1; @@ -325,20 +312,8 @@ INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 SELECT * FROM t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't. It fails with -# a duplicate entry message because of a MySQL server bug, it wraps -# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace -# the ER_DUP_ENTRY, 1062 below with the appropriate error message -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -# Still need to fix this error code, error should mention overflow -#-- error ER_DUP_ENTRY,1062 -#INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL); -#endif +--error ER_AUTOINC_READ_FAILED +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); SELECT * FROM t1; DROP TABLE t1; @@ -376,20 +351,8 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2 SELECT * FROM t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't. It wraps around -# and the autoinc values look bogus too. -# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error -# code expected test. -# -- error ER_AUTOINC_READ_FAILED,1467 -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#-- error ER_AUTOINC_READ_FAILED,1467 -#INSERT INTO t1 VALUES (NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL); -#endif +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t1 VALUES (NULL),(NULL); SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_multi_update.test b/mysql-test/suite/innodb/t/innodb_multi_update.test index 7ab17ccf70a..8356c20c88f 100644 --- a/mysql-test/suite/innodb/t/innodb_multi_update.test +++ b/mysql-test/suite/innodb/t/innodb_multi_update.test @@ -27,3 +27,14 @@ select * from bug38999_1; select * from bug38999_2; drop table bug38999_1,bug38999_2; + + +--echo # +--echo # Bug#54475 improper error handling causes cascading crashing failures in innodb/ndb +--echo # +CREATE TABLE t1(f1 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +--error ER_OPERAND_COLUMNS +UPDATE (SELECT ((SELECT 1 FROM t1), 1) FROM t1 WHERE (SELECT 1 FROM t1)) x, (SELECT 1) AS d SET d.f1 = 1; +DROP TABLE t1; + diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index 991440e54dd..a56b1b615ac 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -841,6 +841,57 @@ CREATE INDEX b ON t1(a,b,c,d); DROP TABLE t1; --echo # +--echo # ALTER TABLE IGNORE didn't ignore duplicates for unique add index +--echo # + +create table t1 (a int primary key, b int) engine = innodb; +insert into t1 values (1,1),(2,1); +alter ignore table t1 add unique `main` (b); +drop table t1; + +--echo # +--echo # Bug#56862 Execution of a query that uses index merge returns a wrong result +--echo # + +CREATE TABLE t1 ( + pk int NOT NULL AUTO_INCREMENT PRIMARY KEY, + a int, + b int, + INDEX idx(a)) +ENGINE=INNODB; + +INSERT INTO t1(a,b) VALUES + (11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500), + (3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800), + (6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700), + (13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000); +INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1; +INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1; +INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1 VALUES (1000000, 0, 0); + +SET SESSION sort_buffer_size = 1024*36; + +EXPLAIN +SELECT COUNT(*) FROM + (SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) + WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; + +SELECT COUNT(*) FROM + (SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) + WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; + +SET SESSION sort_buffer_size = DEFAULT; + +DROP TABLE t1; --echo End of 5.1 tests @@ -862,3 +913,16 @@ create table t2 (fk int, key x (fk), constraint x foreign key (FK) references t1 (PK)) engine=InnoDB; show create table t2; drop table t2, t1; + +--echo # +--echo # Test for bug #56619 - Assertion failed during +--echo # ALTER TABLE RENAME, DISABLE KEYS +--echo # +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings +CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb; +--disable_warnings +ALTER TABLE t1 RENAME TO t2, DISABLE KEYS; +DROP TABLE IF EXISTS t1, t2; +--enable_warnings diff --git a/mysql-test/suite/innodb_plugin/r/innodb-autoinc-18274.result b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-18274.result new file mode 100644 index 00000000000..22afc65a649 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-18274.result @@ -0,0 +1,26 @@ +drop table if exists t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +DELETE FROM t1; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +c1 +2 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_plugin/r/innodb-autoinc-56228.result b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-56228.result new file mode 100644 index 00000000000..2ff2bd2800a --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-56228.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS t1_56228; +Warnings: +Note 1051 Unknown table 't1_56228' +DROP TABLE IF EXISTS t2_56228; +Warnings: +Note 1051 Unknown table 't2_56228' +DROP FUNCTION IF EXISTS bug56228; +Warnings: +Note 1305 FUNCTION bug56228 does not exist +CREATE TEMPORARY TABLE t1_56228( +c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2_56228( +c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +CREATE FUNCTION bug56228() RETURNS INT DETERMINISTIC +BEGIN +INSERT INTO t1_56228 VALUES(NULL); +INSERT INTO t2_56228 VALUES(NULL); +INSERT INTO t1_56228 VALUES(NULL); +INSERT INTO t2_56228 VALUES(NULL); +DROP TEMPORARY TABLE t1_56228; +RETURN 42; +END // +SELECT bug56228(); +bug56228() +42 +DROP FUNCTION bug56228; +DROP TEMPORARY TABLE t2_56228; +DROP TEMPORARY TABLE IF EXISTS t1_56228; +Warnings: +Note 1051 Unknown table 't1_56228' diff --git a/mysql-test/suite/innodb_plugin/r/innodb-autoinc.result b/mysql-test/suite/innodb_plugin/r/innodb-autoinc.result index 350c7ebd541..0c8d16f27fb 100644 --- a/mysql-test/suite/innodb_plugin/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb_plugin/r/innodb-autoinc.result @@ -471,17 +471,12 @@ SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 2 auto_increment_offset 10 -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +ERROR HY000: Failed to read auto-increment value from storage engine SELECT * FROM t1; c1 1 18446744073709551603 -18446744073709551604 -18446744073709551606 -18446744073709551608 -18446744073709551610 -18446744073709551612 -18446744073709551614 DROP TABLE t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SET @@INSERT_ID=1; @@ -504,13 +499,12 @@ SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 5 auto_increment_offset 7 -INSERT INTO t1 VALUES (NULL),(NULL); +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +ERROR HY000: Failed to read auto-increment value from storage engine SELECT * FROM t1; c1 1 18446744073709551603 -18446744073709551607 -18446744073709551612 DROP TABLE t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SET @@INSERT_ID=1; @@ -572,12 +566,12 @@ SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 65535 auto_increment_offset 65535 -INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (NULL),(NULL); +ERROR 22003: Out of range value for column 't1' at row 167 SELECT * FROM t1; c1 1 18446744073709551610 -18446744073709551615 DROP TABLE t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SET @@INSERT_ID=1; diff --git a/mysql-test/suite/innodb_plugin/r/innodb-create-options.result b/mysql-test/suite/innodb_plugin/r/innodb-create-options.result new file mode 100644 index 00000000000..94c84fcf60f --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb-create-options.result @@ -0,0 +1,854 @@ +SET storage_engine=InnoDB; +SET GLOBAL innodb_file_format=`Barracuda`; +SET GLOBAL innodb_file_per_table=ON; +SET SESSION innodb_strict_mode = ON; +# Test 1) StrictMode=ON, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0 +# KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified' +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +# 'FIXED' is sent to InnoDB since it is used by MyISAM. +# But it is an invalid mode in InnoDB +CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: invalid ROW_FORMAT specifier. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED +ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT +ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC +ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact +ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: invalid ROW_FORMAT specifier. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact +# Test 2) StrictMode=ON, CREATE with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE +# KEY_BLOCK_SIZE is incompatible with COMPACT, REDUNDANT, & DYNAMIC +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=8 +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=8 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed key_block_size=16 +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed key_block_size=16 +# Test 3) StrictMode=ON, ALTER with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: invalid ROW_FORMAT specifier. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed key_block_size=16 +ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=1 +# Test 4) StrictMode=ON, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid non-zero KEY_BLOCK_SIZE +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT +ALTER TABLE t1 KEY_BLOCK_SIZE=2; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT +ALTER TABLE t1 KEY_BLOCK_SIZE=4; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC +ALTER TABLE t1 KEY_BLOCK_SIZE=8; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED +ALTER TABLE t1 KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=16 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed key_block_size=1 +# Test 5) StrictMode=ON, CREATE with a valid KEY_BLOCK_SIZE +# ALTER with each ROW_FORMAT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2 +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2 +ALTER TABLE t1 ROW_FORMAT=COMPACT; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=2 +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact +ALTER TABLE t1 ROW_FORMAT=COMPACT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT +# Test 6) StrictMode=ON, CREATE with an invalid KEY_BLOCK_SIZE. +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=9; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] +Error 1005 Can't create table 'test.t1' (errno: 1478) +# Test 7) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and +# and a valid non-zero KEY_BLOCK_SIZE are rejected with Antelope +# and that they can be set to default values during strict mode. +SET GLOBAL innodb_file_format=Antelope; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=4; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT; +SHOW WARNINGS; +Level Code Message +ALTER TABLE t1 KEY_BLOCK_SIZE=8; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +SET GLOBAL innodb_file_format=Barracuda; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SET GLOBAL innodb_file_format=Antelope; +ALTER TABLE t1 ADD COLUMN f1 INT; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +Level Code Message +SET GLOBAL innodb_file_format=Barracuda; +# Test 8) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and +# and a valid non-zero KEY_BLOCK_SIZE are rejected with +# innodb_file_per_table=OFF and that they can be set to default +# values during strict mode. +SET GLOBAL innodb_file_per_table=OFF; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=16; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; +ERROR HY000: Can't create table 'test.t1' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. +Error 1005 Can't create table 'test.t1' (errno: 1478) +CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT; +SHOW WARNINGS; +Level Code Message +ALTER TABLE t1 KEY_BLOCK_SIZE=1; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=COMPACT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT +ALTER TABLE t1 ROW_FORMAT=DEFAULT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact +SET GLOBAL innodb_file_per_table=ON; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SET GLOBAL innodb_file_per_table=OFF; +ALTER TABLE t1 ADD COLUMN f1 INT; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +Level Code Message +SET GLOBAL innodb_file_per_table=ON; +################################################## +SET SESSION innodb_strict_mode = OFF; +# Test 9) StrictMode=OFF, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0 +# KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified' +# 'FIXED' is sent to InnoDB since it is used by MyISAM. +# It is an invalid mode in InnoDB, use COMPACT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED; +Warnings: +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=FIXED +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED +ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT +ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC +ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact +ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0; +Warnings: +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=FIXED +# Test 10) StrictMode=OFF, CREATE with each ROW_FORMAT & a valid KEY_BLOCK_SIZE +# KEY_BLOCK_SIZE is ignored with COMPACT, REDUNDANT, & DYNAMIC +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT key_block_size=1 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT key_block_size=2 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC key_block_size=4 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=8 +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=8 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed key_block_size=16 +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed key_block_size=16 +# Test 11) StrictMode=OFF, ALTER with each ROW_FORMAT & a valid KEY_BLOCK_SIZE +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=FIXED key_block_size=1 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT key_block_size=2 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC key_block_size=4 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT key_block_size=8 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed key_block_size=16 +ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=1 +# Test 12) StrictMode=OFF, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid KEY_BLOCK_SIZE +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT +ALTER TABLE t1 KEY_BLOCK_SIZE=2; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT key_block_size=2 +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT key_block_size=2 +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC key_block_size=2 +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=2 +ALTER TABLE t1 KEY_BLOCK_SIZE=4; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=4 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=8; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed key_block_size=8 +# Test 13) StrictMode=OFF, CREATE with a valid KEY_BLOCK_SIZE +# ALTER with each ROW_FORMAT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=16 +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=16 +ALTER TABLE t1 ROW_FORMAT=COMPACT; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT key_block_size=16 +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Redundant row_format=REDUNDANT key_block_size=16 +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC key_block_size=16 +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=16 +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact +ALTER TABLE t1 ROW_FORMAT=COMPACT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPACT +# Test 14) StrictMode=OFF, CREATE with an invalid KEY_BLOCK_SIZE, it defaults to 8 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=15; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=15. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=15. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact key_block_size=15 +# Test 15) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a +valid KEY_BLOCK_SIZE are remembered but not used when ROW_FORMAT +is reverted to Antelope and then used again when ROW_FORMAT=Barracuda. +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=1 +SET GLOBAL innodb_file_format=Antelope; +ALTER TABLE t1 ADD COLUMN f1 INT; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPRESSED key_block_size=1 +SET GLOBAL innodb_file_format=Barracuda; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=1 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC +SET GLOBAL innodb_file_format=Antelope; +ALTER TABLE t1 ADD COLUMN f1 INT; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=DYNAMIC +SET GLOBAL innodb_file_format=Barracuda; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC +# Test 16) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a +valid KEY_BLOCK_SIZE are remembered but not used when innodb_file_per_table=OFF +and then used again when innodb_file_per_table=ON. +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=2 +SET GLOBAL innodb_file_per_table=OFF; +ALTER TABLE t1 ADD COLUMN f1 INT; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=COMPRESSED key_block_size=2 +SET GLOBAL innodb_file_per_table=ON; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compressed row_format=COMPRESSED key_block_size=2 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC +SET GLOBAL innodb_file_per_table=OFF; +ALTER TABLE t1 ADD COLUMN f1 INT; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. +Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Compact row_format=DYNAMIC +SET GLOBAL innodb_file_per_table=ON; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +Level Code Message +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +t1 Dynamic row_format=DYNAMIC +# Cleanup +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/innodb_plugin/r/innodb-zip.result b/mysql-test/suite/innodb_plugin/r/innodb-zip.result index 21396d81ba8..fc35143b305 100644 --- a/mysql-test/suite/innodb_plugin/r/innodb-zip.result +++ b/mysql-test/suite/innodb_plugin/r/innodb-zip.result @@ -83,8 +83,6 @@ test t8 Compact test t9 Compact drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14; alter table t1 key_block_size=0; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0. alter table t1 row_format=dynamic; SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb'; @@ -190,16 +188,9 @@ set global innodb_file_per_table = on; set global innodb_file_format = `1`; set innodb_strict_mode = off; create table t1 (id int primary key) engine = innodb key_block_size = 0; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0. drop table t1; set innodb_strict_mode = on; create table t1 (id int primary key) engine = innodb key_block_size = 0; -ERROR HY000: Can't create table 'test.t1' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16] -Error 1005 Can't create table 'test.t1' (errno: 1478) create table t2 (id int primary key) engine = innodb key_block_size = 9; ERROR HY000: Can't create table 'test.t2' (errno: 1478) show warnings; @@ -218,6 +209,7 @@ create table t11(id int primary key) engine = innodb row_format = redundant; SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb'; table_schema table_name row_format +test t1 Compact test t10 Compact test t11 Redundant test t3 Compressed @@ -227,7 +219,7 @@ test t6 Compressed test t7 Compressed test t8 Compressed test t9 Dynamic -drop table t3, t4, t5, t6, t7, t8, t9, t10, t11; +drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11; create table t1 (id int primary key) engine = innodb key_block_size = 8 row_format = compressed; create table t2 (id int primary key) engine = innodb @@ -253,16 +245,12 @@ Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. Error 1005 Can't create table 'test.t4' (errno: 1478) create table t5 (id int primary key) engine = innodb key_block_size = 8 row_format = default; -ERROR HY000: Can't create table 'test.t5' (errno: 1478) -show warnings; -Level Code Message -Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t5' (errno: 1478) SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb'; table_schema table_name row_format test t1 Compressed -drop table t1; +test t5 Compressed +drop table t1, t5; create table t1 (id int primary key) engine = innodb key_block_size = 9 row_format = redundant; ERROR HY000: Can't create table 'test.t1' (errno: 1478) diff --git a/mysql-test/suite/innodb_plugin/r/innodb.result b/mysql-test/suite/innodb_plugin/r/innodb.result index c4b718bd975..a95783b67dc 100644 --- a/mysql-test/suite/innodb_plugin/r/innodb.result +++ b/mysql-test/suite/innodb_plugin/r/innodb.result @@ -1,5 +1,8 @@ drop table if exists t1,t2,t3,t4; drop database if exists mysqltest; +CREATE TABLE bug58912 (a BLOB, b TEXT, PRIMARY KEY(a(1))) ENGINE=InnoDB; +INSERT INTO bug58912 VALUES(REPEAT('a',8000),REPEAT('b',8000)); +UPDATE bug58912 SET a=REPEAT('a',7999); create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); select id, code, name from t1 order by id; @@ -1676,10 +1679,10 @@ variable_value - @innodb_rows_deleted_orig 71 SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; variable_value - @innodb_rows_inserted_orig -1066 +1067 SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; variable_value - @innodb_rows_updated_orig -865 +866 SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'; variable_value - @innodb_row_lock_waits_orig 0 @@ -3239,3 +3242,4 @@ Variable_name Value Handler_update 1 Variable_name Value Handler_delete 1 +DROP TABLE bug58912; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug53046.result b/mysql-test/suite/innodb_plugin/r/innodb_bug53046.result new file mode 100644 index 00000000000..69be6c4e0a7 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug53046.result @@ -0,0 +1,27 @@ +CREATE TABLE bug53046_1 (c1 INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE bug53046_2 (c2 INT PRIMARY KEY, +FOREIGN KEY (c2) REFERENCES bug53046_1(c1) +ON UPDATE CASCADE ON DELETE CASCADE) ENGINE=INNODB; +INSERT INTO bug53046_1 VALUES (1); +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_2 VALUES (1), (2); +ANALYZE TABLE bug53046_1; +Table Op Msg_type Msg_text +test.bug53046_1 analyze status OK +SHOW TABLE STATUS LIKE 'bug53046_1'; +UPDATE bug53046_1 SET c1 = c1 - 1; +DELETE FROM bug53046_1; +INSERT INTO bug53046_1 VALUES (1); +INSERT INTO bug53046_2 VALUES (1); +TRUNCATE TABLE bug53046_2; +DROP TABLE bug53046_2; +DROP TABLE bug53046_1; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54679.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54679.result deleted file mode 100644 index f98f0474233..00000000000 --- a/mysql-test/suite/innodb_plugin/r/innodb_bug54679.result +++ /dev/null @@ -1,91 +0,0 @@ -SET GLOBAL innodb_file_format='Barracuda'; -SET GLOBAL innodb_file_per_table=ON; -SET innodb_strict_mode=ON; -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug54679 Compressed row_format=COMPRESSED -ALTER TABLE bug54679 ADD COLUMN b INT; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug54679 Compressed row_format=COMPRESSED -DROP TABLE bug54679; -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug54679 Compact -ALTER TABLE bug54679 KEY_BLOCK_SIZE=1; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug54679 Compressed key_block_size=1 -ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT; -ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. -Error 1005 Can't create table '#sql-temporary' (errno: 1478) -DROP TABLE bug54679; -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug54679 Redundant row_format=REDUNDANT -ALTER TABLE bug54679 KEY_BLOCK_SIZE=2; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug54679 Compressed row_format=REDUNDANT key_block_size=2 -SET GLOBAL innodb_file_format=Antelope; -ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; -ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table '#sql-temporary' (errno: 1478) -ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; -ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. -Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. -Error 1005 Can't create table '#sql-temporary' (errno: 1478) -DROP TABLE bug54679; -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; -ERROR HY000: Can't create table 'test.bug54679' (errno: 1478) -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.bug54679' (errno: 1478) -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; -SET GLOBAL innodb_file_format=Barracuda; -SET GLOBAL innodb_file_per_table=OFF; -ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; -ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table '#sql-temporary' (errno: 1478) -ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; -ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. -Error 1005 Can't create table '#sql-temporary' (errno: 1478) -DROP TABLE bug54679; -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; -ERROR HY000: Can't create table 'test.bug54679' (errno: 1478) -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. -Error 1005 Can't create table 'test.bug54679' (errno: 1478) -SET GLOBAL innodb_file_per_table=ON; -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; -DROP TABLE bug54679; -SET GLOBAL innodb_file_format=Antelope; -SET GLOBAL innodb_file_format_check=Antelope; -SET GLOBAL innodb_file_per_table=0; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug56632.result b/mysql-test/suite/innodb_plugin/r/innodb_bug56632.result deleted file mode 100644 index 1b0428e32e8..00000000000 --- a/mysql-test/suite/innodb_plugin/r/innodb_bug56632.result +++ /dev/null @@ -1,294 +0,0 @@ -SET storage_engine=InnoDB; -SET GLOBAL innodb_file_format=`Barracuda`; -SET GLOBAL innodb_file_per_table=ON; -SET SESSION innodb_strict_mode = ON; -# Test 1) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither -DROP TABLE IF EXISTS bug56632; -Warnings: -Note 1051 Unknown table 'bug56632' -CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; -ERROR HY000: Can't create table 'test.bug56632' (errno: 1478) -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.bug56632' (errno: 1478) -# Test 2) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE -DROP TABLE IF EXISTS bug56632; -Warnings: -Note 1051 Unknown table 'bug56632' -CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact row_format=COMPACT -ALTER TABLE bug56632 KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compressed row_format=COMPACT key_block_size=1 -# Test 3) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compressed key_block_size=1 -ALTER TABLE bug56632 ROW_FORMAT=COMPACT; -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compressed key_block_size=1 -# Test 4) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ); -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact -ALTER TABLE bug56632 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact -# Test 5) CREATE with KEY_BLOCK_SIZE=3 (invalid). -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3; -ERROR HY000: Can't create table 'test.bug56632' (errno: 1478) -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 3. Valid values are [1, 2, 4, 8, 16] -Error 1005 Can't create table 'test.bug56632' (errno: 1478) -SET SESSION innodb_strict_mode = OFF; -# Test 6) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither -DROP TABLE IF EXISTS bug56632; -Warnings: -Note 1051 Unknown table 'bug56632' -CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact row_format=COMPACT key_block_size=1 -ALTER TABLE bug56632 ADD COLUMN f1 INT; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL, - `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact row_format=COMPACT key_block_size=1 -# Test 7) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact row_format=COMPACT -ALTER TABLE bug56632 KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compressed row_format=COMPACT key_block_size=1 -# Test 8) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compressed key_block_size=1 -ALTER TABLE bug56632 ROW_FORMAT=COMPACT; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact row_format=COMPACT key_block_size=1 -# Test 9) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ); -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact -ALTER TABLE bug56632 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact row_format=COMPACT key_block_size=1 -# Test 10) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither. -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=3 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact key_block_size=3 -ALTER TABLE bug56632 ADD COLUMN f1 INT; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL, - `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=3 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact key_block_size=3 -# Test 11) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with ROW_FORMAT=COMPACT. -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=3 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact key_block_size=3 -ALTER TABLE bug56632 ROW_FORMAT=COMPACT; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=3 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact row_format=COMPACT key_block_size=3 -# Test 12) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with KEY_BLOCK_SIZE=1. -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW WARNINGS; -Level Code Message -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3. -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=3 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compact key_block_size=3 -ALTER TABLE bug56632 KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE bug56632; -Table Create Table -bug56632 CREATE TABLE `bug56632` ( - `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -TABLE_NAME ROW_FORMAT CREATE_OPTIONS -bug56632 Compressed key_block_size=1 -# Cleanup -DROP TABLE IF EXISTS bug56632; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_multi_update.result b/mysql-test/suite/innodb_plugin/r/innodb_multi_update.result index 7af9b030d1f..558fc3938a8 100644 --- a/mysql-test/suite/innodb_plugin/r/innodb_multi_update.result +++ b/mysql-test/suite/innodb_plugin/r/innodb_multi_update.result @@ -74,3 +74,11 @@ a b 4 14 5 15 drop table bug38999_1,bug38999_2; +# +# Bug#54475 improper error handling causes cascading crashing failures in innodb/ndb +# +CREATE TABLE t1(f1 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +UPDATE (SELECT ((SELECT 1 FROM t1), 1) FROM t1 WHERE (SELECT 1 FROM t1)) x, (SELECT 1) AS d SET d.f1 = 1; +ERROR 21000: Operand should contain 1 column(s) +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_mysql.result b/mysql-test/suite/innodb_plugin/r/innodb_mysql.result index 1aee85b5288..65a8abff162 100644 --- a/mysql-test/suite/innodb_plugin/r/innodb_mysql.result +++ b/mysql-test/suite/innodb_plugin/r/innodb_mysql.result @@ -2410,4 +2410,42 @@ PACK_KEYS=0; CREATE INDEX a ON t1 (a); CREATE INDEX c on t1 (c); DROP TABLE t1; +CREATE TABLE t1 ( +pk int NOT NULL AUTO_INCREMENT PRIMARY KEY, +a int, +b int, +INDEX idx(a)) +ENGINE=INNODB; +INSERT INTO t1(a,b) VALUES +(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500), +(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800), +(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700), +(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000); +INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1; +INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1; +INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1 VALUES (1000000, 0, 0); +SET SESSION sort_buffer_size = 1024*36; +EXPLAIN +SELECT COUNT(*) FROM +(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) +WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 3537 Using sort_union(idx,PRIMARY); Using where +SELECT COUNT(*) FROM +(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) +WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; +COUNT(*) +1537 +SET SESSION sort_buffer_size = DEFAULT; +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/suite/innodb_plugin/t/innodb-autoinc-18274.test b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-18274.test new file mode 100644 index 00000000000..8734311dd7a --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-18274.test @@ -0,0 +1,29 @@ +-- source include/have_innodb_plugin.inc +# embedded server ignores 'delayed', so skip this +-- source include/not_embedded.inc + +let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# Bug #18274 InnoDB auto_increment field reset on OPTIMIZE TABLE +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +SHOW CREATE TABLE t1; +DELETE FROM t1; +OPTIMIZE TABLE t1; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +DROP TABLE t1; + +# +# restore environment to the state it was before this test execution +# + +-- disable_query_log +eval set global innodb_file_format_check=$innodb_file_format_check_orig; diff --git a/mysql-test/suite/innodb_plugin/t/innodb-autoinc-56228-master.opt b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-56228-master.opt new file mode 100644 index 00000000000..0eed7aaadad --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-56228-master.opt @@ -0,0 +1 @@ +--innodb_autoinc_lock_mode=0 diff --git a/mysql-test/suite/innodb_plugin/t/innodb-autoinc-56228.test b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-56228.test new file mode 100644 index 00000000000..eb38b21861d --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-56228.test @@ -0,0 +1,42 @@ +-- source include/have_innodb_plugin.inc + +let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; + +## +# Bug #56228: dropping tables from within an active statement crashes server +# +DROP TABLE IF EXISTS t1_56228; +DROP TABLE IF EXISTS t2_56228; +DROP FUNCTION IF EXISTS bug56228; + +CREATE TEMPORARY TABLE t1_56228( + c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2_56228( + c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; + +DELIMITER //; + +CREATE FUNCTION bug56228() RETURNS INT DETERMINISTIC +BEGIN + INSERT INTO t1_56228 VALUES(NULL); + INSERT INTO t2_56228 VALUES(NULL); + INSERT INTO t1_56228 VALUES(NULL); + INSERT INTO t2_56228 VALUES(NULL); + DROP TEMPORARY TABLE t1_56228; + RETURN 42; +END // + +DELIMITER ;// + +SELECT bug56228(); + +DROP FUNCTION bug56228; +DROP TEMPORARY TABLE t2_56228; +DROP TEMPORARY TABLE IF EXISTS t1_56228; + +# +# restore environment to the state it was before this test execution +# + +-- disable_query_log +eval set global innodb_file_format_check=$innodb_file_format_check_orig; diff --git a/mysql-test/suite/innodb_plugin/t/innodb-autoinc.test b/mysql-test/suite/innodb_plugin/t/innodb-autoinc.test index 997c503d2d3..4967a6efbb9 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc.test @@ -293,21 +293,8 @@ INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 SELECT * FROM t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't, it seems to be -# a MySQL server bug. It wraps around to 0 for the last value. -# See MySQL Bug# 39828 -# -# Instead of wrapping around, it asserts when MySQL is compiled --with-debug -# (see sql/handler.cc:handler::update_auto_increment()). Don't test for -# overflow until Bug #39828 is fixed. -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#endif +--error ER_AUTOINC_READ_FAILED +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); SELECT * FROM t1; DROP TABLE t1; @@ -325,20 +312,8 @@ INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 SELECT * FROM t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't. It fails with -# a duplicate entry message because of a MySQL server bug, it wraps -# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace -# the ER_DUP_ENTRY, 1062 below with the appropriate error message -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -# Still need to fix this error code, error should mention overflow -#-- error ER_DUP_ENTRY,1062 -#INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL); -#endif +--error ER_AUTOINC_READ_FAILED +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); SELECT * FROM t1; DROP TABLE t1; @@ -376,20 +351,8 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2 SELECT * FROM t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't. It wraps around -# and the autoinc values look bogus too. -# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error -# code expected test. -# -- error ER_AUTOINC_READ_FAILED,1467 -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#-- error ER_AUTOINC_READ_FAILED,1467 -#INSERT INTO t1 VALUES (NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL); -#endif +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t1 VALUES (NULL),(NULL); SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/innodb_plugin/t/innodb-create-options.test b/mysql-test/suite/innodb_plugin/t/innodb-create-options.test new file mode 100755 index 00000000000..2f95ccc45cb --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb-create-options.test @@ -0,0 +1,575 @@ +# Tests for various combinations of ROW_FORMAT and KEY_BLOCK_SIZE +# Related bugs; +# Bug#54679: ALTER TABLE causes compressed row_format to revert to compact +# Bug#56628: ALTER TABLE .. KEY_BLOCK_SIZE=0 produces untrue warning or unnecessary error +# Bug#56632: ALTER TABLE implicitly changes ROW_FORMAT to COMPRESSED +# Rules for interpreting CREATE_OPTIONS +# 1) Create options on an ALTER are added to the options on the +# previous CREATE or ALTER statements. +# 2) KEY_BLOCK_SIZE=0 is considered a unspecified value. +# If the current ROW_FORMAT has explicitly been set to COMPRESSED, +# InnoDB will use a default value of 8. Otherwise KEY_BLOCK_SIZE +# will not be used. +# 3) ROW_FORMAT=DEFAULT allows InnoDB to choose its own default, COMPACT. +# 4) ROW_FORMAT=DEFAULT and KEY_BLOCK_SIZE=0 can be used at any time to +# unset or erase the values persisted in the MySQL dictionary and +# by SHOW CTREATE TABLE. +# 5) When incompatible values for ROW_FORMAT and KEY_BLOCK_SIZE are +# both explicitly given, the ROW_FORMAT is always used in non-strict +# mode. +# 6) InnoDB will automatically convert a table to COMPRESSED only if a +# valid non-zero KEY_BLOCK_SIZE has been given and ROW_FORMAT=DEFAULT +# or has not been used on a previous CREATE TABLE or ALTER TABLE. +# 7) InnoDB strict mode is designed to prevent incompatible create +# options from being used together. +# 8) The non-strict behavior is intended to permit you to import a +# mysqldump file into a database that does not support compressed +# tables, even if the source database contained compressed tables. +# All invalid values and/or incompatible combinations of ROW_FORMAT +# and KEY_BLOCK_SIZE are automatically corrected +# +# *** innodb_strict_mode=ON *** +# 1) Valid ROW_FORMATs are COMPRESSED, COMPACT, DEFAULT, DYNAMIC +# & REDUNDANT. All others are rejected. +# 2) Valid KEY_BLOCK_SIZEs are 0,1,2,4,8,16. All others are rejected. +# 3) KEY_BLOCK_SIZE=0 can be used to set it to 'unspecified'. +# 4) KEY_BLOCK_SIZE=1,2,4,8 & 16 are incompatible with COMPACT, DYNAMIC & +# REDUNDANT. +# 5) KEY_BLOCK_SIZE=1,2,4,8 & 16 as well as ROW_FORMAT=COMPRESSED and +# ROW_FORMAT=DYNAMIC are incompatible with innodb_file_format=Antelope +# and innodb_file_per_table=OFF +# 6) KEY_BLOCK_SIZE on an ALTER must occur with ROW_FORMAT=COMPRESSED +# or ROW_FORMAT=DEFAULT if the ROW_FORMAT was previously specified +# as COMPACT, DYNAMIC or REDUNDANT. +# 7) KEY_BLOCK_SIZE on an ALTER can occur without a ROW_FORMAT if the +# previous ROW_FORMAT was DEFAULT, COMPRESSED, or unspecified. +# +# *** innodb_strict_mode=OFF *** +# 1. Ignore a bad KEY_BLOCK_SIZE, defaulting it to 8. +# 2. Ignore a bad ROW_FORMAT, defaulting to COMPACT. +# 3. Ignore a valid KEY_BLOCK_SIZE when an incompatible but valid +# ROW_FORMAT is specified. +# 4. If innodb_file_format=Antelope or innodb_file_per_table=OFF +# it will ignore ROW_FORMAT=COMPRESSED or DYNAMIC and it will +# ignore all non-zero KEY_BLOCK_SIZEs. +# +# See InnoDB documentation page "SQL Compression Syntax Warnings and Errors" + +-- source include/have_innodb_plugin.inc +SET storage_engine=InnoDB; + +--disable_query_log +# These values can change during the test +LET $innodb_file_format_orig=`select @@innodb_file_format`; +LET $innodb_file_format_check_orig=`select @@innodb_file_format_check`; +LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`; +LET $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`; +--enable_query_log + +SET GLOBAL innodb_file_format=`Barracuda`; +SET GLOBAL innodb_file_per_table=ON; + +# The first half of these tests are with strict mode ON. +SET SESSION innodb_strict_mode = ON; + +--echo # Test 1) StrictMode=ON, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0 +--echo # KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified' +DROP TABLE IF EXISTS t1; +--echo # 'FIXED' is sent to InnoDB since it is used by MyISAM. +--echo # But it is an invalid mode in InnoDB +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED; +SHOW WARNINGS; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + + + +--echo # Test 2) StrictMode=ON, CREATE with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE +--echo # KEY_BLOCK_SIZE is incompatible with COMPACT, REDUNDANT, & DYNAMIC +DROP TABLE IF EXISTS t1; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2; +SHOW WARNINGS; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4; +SHOW WARNINGS; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + + +--echo # Test 3) StrictMode=ON, ALTER with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + + +--echo # Test 4) StrictMode=ON, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid non-zero KEY_BLOCK_SIZE +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 KEY_BLOCK_SIZE=2; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 KEY_BLOCK_SIZE=4; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 KEY_BLOCK_SIZE=8; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + +--echo # Test 5) StrictMode=ON, CREATE with a valid KEY_BLOCK_SIZE +--echo # ALTER with each ROW_FORMAT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=2; +SHOW CREATE TABLE t1; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW CREATE TABLE t1; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=COMPACT; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=COMPACT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + +--echo # Test 6) StrictMode=ON, CREATE with an invalid KEY_BLOCK_SIZE. +DROP TABLE IF EXISTS t1; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=9; +SHOW WARNINGS; + +--echo # Test 7) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and +--echo # and a valid non-zero KEY_BLOCK_SIZE are rejected with Antelope +--echo # and that they can be set to default values during strict mode. +SET GLOBAL innodb_file_format=Antelope; +DROP TABLE IF EXISTS t1; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=4; +SHOW WARNINGS; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT; +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 KEY_BLOCK_SIZE=8; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +SET GLOBAL innodb_file_format=Barracuda; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SET GLOBAL innodb_file_format=Antelope; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ADD COLUMN f1 INT; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +SET GLOBAL innodb_file_format=Barracuda; + +--echo # Test 8) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and +--echo # and a valid non-zero KEY_BLOCK_SIZE are rejected with +--echo # innodb_file_per_table=OFF and that they can be set to default +--echo # values during strict mode. +SET GLOBAL innodb_file_per_table=OFF; +DROP TABLE IF EXISTS t1; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT; +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 KEY_BLOCK_SIZE=1; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +ALTER TABLE t1 ROW_FORMAT=COMPACT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=DEFAULT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +SET GLOBAL innodb_file_per_table=ON; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SET GLOBAL innodb_file_per_table=OFF; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ADD COLUMN f1 INT; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +SET GLOBAL innodb_file_per_table=ON; + +--echo ################################################## +SET SESSION innodb_strict_mode = OFF; + +--echo # Test 9) StrictMode=OFF, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0 +--echo # KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified' +--echo # 'FIXED' is sent to InnoDB since it is used by MyISAM. +--echo # It is an invalid mode in InnoDB, use COMPACT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + +--echo # Test 10) StrictMode=OFF, CREATE with each ROW_FORMAT & a valid KEY_BLOCK_SIZE +--echo # KEY_BLOCK_SIZE is ignored with COMPACT, REDUNDANT, & DYNAMIC +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + + +--echo # Test 11) StrictMode=OFF, ALTER with each ROW_FORMAT & a valid KEY_BLOCK_SIZE +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ); +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + + +--echo # Test 12) StrictMode=OFF, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid KEY_BLOCK_SIZE +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 KEY_BLOCK_SIZE=2; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 KEY_BLOCK_SIZE=4; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=8; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + +--echo # Test 13) StrictMode=OFF, CREATE with a valid KEY_BLOCK_SIZE +--echo # ALTER with each ROW_FORMAT +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +ALTER TABLE t1 ROW_FORMAT=COMPACT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +ALTER TABLE t1 ROW_FORMAT=COMPACT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + +--echo # Test 14) StrictMode=OFF, CREATE with an invalid KEY_BLOCK_SIZE, it defaults to 8 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=15; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + +--echo # Test 15) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a +--echo valid KEY_BLOCK_SIZE are remembered but not used when ROW_FORMAT +--echo is reverted to Antelope and then used again when ROW_FORMAT=Barracuda. +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +SET GLOBAL innodb_file_format=Antelope; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +SET GLOBAL innodb_file_format=Barracuda; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +SET GLOBAL innodb_file_format=Antelope; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +SET GLOBAL innodb_file_format=Barracuda; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + +--echo # Test 16) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a +--echo valid KEY_BLOCK_SIZE are remembered but not used when innodb_file_per_table=OFF +--echo and then used again when innodb_file_per_table=ON. +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +SET GLOBAL innodb_file_per_table=OFF; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +SET GLOBAL innodb_file_per_table=ON; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +SET GLOBAL innodb_file_per_table=OFF; +ALTER TABLE t1 ADD COLUMN f1 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; +SET GLOBAL innodb_file_per_table=ON; +ALTER TABLE t1 ADD COLUMN f2 INT; +SHOW WARNINGS; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; + + +--echo # Cleanup +DROP TABLE IF EXISTS t1; + +--disable_query_log +EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig; +EVAL SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig; +EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; +EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig; +--enable_query_log + diff --git a/mysql-test/suite/innodb_plugin/t/innodb-zip.test b/mysql-test/suite/innodb_plugin/t/innodb-zip.test index 4980af437e6..8c1ef1f5467 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb-zip.test +++ b/mysql-test/suite/innodb_plugin/t/innodb-zip.test @@ -173,9 +173,7 @@ set innodb_strict_mode = on; #Test different values of KEY_BLOCK_SIZE ---error ER_CANT_CREATE_TABLE create table t1 (id int primary key) engine = innodb key_block_size = 0; -show warnings; --error ER_CANT_CREATE_TABLE create table t2 (id int primary key) engine = innodb key_block_size = 9; @@ -196,7 +194,7 @@ create table t11(id int primary key) engine = innodb row_format = redundant; SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb'; -drop table t3, t4, t5, t6, t7, t8, t9, t10, t11; +drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11; #test different values of ROW_FORMAT with KEY_BLOCK_SIZE create table t1 (id int primary key) engine = innodb @@ -217,14 +215,12 @@ create table t4 (id int primary key) engine = innodb key_block_size = 8 row_format = dynamic; show warnings; ---error ER_CANT_CREATE_TABLE create table t5 (id int primary key) engine = innodb key_block_size = 8 row_format = default; -show warnings; SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb'; -drop table t1; +drop table t1, t5; #test multiple errors --error ER_CANT_CREATE_TABLE diff --git a/mysql-test/suite/innodb_plugin/t/innodb.test b/mysql-test/suite/innodb_plugin/t/innodb.test index 1b840f696c1..aeddddaba28 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb.test +++ b/mysql-test/suite/innodb_plugin/t/innodb.test @@ -45,6 +45,15 @@ drop table if exists t1,t2,t3,t4; drop database if exists mysqltest; --enable_warnings +# Bug#58912 InnoDB unnecessarily avoids update-in-place on column prefixes +CREATE TABLE bug58912 (a BLOB, b TEXT, PRIMARY KEY(a(1))) ENGINE=InnoDB; +INSERT INTO bug58912 VALUES(REPEAT('a',8000),REPEAT('b',8000)); +UPDATE bug58912 SET a=REPEAT('a',7999); +# The above statements used to trigger a failure during purge when +# Bug#55284 was fixed while Bug#58912 was not. Defer the DROP TABLE, +# so that purge gets a chance to run (and a double free of the +# off-page column can be detected, if one is to occur.) + # # Small basic test with ignore # @@ -2543,6 +2552,9 @@ SET GLOBAL innodb_thread_concurrency = @innodb_thread_concurrency_orig; -- enable_query_log +# Clean up after the Bug#55284/Bug#58912 test case. +DROP TABLE bug58912; + ####################################################################### # # # Please, DO NOT TOUCH this file as well as the innodb.result file. # diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug53046.test b/mysql-test/suite/innodb_plugin/t/innodb_bug53046.test new file mode 100644 index 00000000000..7d9422fe487 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53046.test @@ -0,0 +1,48 @@ +# +# http://bugs.mysql.com/53046 +# dict_update_statistics_low can still be run concurrently on same table +# +# This is a symbolic test, it would not fail if the bug is present. +# Rather those SQL commands have been used during manual testing under +# UNIV_DEBUG & UNIV_SYNC_DEBUG to test all changed codepaths for locking +# correctness. +# + +-- source include/have_innodb_plugin.inc + +CREATE TABLE bug53046_1 (c1 INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE bug53046_2 (c2 INT PRIMARY KEY, + FOREIGN KEY (c2) REFERENCES bug53046_1(c1) + ON UPDATE CASCADE ON DELETE CASCADE) ENGINE=INNODB; + +INSERT INTO bug53046_1 VALUES (1); +let $i = 5; +while ($i) { + eval INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) + FROM bug53046_1; + dec $i; +} + +INSERT INTO bug53046_2 VALUES (1), (2); + +# CREATE TABLE innodb_table_monitor (a int) ENGINE=INNODB; +# wait more than 1 minute and observe the mysqld output +# DROP TABLE innodb_table_monitor; + +ANALYZE TABLE bug53046_1; + +# this prints create time and other nondeterministic data +-- disable_result_log +SHOW TABLE STATUS LIKE 'bug53046_1'; +-- enable_result_log + +UPDATE bug53046_1 SET c1 = c1 - 1; + +DELETE FROM bug53046_1; + +INSERT INTO bug53046_1 VALUES (1); +INSERT INTO bug53046_2 VALUES (1); +TRUNCATE TABLE bug53046_2; + +DROP TABLE bug53046_2; +DROP TABLE bug53046_1; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54679.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54679.test deleted file mode 100644 index 863d9847ac1..00000000000 --- a/mysql-test/suite/innodb_plugin/t/innodb_bug54679.test +++ /dev/null @@ -1,97 +0,0 @@ -# Test Bug #54679 alter table causes compressed row_format to revert to compact - ---source include/have_innodb_plugin.inc - -let $file_format=`select @@innodb_file_format`; -let $file_format_check=`select @@innodb_file_format_check`; -let $file_per_table=`select @@innodb_file_per_table`; -SET GLOBAL innodb_file_format='Barracuda'; -SET GLOBAL innodb_file_per_table=ON; -SET innodb_strict_mode=ON; - -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; - -# The ROW_FORMAT of the table should be preserved when it is not specified -# in ALTER TABLE. -ALTER TABLE bug54679 ADD COLUMN b INT; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; - -DROP TABLE bug54679; - -# Check that the ROW_FORMAT conversion to/from COMPRESSED works. - -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; - -# KEY_BLOCK_SIZE implies COMPRESSED. -ALTER TABLE bug54679 KEY_BLOCK_SIZE=1; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; - ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ -SHOW WARNINGS; -DROP TABLE bug54679; -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; - -ALTER TABLE bug54679 KEY_BLOCK_SIZE=2; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables -WHERE TABLE_NAME='bug54679'; - -# This prevents other than REDUNDANT or COMPACT ROW_FORMAT for new tables. -SET GLOBAL innodb_file_format=Antelope; - ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ -SHOW WARNINGS; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ -SHOW WARNINGS; -DROP TABLE bug54679; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ -SHOW WARNINGS; -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; - -SET GLOBAL innodb_file_format=Barracuda; -# This will prevent ROW_FORMAT=COMPRESSED, because the system tablespace -# cannot be compressed. -SET GLOBAL innodb_file_per_table=OFF; - ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ -SHOW WARNINGS; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ -SHOW WARNINGS; -DROP TABLE bug54679; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; ---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ -SHOW WARNINGS; -SET GLOBAL innodb_file_per_table=ON; -CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; -DROP TABLE bug54679; - -EVAL SET GLOBAL innodb_file_format=$file_format; -EVAL SET GLOBAL innodb_file_format_check=$file_format_check; -EVAL SET GLOBAL innodb_file_per_table=$file_per_table; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug56632.test b/mysql-test/suite/innodb_plugin/t/innodb_bug56632.test deleted file mode 100755 index 7f1c41cddfa..00000000000 --- a/mysql-test/suite/innodb_plugin/t/innodb_bug56632.test +++ /dev/null @@ -1,216 +0,0 @@ -# -# Bug#56632: ALTER TABLE implicitly changes ROW_FORMAT to COMPRESSED -# http://bugs.mysql.com/56632 -# -# Innodb automatically uses compressed mode when the KEY_BLOCK_SIZE -# parameter is used, except if the ROW_FORMAT is also specified, in -# which case the KEY_BLOCK_SIZE is ignored and a warning is shown. -# But Innodb was getting confused when neither of those parameters -# was used on the ALTER statement after they were both used on the -# CREATE. -# -# This will test the results of all 4 combinations of these two -# parameters of the CREATE and ALTER. -# -# Tests 1-5 use INNODB_STRICT_MODE=1 which returns an error -# if there is anything wrong with the statement. -# -# 1) CREATE with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1, ALTER with neither. -# Result; CREATE; fails with error ER_CANT_CREATE_TABLE -# 2) CREATE with ROW_FORMAT=COMPACT, ALTER with KEY_BLOCK_SIZE=1 -# Result; CREATE succeeds, -# ALTER quietly converts ROW_FORMAT to compressed. -# 3) CREATE with KEY_BLOCK_SIZE=1, ALTER with ROW_FORMAT=COMPACT -# Result; CREATE quietly converts ROW_FORMAT to compressed, -# ALTER fails with error ER_CANT_CREATE_TABLE. -# 4) CREATE with neither, ALTER with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1 -# Result; CREATE succeeds, -# ALTER; fails with error ER_CANT_CREATE_TABLE -# 5) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither. -# Result; CREATE; fails with error ER_CANT_CREATE_TABLE -# -# Tests 6-11 use INNODB_STRICT_MODE=0 which automatically makes -# adjustments if the prameters are incompatible. -# -# 6) CREATE with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1, ALTER with neither. -# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE is ignored. -# ALTER succeeds, no warnings. -# 7) CREATE with ROW_FORMAT=COMPACT, ALTER with KEY_BLOCK_SIZE=1 -# Result; CREATE succeeds, -# ALTER quietly converts ROW_FORMAT to compressed. -# 8) CREATE with KEY_BLOCK_SIZE=1, ALTER with ROW_FORMAT=COMPACT -# Result; CREATE quietly converts ROW_FORMAT to compressed, -# ALTER succeeds, warns that KEY_BLOCK_SIZE is ignored. -# 9) CREATE with neither, ALTER with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1 -# Result; CREATE succeeds, -# ALTER succeeds, warns that KEY_BLOCK_SIZE is ignored. -# 10) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither. -# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE=3 is ignored. -# ALTER succeeds, warns that KEY_BLOCK_SIZE=3 is ignored. -# 11) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with ROW_FORMAT=COMPACT. -# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE=3 is ignored. -# ALTER succeeds, warns that KEY_BLOCK_SIZE=3 is ignored. -# 12) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with KEY_BLOCK_SIZE=1. -# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE=3 is ignored. -# ALTER succeeds, quietly converts ROW_FORMAT to compressed. - --- source include/have_innodb_plugin.inc - -SET storage_engine=InnoDB; - ---disable_query_log -# These values can change during the test -LET $innodb_file_format_orig=`select @@innodb_file_format`; -LET $innodb_file_format_check_orig=`select @@innodb_file_format_check`; -LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`; -LET $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`; ---enable_query_log - -SET GLOBAL innodb_file_format=`Barracuda`; -SET GLOBAL innodb_file_per_table=ON; - -# Innodb strict mode will cause an error on the CREATE or ALTER when; -# 1. both ROW_FORMAT=COMPACT and KEY_BLOCK_SIZE=1, -# 2. KEY_BLOCK_SIZE is not a valid number (0,1,2,4,8,16). -# With innodb_strict_mode = OFF, These errors are corrected -# and just a warning is returned. -SET SESSION innodb_strict_mode = ON; - ---echo # Test 1) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither -DROP TABLE IF EXISTS bug56632; ---error ER_CANT_CREATE_TABLE -CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; -SHOW WARNINGS; - ---echo # Test 2) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -ALTER TABLE bug56632 KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Test 3) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; ---disable_result_log ---error ER_CANT_CREATE_TABLE -ALTER TABLE bug56632 ROW_FORMAT=COMPACT; ---enable_result_log -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Test 4) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ); -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; ---disable_result_log ---error ER_CANT_CREATE_TABLE -ALTER TABLE bug56632 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; ---enable_result_log -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Test 5) CREATE with KEY_BLOCK_SIZE=3 (invalid). -DROP TABLE IF EXISTS bug56632; ---error ER_CANT_CREATE_TABLE -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3; -SHOW WARNINGS; - -SET SESSION innodb_strict_mode = OFF; - ---echo # Test 6) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -ALTER TABLE bug56632 ADD COLUMN f1 INT; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Test 7) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -ALTER TABLE bug56632 KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Test 8) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -ALTER TABLE bug56632 ROW_FORMAT=COMPACT; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Test 9) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ); -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -ALTER TABLE bug56632 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Test 10) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither. -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -ALTER TABLE bug56632 ADD COLUMN f1 INT; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Test 11) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with ROW_FORMAT=COMPACT. -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -ALTER TABLE bug56632 ROW_FORMAT=COMPACT; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Test 12) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with KEY_BLOCK_SIZE=1. -DROP TABLE IF EXISTS bug56632; -CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; -ALTER TABLE bug56632 KEY_BLOCK_SIZE=1; -SHOW WARNINGS; -SHOW CREATE TABLE bug56632; -SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632'; - ---echo # Cleanup -DROP TABLE IF EXISTS bug56632; - ---disable_query_log -EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; -EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig; -EVAL SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig; -EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig; ---enable_query_log - diff --git a/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test b/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test index 890889301e6..3d9a9a53193 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test @@ -27,3 +27,14 @@ select * from bug38999_1; select * from bug38999_2; drop table bug38999_1,bug38999_2; + + +--echo # +--echo # Bug#54475 improper error handling causes cascading crashing failures in innodb/ndb +--echo # +CREATE TABLE t1(f1 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +--error ER_OPERAND_COLUMNS +UPDATE (SELECT ((SELECT 1 FROM t1), 1) FROM t1 WHERE (SELECT 1 FROM t1)) x, (SELECT 1) AS d SET d.f1 = 1; +DROP TABLE t1; + diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql.test b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test index 4855d9e2055..279802fcdb4 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_mysql.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test @@ -647,5 +647,48 @@ CREATE INDEX c on t1 (c); DROP TABLE t1; +# +# Bug#56862 Execution of a query that uses index merge returns a wrong result +# + +CREATE TABLE t1 ( + pk int NOT NULL AUTO_INCREMENT PRIMARY KEY, + a int, + b int, + INDEX idx(a)) +ENGINE=INNODB; + +INSERT INTO t1(a,b) VALUES + (11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500), + (3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800), + (6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700), + (13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000); +INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1; +INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1; +INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1 VALUES (1000000, 0, 0); + +SET SESSION sort_buffer_size = 1024*36; + +EXPLAIN +SELECT COUNT(*) FROM + (SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) + WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; + +SELECT COUNT(*) FROM + (SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) + WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; + +SET SESSION sort_buffer_size = DEFAULT; + +DROP TABLE t1; --echo End of 5.1 tests diff --git a/mysql-test/suite/manual/t/rpl_replication_delay.test b/mysql-test/suite/manual/t/rpl_replication_delay.test index fc1db9bfe18..f2b2da6f53c 100644 --- a/mysql-test/suite/manual/t/rpl_replication_delay.test +++ b/mysql-test/suite/manual/t/rpl_replication_delay.test @@ -7,9 +7,8 @@ source include/master-slave.inc; -connection master; -#connection slave; -sync_slave_with_master; +connection slave; + --echo # Second_behind reports 0 let $status_items= Seconds_Behind_Master; source include/show_slave_status.inc; @@ -61,9 +60,4 @@ unlock tables; connection master; drop table t1; -#connection slave; -sync_slave_with_master; - - -# End of tests - +--source include/rpl_end.inc diff --git a/mysql-test/suite/maria/r/maria-autozerofill.result b/mysql-test/suite/maria/r/maria-autozerofill.result index 5638af70c5c..ad0ea32362a 100644 --- a/mysql-test/suite/maria/r/maria-autozerofill.result +++ b/mysql-test/suite/maria/r/maria-autozerofill.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); drop database if exists mysqltest; create database mysqltest; use mysqltest; diff --git a/mysql-test/suite/maria/r/maria-recover.result b/mysql-test/suite/maria/r/maria-recover.result index 5353a249f96..128467a278c 100644 --- a/mysql-test/suite/maria/r/maria-recover.result +++ b/mysql-test/suite/maria/r/maria-recover.result @@ -20,9 +20,11 @@ create table t1 (a varchar(1000), index(a)) engine=aria; insert into t1 values("ThursdayMorningsMarket"); flush table t1; insert into t1 select concat(a,'b') from t1 limit 1; +set global maria_checkpoint_interval=1000; select * from t_corrupted2; a ThursdayMorningsMarket +ThursdayMorningsMarketb Warnings: Error 145 t_corrupted2' is marked as crashed and should be repaired Error 1194 t_corrupted2' is marked as crashed and should be repaired @@ -31,5 +33,7 @@ Error 1034 Wrong base information on indexpage at page: 1 select * from t_corrupted2; a ThursdayMorningsMarket +ThursdayMorningsMarketb drop database mysqltest; set global aria_recover=backup; +set global aria_checkpoint_interval=30; diff --git a/mysql-test/suite/maria/r/maria.result b/mysql-test/suite/maria/r/maria.result index 2eb3546fc96..f7ce8efaa46 100644 --- a/mysql-test/suite/maria/r/maria.result +++ b/mysql-test/suite/maria/r/maria.result @@ -2624,3 +2624,45 @@ KEY (v3) INSERT INTO t1 ( f1 , f2 , f3 , f4 ) SELECT f1 , f4 , f1 , f4 FROM t1; DELETE FROM t1; drop table t1; +create table t1 (a int not null primary key, b blob) engine=maria transactional=1; +insert into t1 values(1,repeat('a',8000)); +insert into t1 values(2,repeat('b',8000)); +insert into t1 values(3,repeat('c',8000)); +flush tables; +delete from t1 where a>1; +insert into t1 values(1,repeat('d',8000*3)); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +flush tables; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +repair table t1 extended; +Table Op Msg_type Msg_text +test.t1 repair status OK +drop table t1; +create table t1 (a int, b int, key (a), key(b)); +alter table t1 disable keys; +insert into t1 values(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1); +alter table t1 enable keys; +select count(*) from t1; +count(*) +13 +drop table t1; +create table t1 (a int not null, b int, primary key (a), key(b)); +alter table t1 disable keys; +insert into t1 values(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1); +alter table t1 enable keys; +select count(*) from t1; +count(*) +13 +drop table t1; +create table t1 (a int not null, b int, primary key (a), key(b)); +lock tables t1 write; +alter table t1 disable keys; +insert into t1 values(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1); +alter table t1 enable keys; +unlock tables; +select count(*) from t1; +count(*) +13 +drop table t1; diff --git a/mysql-test/suite/maria/t/maria-autozerofill.test b/mysql-test/suite/maria/t/maria-autozerofill.test index 2f47d13ba50..b42b8e177dc 100644 --- a/mysql-test/suite/maria/t/maria-autozerofill.test +++ b/mysql-test/suite/maria/t/maria-autozerofill.test @@ -5,6 +5,8 @@ --source include/not_embedded.inc --source include/have_maria.inc +call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); + let $MARIA_LOG=.; --disable_warnings diff --git a/mysql-test/suite/maria/t/maria-recover.test b/mysql-test/suite/maria/t/maria-recover.test index 0fad13a297b..29b05879967 100644 --- a/mysql-test/suite/maria/t/maria-recover.test +++ b/mysql-test/suite/maria/t/maria-recover.test @@ -8,6 +8,10 @@ call mtr.add_suppression("Checking table: '\\..mysqltest.t_corrupted2'"); call mtr.add_suppression("Recovering table: '\\..mysqltest.t_corrupted2'"); call mtr.add_suppression("Table '\\..mysqltest.t_corrupted2' is marked as crashed and should be repaired"); +call mtr.add_suppression("Table 't_corrupted2' is marked as crashed and should be repaired"); + +let $def_checkinterval=`select @@global.maria_checkpoint_interval`; + --enable_query_log # Note: we're setting an environment variable (not prefixing it by $), @@ -34,6 +38,10 @@ insert into t1 values("ThursdayMorningsMarket"); flush table t1; # put index page on disk insert into t1 select concat(a,'b') from t1 limit 1; +# force a checkpoint to get the open count > 0 +set global maria_checkpoint_interval=1000; +# Wait for checkpoint to happen +--sleep 1 # now t1 has its open_count>0 and so will t2_corrupted. # It is not named t2 because the corruption messages which will be put # in the error log need to be detected in mtr_process.pl, and we want @@ -57,7 +65,6 @@ perl; syswrite (FILE, $whatever) or die; close FILE; EOF - replace_regex /Table.*t_corrupted2/t_corrupted2/ ; --enable_prepare_warnings select * from t_corrupted2; # should show corruption and repair messages @@ -66,3 +73,4 @@ select * from t_corrupted2; # should show just rows drop database mysqltest; set global aria_recover=backup; +eval set global aria_checkpoint_interval=$def_checkinterval; diff --git a/mysql-test/suite/maria/t/maria-recovery-rtree-ft.test b/mysql-test/suite/maria/t/maria-recovery-rtree-ft.test index a943185d12f..01ab5740258 100644 --- a/mysql-test/suite/maria/t/maria-recovery-rtree-ft.test +++ b/mysql-test/suite/maria/t/maria-recovery-rtree-ft.test @@ -6,6 +6,7 @@ # Binary must be compiled with debug for crash to occur --source include/have_debug.inc --source include/have_maria.inc +--source include/long_test.inc set global aria_log_file_size=4294967295; let $MARIA_LOG=.; diff --git a/mysql-test/suite/maria/t/maria.test b/mysql-test/suite/maria/t/maria.test index ccbe2c99037..e23821b8be9 100644 --- a/mysql-test/suite/maria/t/maria.test +++ b/mysql-test/suite/maria/t/maria.test @@ -1911,6 +1911,51 @@ DELETE FROM t1; drop table t1; # +# Test of problem where REPAIR finds old deleted rows. +# + +create table t1 (a int not null primary key, b blob) engine=maria transactional=1; +insert into t1 values(1,repeat('a',8000)); +insert into t1 values(2,repeat('b',8000)); +insert into t1 values(3,repeat('c',8000)); +flush tables; +delete from t1 where a>1; +--error 1062 +insert into t1 values(1,repeat('d',8000*3)); +flush tables; +check table t1; +# This failed by finding 2 extra rows. +repair table t1 extended; +drop table t1; + +# +# Test problem with disable/enable keys +# + +create table t1 (a int, b int, key (a), key(b)); +alter table t1 disable keys; +insert into t1 values(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1); +alter table t1 enable keys; +select count(*) from t1; +drop table t1; + +create table t1 (a int not null, b int, primary key (a), key(b)); +alter table t1 disable keys; +insert into t1 values(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1); +alter table t1 enable keys; +select count(*) from t1; +drop table t1; + +create table t1 (a int not null, b int, primary key (a), key(b)); +lock tables t1 write; +alter table t1 disable keys; +insert into t1 values(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1); +alter table t1 enable keys; +unlock tables; +select count(*) from t1; +drop table t1; + +# # End of test # # Set defaults back diff --git a/mysql-test/suite/maria/t/maria3.test b/mysql-test/suite/maria/t/maria3.test index 55b5959a970..b73b75ecfce 100644 --- a/mysql-test/suite/maria/t/maria3.test +++ b/mysql-test/suite/maria/t/maria3.test @@ -172,11 +172,13 @@ create table t1 (a bigint auto_increment, primary key(a), b char(255), c varchar let $1=1000; --disable_query_log --disable_warnings +lock tables t1 write; while ($1) { insert into t1 () values(); dec $1; } +unlock tables; --enable_query_log update t1 set b=repeat('a',100) where a between 1 and 100; check table t1; diff --git a/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test b/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test index e08b1b6f701..5d6c915307a 100644 --- a/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test +++ b/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test @@ -1,6 +1,4 @@ ############################################### -# Author: JBM # -# Date: 2006-03-07 # # Purpose: To test advance DD and replication # ############################################### @@ -11,11 +9,6 @@ --source include/not_embedded.inc --source include/ndb_master-slave.inc -#### Test start cleanup section ##### ---disable_warnings -DROP TABLE IF EXISTS t1, t2, t3; ---enable_warnings - ###################################################### # Requirment: Cluster DD and replication must be able# # to handle ALTER tables and indexes and must rpl # @@ -408,3 +401,4 @@ remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql; remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql; # End 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/ndb_team/t/rpl_ndb_extraColMaster.test b/mysql-test/suite/ndb_team/t/rpl_ndb_extraColMaster.test index d78eda7eef1..f5625f841b0 100644 --- a/mysql-test/suite/ndb_team/t/rpl_ndb_extraColMaster.test +++ b/mysql-test/suite/ndb_team/t/rpl_ndb_extraColMaster.test @@ -12,3 +12,5 @@ set binlog_format=row; set binlog_format=mixed; -- source extra/rpl_tests/rpl_extraMaster_Col.test + +--source include/rpl_end.inc diff --git a/mysql-test/suite/ndb_team/t/rpl_ndb_mix_innodb.test b/mysql-test/suite/ndb_team/t/rpl_ndb_mix_innodb.test index b730bcc08e0..87bd1aecd30 100644 --- a/mysql-test/suite/ndb_team/t/rpl_ndb_mix_innodb.test +++ b/mysql-test/suite/ndb_team/t/rpl_ndb_mix_innodb.test @@ -1,6 +1,4 @@ ############################################# -#Authors: TU and Jeb -#Date: 2007/04 #Purpose: Generic replication to cluster # and ensuring that the ndb_apply_status # table is updated. @@ -34,3 +32,4 @@ let $off_set = 9; let $rpl_format = 'MIX'; --source extra/rpl_tests/rpl_ndb_apply_status.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc b/mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc index 25a9774d2a1..b7a170dd9d8 100644 --- a/mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc +++ b/mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc @@ -39,29 +39,6 @@ let $val3 = 17 ; let $val4 = 15 ; --source suite/parts/inc/partition_supported_sql_funcs.inc - -let $sqlfunc = ceiling(col1); -let $valsqlfunc = ceiling(15); -let $coltype = float(7,4); -let $infile = part_supported_sql_funcs_int_float.inc; -let $val1 = 5.1230; -let $val2 = 13.345; -let $val3 = 17.987; -let $val4 = 15.654 ; -# DISABLED due to bug 30577 -#--source suite/parts/inc/partition_supported_sql_funcs.inc - -let $sqlfunc = floor(col1); -let $valsqlfunc = floor(15.123); -let $coltype = float(7,4); -let $infile = part_supported_sql_funcs_int_float.inc; -let $val1 = 5.1230; -let $val2 = 13.345; -let $val3 = 17.987; -let $val4 = 15.654 ; -# DISABLED due to bug 30577 -#--source suite/parts/inc/partition_supported_sql_funcs.inc - let $sqlfunc = mod(col1,10); let $valsqlfunc = mod(15,10); let $coltype = int; @@ -111,8 +88,9 @@ let $val2 = '2006-01-17'; let $val3 = '2006-02-25'; let $val4 = '2006-02-05'; --source suite/parts/inc/partition_supported_sql_funcs.inc -let $coltype = char(30); ---source suite/parts/inc/partition_supported_sql_funcs.inc +# Disabled after fixing bug#54483. +#let $coltype = char(30); +#--source suite/parts/inc/partition_supported_sql_funcs.inc let $sqlfunc = extract(month from col1); let $valsqlfunc = extract(year from '1998-11-23'); @@ -162,8 +140,9 @@ let $val2 = '14:30:20'; let $val3 = '21:59:22'; let $val4 = '10:22:33'; --source suite/parts/inc/partition_supported_sql_funcs.inc -let $coltype = char(30); ---source suite/parts/inc/partition_supported_sql_funcs.inc +# second(non_time_col) is disabled after bug#54483. +#let $coltype = char(30); +#--source suite/parts/inc/partition_supported_sql_funcs.inc let $sqlfunc = month(col1); let $valsqlfunc = month('2006-10-14'); @@ -195,26 +174,28 @@ let $val3 = '21:59:22'; let $val4 = '10:33:11'; --source suite/parts/inc/partition_supported_sql_funcs.inc -let $sqlfunc = to_days(col1)-to_days('2006-01-01'); -let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01'); -let $coltype = date; -let $infile = part_supported_sql_funcs_int_date.inc; -let $val1 = '2006-02-03'; -let $val2 = '2006-01-17'; -let $val3 = '2006-01-25'; -let $val4 = '2006-02-06'; ---source suite/parts/inc/partition_supported_sql_funcs.inc +# to_days(non_date_col) is disabled after bug#54483. +#let $sqlfunc = to_days(col1)-to_days('2006-01-01'); +#let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01'); +#let $coltype = date; +#let $infile = part_supported_sql_funcs_int_date.inc; +#let $val1 = '2006-02-03'; +#let $val2 = '2006-01-17'; +#let $val3 = '2006-01-25'; +#let $val4 = '2006-02-06'; +#--source suite/parts/inc/partition_supported_sql_funcs.inc +# to_days(non_date_col) is disabled after bug#54483. # DATEDIFF() is implemented as (TO_DAYS(d1) - TO_DAYS(d2)) -let $sqlfunc = datediff(col1, '2006-01-01'); -let $valsqlfunc = datediff('2006-02-02', '2006-01-01'); -let $coltype = date; -let $infile = part_supported_sql_funcs_int_date.inc; -let $val1 = '2006-02-03'; -let $val2 = '2006-01-17'; -let $val3 = '2006-01-25'; -let $val4 = '2006-02-06'; ---source suite/parts/inc/partition_supported_sql_funcs.inc +#let $sqlfunc = datediff(col1, '2006-01-01'); +#let $valsqlfunc = datediff('2006-02-02', '2006-01-01'); +#let $coltype = date; +#let $infile = part_supported_sql_funcs_int_date.inc; +#let $val1 = '2006-02-03'; +#let $val2 = '2006-01-17'; +#let $val3 = '2006-01-25'; +#let $val4 = '2006-02-06'; +#--source suite/parts/inc/partition_supported_sql_funcs.inc let $sqlfunc = weekday(col1); let $valsqlfunc = weekday('2006-10-14'); diff --git a/mysql-test/suite/parts/inc/partition_auto_increment.inc b/mysql-test/suite/parts/inc/partition_auto_increment.inc index 102e57d3d04..034460d49ac 100644 --- a/mysql-test/suite/parts/inc/partition_auto_increment.inc +++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc @@ -105,6 +105,30 @@ OPTIMIZE TABLE t1; SHOW CREATE TABLE t1; DROP TABLE t1; +if (!$skip_update) +{ +eval CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, + UNIQUE KEY (a)) +ENGINE=$engine; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +SELECT * FROM t1; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +SELECT * FROM t1; +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +SELECT * FROM t1; +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +SELECT * FROM t1; +DROP TABLE t1; +SET INSERT_ID = 1; +} + -- echo # Simple test with NULL eval CREATE TABLE t1 ( c1 INT NOT NULL AUTO_INCREMENT, @@ -831,5 +855,30 @@ SELECT * FROM t ORDER BY c1 ASC; DROP TABLE t; +if (!$skip_update) +{ +eval CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, + UNIQUE KEY (a)) +ENGINE=$engine +PARTITION BY KEY(a) PARTITIONS 2; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +SELECT * FROM t1; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +SELECT * FROM t1; +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +SELECT * FROM t1; +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +SELECT * FROM t1; +DROP TABLE t1; +} + + --echo ############################################################################## } diff --git a/mysql-test/suite/parts/inc/partition_check_drop.inc b/mysql-test/suite/parts/inc/partition_check_drop.inc index daaa5e541c7..cd4a4cfe2f5 100644 --- a/mysql-test/suite/parts/inc/partition_check_drop.inc +++ b/mysql-test/suite/parts/inc/partition_check_drop.inc @@ -66,10 +66,10 @@ if ($found_garbage) } # Do a manual cleanup, because the following tests should not suffer from # remaining files - --exec rm -f $MYSQLD_DATADIR/test/t1* || true + --remove_files_wildcard $MYSQLD_DATADIR/test t1* if ($with_directories) { - --exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true + --remove_files_wildcard $MYSQLD_DATADIR/test/tmp t1* } } --enable_query_log diff --git a/mysql-test/suite/parts/inc/partition_decimal.inc b/mysql-test/suite/parts/inc/partition_decimal.inc index 95ef878b957..93e9e48c9c9 100644 --- a/mysql-test/suite/parts/inc/partition_decimal.inc +++ b/mysql-test/suite/parts/inc/partition_decimal.inc @@ -39,10 +39,8 @@ drop table t2; # Bug 30577: FLOOR() and CEILING() not usable as partition functions # Partition functions are required to return INT_RESULT; FLOOR() and -# CEILING() do not, unless they have an INT argument. Disable this -# portion of the test until bug 30577 is fixed. +# CEILING() do not, unless they have an INT or DECIMAL argument. ---disable_parsing eval create table t3 (a decimal(18,9) not null, primary key(a)) engine=$engine partition by range (floor(a)) subpartition by key (a) subpartitions 2 ( @@ -70,7 +68,7 @@ select count(*) from t3; drop table t3; eval create table t4 (a decimal(18,9) not null, primary key(a)) engine=$engine -partition by list (floor(a)) subpartition by key (a) subpartitions 2 ( +partition by list (ceiling(a)) subpartition by key (a) subpartitions 2 ( partition pa2 values in (1,2), partition pa4 values in (3,4), partition pa6 values in (5,6), @@ -93,6 +91,3 @@ commit; --enable_query_log select count(*) from t4; drop table t4; - -# Disabled due to Bug 30577 ---enable_parsing diff --git a/mysql-test/suite/parts/inc/partition_double.inc b/mysql-test/suite/parts/inc/partition_double.inc index aef5aa4f675..16d542f7309 100644 --- a/mysql-test/suite/parts/inc/partition_double.inc +++ b/mysql-test/suite/parts/inc/partition_double.inc @@ -36,62 +36,3 @@ commit; --enable_query_log select count(*) from t2; drop table t2; - - -# Bug 30577: FLOOR() and CEILING() not usable as partition functions -# Partition functions are required to return INT_RESULT; FLOOR() and -# CEILING() do not, unless they have an INT argument. Disable this -# portion of the test until bug 30577 is fixed. - ---disable_parsing - -eval create table t3 (a double not null, primary key(a)) engine=$engine -partition by range (floor(a)) subpartition by key (a) subpartitions 3 ( -partition pa1 values less than (3), -partition pa3 values less than (6), -partition pa10 values less than (10) -); -show create table t3; -let $count=9; ---echo $count*3 inserts; ---disable_query_log -begin; -while ($count) -{ -eval insert into t3 values ($count); -eval insert into t3 values ($count+0.33); -eval insert into t3 values ($count+0.75); -dec $count; -} -commit; ---enable_query_log -select count(*) from t3; -select * from t3; -drop table t3; - -eval create table t4 (a double not null, primary key(a)) engine=$engine -partition by list (floor(a)) subpartition by key (a) subpartitions 3 ( -partition pa1 values in (1,2,3), -partition pa3 values in (4,5,6), -partition pa10 values in (7,8,9,10) -); -show create table t4; -let $count=9; ---echo $count*3 inserts; ---disable_query_log -begin; -while ($count) -{ -eval insert into t4 values ($count); -eval insert into t4 values ($count+0.33); -eval insert into t4 values ($count+0.75); -dec $count; -} -commit; ---enable_query_log -select count(*) from t4; -select * from t4; -drop table t4; - -# Disabled due to Bug 30577 ---enable_parsing diff --git a/mysql-test/suite/parts/inc/partition_float.inc b/mysql-test/suite/parts/inc/partition_float.inc index 8da12a3e5bd..b9c6af84fc4 100644 --- a/mysql-test/suite/parts/inc/partition_float.inc +++ b/mysql-test/suite/parts/inc/partition_float.inc @@ -40,61 +40,3 @@ commit; --enable_query_log select count(*) from t2; drop table t2; - -# Bug 30577: FLOOR() and CEILING() not usable as partition functions -# Partition functions are required to return INT_RESULT; FLOOR() and -# CEILING() do not, unless they have an INT argument. Disable this -# portion of the test until bug 30577 is fixed. - ---disable_parsing - -eval create table t3 (a float not null, primary key(a)) engine=$engine -partition by range (floor(a)) subpartition by key (a) subpartitions 3 ( -partition pa1 values less than (3), -partition pa3 values less than (6), -partition pa10 values less than (10) -); -show create table t3; -let $count=9; ---echo $count*3 inserts; ---disable_query_log -begin; -while ($count) -{ -eval insert into t3 values ($count); -eval insert into t3 values ($count+0.33); -eval insert into t3 values ($count+0.75); -dec $count; -} -commit; ---enable_query_log -select count(*) from t3; -select * from t3; -drop table t3; - -eval create table t4 (a float not null, primary key(a)) engine=$engine -partition by list (floor(a)) subpartition by key (a) subpartitions 3 ( -partition pa1 values in (1,2,3), -partition pa3 values in (4,5,6), -partition pa10 values in (7,8,9,10) -); -show create table t4; -let $count=9; ---echo $count*3 inserts; ---disable_query_log -begin; -while ($count) -{ -eval insert into t4 values ($count); -eval insert into t4 values ($count+0.33); -eval insert into t4 values ($count+0.75); -dec $count; -} -commit; ---enable_query_log -select count(*) from t4; -select * from t4; -drop table t4; - -# Disabled due to Bug 30577 ---enable_parsing diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result index 79462c25050..c5b4e0a8665 100644 --- a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result +++ b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result @@ -5425,513 +5425,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- dayofyear(col1) in partition with coltype char(30) -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with dayofyear(col1) -------------------------------------------------------------------------- -create table t1 (col1 char(30)) engine='INNODB' -partition by range(dayofyear(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 char(30)) engine='INNODB' -partition by list(dayofyear(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 char(30)) engine='INNODB' -partition by hash(dayofyear(col1)); -create table t4 (colint int, col1 char(30)) engine='INNODB' -partition by range(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 char(30)) engine='INNODB' -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 char(30)) engine='INNODB' -partition by range(colint) -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with dayofyear(col1) -------------------------------------------------------------------------- -insert into t1 values ('2006-01-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-03'); -insert into t2 values ('2006-01-17'); -insert into t2 values ('2006-02-25'); -insert into t3 values ('2006-01-03'); -insert into t3 values ('2006-01-17'); -insert into t3 values ('2006-02-25'); -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; -select dayofyear(col1) from t1 order by col1; -dayofyear(col1) -3 -17 -select * from t1 order by col1; -col1 -2006-01-03 -2006-01-17 -select * from t2 order by col1; -col1 -2006-01-03 -2006-01-17 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-03 -2006-01-17 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-05' where col1='2006-01-03'; -update t2 set col1='2006-02-05' where col1='2006-01-03'; -update t3 set col1='2006-02-05' where col1='2006-01-03'; -update t4 set col1='2006-02-05' where col1='2006-01-03'; -update t5 set col1='2006-02-05' where col1='2006-01-03'; -update t6 set col1='2006-02-05' where col1='2006-01-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with dayofyear(col1) -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='INNODB' as select * from t1; -create table t22 engine='INNODB' as select * from t2; -create table t33 engine='INNODB' as select * from t3; -create table t44 engine='INNODB' as select * from t4; -create table t55 engine='INNODB' as select * from t5; -create table t66 engine='INNODB' as select * from t6; -alter table t11 -partition by range(dayofyear(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(dayofyear(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(dayofyear(col1)); -alter table t44 -partition by range(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -alter table t55 -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` char(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (dayofyear(col1)) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ -select * from t55 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with dayofyear(col1) -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-05 -select * from t2 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with dayofyear(col1) -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-05 -select * from t22 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- extract(month from col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; @@ -8489,525 +7982,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- second(col1) in partition with coltype char(30) -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with second(col1) -------------------------------------------------------------------------- -create table t1 (col1 char(30)) engine='INNODB' -partition by range(second(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 char(30)) engine='INNODB' -partition by list(second(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 char(30)) engine='INNODB' -partition by hash(second(col1)); -create table t4 (colint int, col1 char(30)) engine='INNODB' -partition by range(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 char(30)) engine='INNODB' -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 char(30)) engine='INNODB' -partition by range(colint) -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with second(col1) -------------------------------------------------------------------------- -insert into t1 values ('09:09:09'); -insert into t1 values ('14:30:20'); -insert into t2 values ('09:09:09'); -insert into t2 values ('14:30:20'); -insert into t2 values ('21:59:22'); -insert into t3 values ('09:09:09'); -insert into t3 values ('14:30:20'); -insert into t3 values ('21:59:22'); -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; -select second(col1) from t1 order by col1; -second(col1) -9 -20 -select * from t1 order by col1; -col1 -09:09:09 -14:30:20 -select * from t2 order by col1; -col1 -09:09:09 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -09:09:09 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -update t1 set col1='10:22:33' where col1='09:09:09'; -update t2 set col1='10:22:33' where col1='09:09:09'; -update t3 set col1='10:22:33' where col1='09:09:09'; -update t4 set col1='10:22:33' where col1='09:09:09'; -update t5 set col1='10:22:33' where col1='09:09:09'; -update t6 set col1='10:22:33' where col1='09:09:09'; -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -------------------------------------------------------------------------- ---- Alter tables with second(col1) -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='INNODB' as select * from t1; -create table t22 engine='INNODB' as select * from t2; -create table t33 engine='INNODB' as select * from t3; -create table t44 engine='INNODB' as select * from t4; -create table t55 engine='INNODB' as select * from t5; -create table t66 engine='INNODB' as select * from t6; -alter table t11 -partition by range(second(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(second(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(second(col1)); -alter table t44 -partition by range(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -alter table t55 -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` char(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (second(col1)) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with second(col1) -------------------------------------------------------------------------- -delete from t1 where col1='14:30:20'; -delete from t2 where col1='14:30:20'; -delete from t3 where col1='14:30:20'; -delete from t4 where col1='14:30:20'; -delete from t5 where col1='14:30:20'; -delete from t6 where col1='14:30:20'; -select * from t1 order by col1; -col1 -10:22:33 -select * from t2 order by col1; -col1 -10:22:33 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -insert into t1 values ('14:30:20'); -insert into t2 values ('14:30:20'); -insert into t3 values ('14:30:20'); -insert into t4 values (60,'14:30:20'); -insert into t5 values (60,'14:30:20'); -insert into t6 values (60,'14:30:20'); -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -60 14:30:20 -select * from t5 order by colint; -colint col1 -60 14:30:20 -select * from t6 order by colint; -colint col1 -60 14:30:20 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with second(col1) -------------------------------------------------------------------------- -delete from t11 where col1='14:30:20'; -delete from t22 where col1='14:30:20'; -delete from t33 where col1='14:30:20'; -delete from t44 where col1='14:30:20'; -delete from t55 where col1='14:30:20'; -delete from t66 where col1='14:30:20'; -select * from t11 order by col1; -col1 -10:22:33 -select * from t22 order by col1; -col1 -10:22:33 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -insert into t11 values ('14:30:20'); -insert into t22 values ('14:30:20'); -insert into t33 values ('14:30:20'); -insert into t44 values (60,'14:30:20'); -insert into t55 values (60,'14:30:20'); -insert into t66 values (60,'14:30:20'); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -60 14:30:20 -select * from t55 order by colint; -colint col1 -60 14:30:20 -select * from t66 order by colint; -colint col1 -60 14:30:20 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- month(col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; @@ -10549,1024 +9523,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- to_days(col1)-to_days('2006-01-01') in partition with coltype date -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -create table t1 (col1 date) engine='INNODB' -partition by range(to_days(col1)-to_days('2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 date) engine='INNODB' -partition by list(to_days(col1)-to_days('2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 date) engine='INNODB' -partition by hash(to_days(col1)-to_days('2006-01-01')); -create table t4 (colint int, col1 date) engine='INNODB' -partition by range(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 date) engine='INNODB' -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 date) engine='INNODB' -partition by range(colint) -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -insert into t1 values ('2006-02-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-02-03'); -insert into t2 values ('2006-01-17'); -insert into t2 values ('2006-01-25'); -insert into t3 values ('2006-02-03'); -insert into t3 values ('2006-01-17'); -insert into t3 values ('2006-01-25'); -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; -select to_days(col1)-to_days('2006-01-01') from t1 order by col1; -to_days(col1)-to_days('2006-01-01') -16 -33 -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-03 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-06' where col1='2006-02-03'; -update t2 set col1='2006-02-06' where col1='2006-02-03'; -update t3 set col1='2006-02-06' where col1='2006-02-03'; -update t4 set col1='2006-02-06' where col1='2006-02-03'; -update t5 set col1='2006-02-06' where col1='2006-02-03'; -update t6 set col1='2006-02-06' where col1='2006-02-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='INNODB' as select * from t1; -create table t22 engine='INNODB' as select * from t2; -create table t33 engine='INNODB' as select * from t3; -create table t44 engine='INNODB' as select * from t4; -create table t55 engine='INNODB' as select * from t5; -create table t66 engine='INNODB' as select * from t6; -alter table t11 -partition by range(to_days(col1)-to_days('2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(to_days(col1)-to_days('2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(to_days(col1)-to_days('2006-01-01')); -alter table t44 -partition by range(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t55 -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -60 2006-01-17 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -60 2006-01-17 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- ---- datediff(col1, '2006-01-01') in partition with coltype date -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -create table t1 (col1 date) engine='INNODB' -partition by range(datediff(col1, '2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 date) engine='INNODB' -partition by list(datediff(col1, '2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 date) engine='INNODB' -partition by hash(datediff(col1, '2006-01-01')); -create table t4 (colint int, col1 date) engine='INNODB' -partition by range(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 date) engine='INNODB' -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 date) engine='INNODB' -partition by range(colint) -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -insert into t1 values ('2006-02-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-02-03'); -insert into t2 values ('2006-01-17'); -insert into t2 values ('2006-01-25'); -insert into t3 values ('2006-02-03'); -insert into t3 values ('2006-01-17'); -insert into t3 values ('2006-01-25'); -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; -select datediff(col1, '2006-01-01') from t1 order by col1; -datediff(col1, '2006-01-01') -16 -33 -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-03 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-06' where col1='2006-02-03'; -update t2 set col1='2006-02-06' where col1='2006-02-03'; -update t3 set col1='2006-02-06' where col1='2006-02-03'; -update t4 set col1='2006-02-06' where col1='2006-02-03'; -update t5 set col1='2006-02-06' where col1='2006-02-03'; -update t6 set col1='2006-02-06' where col1='2006-02-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='INNODB' as select * from t1; -create table t22 engine='INNODB' as select * from t2; -create table t33 engine='INNODB' as select * from t3; -create table t44 engine='INNODB' as select * from t4; -create table t55 engine='INNODB' as select * from t5; -create table t66 engine='INNODB' as select * from t6; -alter table t11 -partition by range(datediff(col1, '2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(datediff(col1, '2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(datediff(col1, '2006-01-01')); -alter table t44 -partition by range(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t55 -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (datediff(col1, '2006-01-01')) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -60 2006-01-17 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -60 2006-01-17 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- weekday(col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result index 375a6e130be..3cd8e10a4f3 100644 --- a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result +++ b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result @@ -5425,513 +5425,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- dayofyear(col1) in partition with coltype char(30) -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with dayofyear(col1) -------------------------------------------------------------------------- -create table t1 (col1 char(30)) engine='MYISAM' -partition by range(dayofyear(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 char(30)) engine='MYISAM' -partition by list(dayofyear(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 char(30)) engine='MYISAM' -partition by hash(dayofyear(col1)); -create table t4 (colint int, col1 char(30)) engine='MYISAM' -partition by range(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 char(30)) engine='MYISAM' -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 char(30)) engine='MYISAM' -partition by range(colint) -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with dayofyear(col1) -------------------------------------------------------------------------- -insert into t1 values ('2006-01-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-03'); -insert into t2 values ('2006-01-17'); -insert into t2 values ('2006-02-25'); -insert into t3 values ('2006-01-03'); -insert into t3 values ('2006-01-17'); -insert into t3 values ('2006-02-25'); -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; -select dayofyear(col1) from t1 order by col1; -dayofyear(col1) -3 -17 -select * from t1 order by col1; -col1 -2006-01-03 -2006-01-17 -select * from t2 order by col1; -col1 -2006-01-03 -2006-01-17 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-03 -2006-01-17 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-05' where col1='2006-01-03'; -update t2 set col1='2006-02-05' where col1='2006-01-03'; -update t3 set col1='2006-02-05' where col1='2006-01-03'; -update t4 set col1='2006-02-05' where col1='2006-01-03'; -update t5 set col1='2006-02-05' where col1='2006-01-03'; -update t6 set col1='2006-02-05' where col1='2006-01-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with dayofyear(col1) -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='MYISAM' as select * from t1; -create table t22 engine='MYISAM' as select * from t2; -create table t33 engine='MYISAM' as select * from t3; -create table t44 engine='MYISAM' as select * from t4; -create table t55 engine='MYISAM' as select * from t5; -create table t66 engine='MYISAM' as select * from t6; -alter table t11 -partition by range(dayofyear(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(dayofyear(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(dayofyear(col1)); -alter table t44 -partition by range(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -alter table t55 -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` char(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (dayofyear(col1)) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ -select * from t55 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with dayofyear(col1) -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-05 -select * from t2 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with dayofyear(col1) -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-05 -select * from t22 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- extract(month from col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; @@ -8489,525 +7982,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- second(col1) in partition with coltype char(30) -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with second(col1) -------------------------------------------------------------------------- -create table t1 (col1 char(30)) engine='MYISAM' -partition by range(second(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 char(30)) engine='MYISAM' -partition by list(second(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 char(30)) engine='MYISAM' -partition by hash(second(col1)); -create table t4 (colint int, col1 char(30)) engine='MYISAM' -partition by range(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 char(30)) engine='MYISAM' -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 char(30)) engine='MYISAM' -partition by range(colint) -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with second(col1) -------------------------------------------------------------------------- -insert into t1 values ('09:09:09'); -insert into t1 values ('14:30:20'); -insert into t2 values ('09:09:09'); -insert into t2 values ('14:30:20'); -insert into t2 values ('21:59:22'); -insert into t3 values ('09:09:09'); -insert into t3 values ('14:30:20'); -insert into t3 values ('21:59:22'); -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; -select second(col1) from t1 order by col1; -second(col1) -9 -20 -select * from t1 order by col1; -col1 -09:09:09 -14:30:20 -select * from t2 order by col1; -col1 -09:09:09 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -09:09:09 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -update t1 set col1='10:22:33' where col1='09:09:09'; -update t2 set col1='10:22:33' where col1='09:09:09'; -update t3 set col1='10:22:33' where col1='09:09:09'; -update t4 set col1='10:22:33' where col1='09:09:09'; -update t5 set col1='10:22:33' where col1='09:09:09'; -update t6 set col1='10:22:33' where col1='09:09:09'; -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -------------------------------------------------------------------------- ---- Alter tables with second(col1) -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='MYISAM' as select * from t1; -create table t22 engine='MYISAM' as select * from t2; -create table t33 engine='MYISAM' as select * from t3; -create table t44 engine='MYISAM' as select * from t4; -create table t55 engine='MYISAM' as select * from t5; -create table t66 engine='MYISAM' as select * from t6; -alter table t11 -partition by range(second(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(second(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(second(col1)); -alter table t44 -partition by range(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -alter table t55 -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` char(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (second(col1)) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with second(col1) -------------------------------------------------------------------------- -delete from t1 where col1='14:30:20'; -delete from t2 where col1='14:30:20'; -delete from t3 where col1='14:30:20'; -delete from t4 where col1='14:30:20'; -delete from t5 where col1='14:30:20'; -delete from t6 where col1='14:30:20'; -select * from t1 order by col1; -col1 -10:22:33 -select * from t2 order by col1; -col1 -10:22:33 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -insert into t1 values ('14:30:20'); -insert into t2 values ('14:30:20'); -insert into t3 values ('14:30:20'); -insert into t4 values (60,'14:30:20'); -insert into t5 values (60,'14:30:20'); -insert into t6 values (60,'14:30:20'); -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -60 14:30:20 -select * from t5 order by colint; -colint col1 -60 14:30:20 -select * from t6 order by colint; -colint col1 -60 14:30:20 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with second(col1) -------------------------------------------------------------------------- -delete from t11 where col1='14:30:20'; -delete from t22 where col1='14:30:20'; -delete from t33 where col1='14:30:20'; -delete from t44 where col1='14:30:20'; -delete from t55 where col1='14:30:20'; -delete from t66 where col1='14:30:20'; -select * from t11 order by col1; -col1 -10:22:33 -select * from t22 order by col1; -col1 -10:22:33 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -insert into t11 values ('14:30:20'); -insert into t22 values ('14:30:20'); -insert into t33 values ('14:30:20'); -insert into t44 values (60,'14:30:20'); -insert into t55 values (60,'14:30:20'); -insert into t66 values (60,'14:30:20'); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -60 14:30:20 -select * from t55 order by colint; -colint col1 -60 14:30:20 -select * from t66 order by colint; -colint col1 -60 14:30:20 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- month(col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; @@ -10549,1024 +9523,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- to_days(col1)-to_days('2006-01-01') in partition with coltype date -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -create table t1 (col1 date) engine='MYISAM' -partition by range(to_days(col1)-to_days('2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 date) engine='MYISAM' -partition by list(to_days(col1)-to_days('2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 date) engine='MYISAM' -partition by hash(to_days(col1)-to_days('2006-01-01')); -create table t4 (colint int, col1 date) engine='MYISAM' -partition by range(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 date) engine='MYISAM' -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 date) engine='MYISAM' -partition by range(colint) -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -insert into t1 values ('2006-02-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-02-03'); -insert into t2 values ('2006-01-17'); -insert into t2 values ('2006-01-25'); -insert into t3 values ('2006-02-03'); -insert into t3 values ('2006-01-17'); -insert into t3 values ('2006-01-25'); -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; -select to_days(col1)-to_days('2006-01-01') from t1 order by col1; -to_days(col1)-to_days('2006-01-01') -16 -33 -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-03 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-06' where col1='2006-02-03'; -update t2 set col1='2006-02-06' where col1='2006-02-03'; -update t3 set col1='2006-02-06' where col1='2006-02-03'; -update t4 set col1='2006-02-06' where col1='2006-02-03'; -update t5 set col1='2006-02-06' where col1='2006-02-03'; -update t6 set col1='2006-02-06' where col1='2006-02-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='MYISAM' as select * from t1; -create table t22 engine='MYISAM' as select * from t2; -create table t33 engine='MYISAM' as select * from t3; -create table t44 engine='MYISAM' as select * from t4; -create table t55 engine='MYISAM' as select * from t5; -create table t66 engine='MYISAM' as select * from t6; -alter table t11 -partition by range(to_days(col1)-to_days('2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(to_days(col1)-to_days('2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(to_days(col1)-to_days('2006-01-01')); -alter table t44 -partition by range(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t55 -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -60 2006-01-17 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -60 2006-01-17 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- ---- datediff(col1, '2006-01-01') in partition with coltype date -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -create table t1 (col1 date) engine='MYISAM' -partition by range(datediff(col1, '2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 date) engine='MYISAM' -partition by list(datediff(col1, '2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 date) engine='MYISAM' -partition by hash(datediff(col1, '2006-01-01')); -create table t4 (colint int, col1 date) engine='MYISAM' -partition by range(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 date) engine='MYISAM' -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 date) engine='MYISAM' -partition by range(colint) -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -insert into t1 values ('2006-02-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-02-03'); -insert into t2 values ('2006-01-17'); -insert into t2 values ('2006-01-25'); -insert into t3 values ('2006-02-03'); -insert into t3 values ('2006-01-17'); -insert into t3 values ('2006-01-25'); -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; -select datediff(col1, '2006-01-01') from t1 order by col1; -datediff(col1, '2006-01-01') -16 -33 -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-03 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-06' where col1='2006-02-03'; -update t2 set col1='2006-02-06' where col1='2006-02-03'; -update t3 set col1='2006-02-06' where col1='2006-02-03'; -update t4 set col1='2006-02-06' where col1='2006-02-03'; -update t5 set col1='2006-02-06' where col1='2006-02-03'; -update t6 set col1='2006-02-06' where col1='2006-02-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='MYISAM' as select * from t1; -create table t22 engine='MYISAM' as select * from t2; -create table t33 engine='MYISAM' as select * from t3; -create table t44 engine='MYISAM' as select * from t4; -create table t55 engine='MYISAM' as select * from t5; -create table t66 engine='MYISAM' as select * from t6; -alter table t11 -partition by range(datediff(col1, '2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(datediff(col1, '2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(datediff(col1, '2006-01-01')); -alter table t44 -partition by range(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t55 -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (datediff(col1, '2006-01-01')) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -60 2006-01-17 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -60 2006-01-17 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- weekday(col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result index d6ea8ba0fe4..2344f03ce3f 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result @@ -120,6 +120,38 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 DROP TABLE t1; +CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, +UNIQUE KEY (a)) +ENGINE='Blackhole'; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +DROP TABLE t1; +SET INSERT_ID = 1; # Simple test with NULL CREATE TABLE t1 ( c1 INT NOT NULL AUTO_INCREMENT, diff --git a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result index 4cd7aa57417..34e47f58272 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result @@ -134,8 +134,44 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, +UNIQUE KEY (a)) +ENGINE='InnoDB'; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +1 +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 DROP TABLE t1; +SET INSERT_ID = 1; # Simple test with NULL CREATE TABLE t1 ( c1 INT NOT NULL AUTO_INCREMENT, @@ -404,7 +440,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */ DROP TABLE t1; @@ -1023,4 +1059,40 @@ c1 c2 2 20 127 40 DROP TABLE t; +CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, +UNIQUE KEY (a)) +ENGINE='InnoDB' +PARTITION BY KEY(a) PARTITIONS 2; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +1 +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +DROP TABLE t1; ############################################################################## diff --git a/mysql-test/suite/parts/r/partition_auto_increment_maria.result b/mysql-test/suite/parts/r/partition_auto_increment_maria.result index 757eaca3a60..b9310a2a314 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_maria.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_maria.result @@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 DROP TABLE t1; +CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, +UNIQUE KEY (a)) +ENGINE='Aria'; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +1 +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +DROP TABLE t1; +SET INSERT_ID = 1; # Simple test with NULL CREATE TABLE t1 ( c1 INT NOT NULL AUTO_INCREMENT, @@ -1070,4 +1106,40 @@ c1 c2 2 20 127 40 DROP TABLE t; +CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, +UNIQUE KEY (a)) +ENGINE='Aria' +PARTITION BY KEY(a) PARTITIONS 2; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +1 +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +DROP TABLE t1; ############################################################################## diff --git a/mysql-test/suite/parts/r/partition_auto_increment_memory.result b/mysql-test/suite/parts/r/partition_auto_increment_memory.result index 1a27d1c2e52..c3a5073b029 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result @@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 DROP TABLE t1; +CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, +UNIQUE KEY (a)) +ENGINE='Memory'; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +1 +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +DROP TABLE t1; +SET INSERT_ID = 1; # Simple test with NULL CREATE TABLE t1 ( c1 INT NOT NULL AUTO_INCREMENT, @@ -1051,4 +1087,40 @@ c1 c2 2 20 127 40 DROP TABLE t; +CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, +UNIQUE KEY (a)) +ENGINE='Memory' +PARTITION BY KEY(a) PARTITIONS 2; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +1 +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +DROP TABLE t1; ############################################################################## diff --git a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result index 9885c78a921..ad440155d33 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result @@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 DROP TABLE t1; +CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, +UNIQUE KEY (a)) +ENGINE='MyISAM'; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +1 +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +DROP TABLE t1; +SET INSERT_ID = 1; # Simple test with NULL CREATE TABLE t1 ( c1 INT NOT NULL AUTO_INCREMENT, @@ -1070,4 +1106,40 @@ c1 c2 2 20 127 40 DROP TABLE t; +CREATE TABLE t1 +(a INT NULL AUTO_INCREMENT, +UNIQUE KEY (a)) +ENGINE='MyISAM' +PARTITION BY KEY(a) PARTITIONS 2; +SET LAST_INSERT_ID = 999; +SET INSERT_ID = 0; +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +1 +INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = 1 WHERE a IS NULL; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +UPDATE t1 SET a = NULL WHERE a = 1; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +999 +SELECT * FROM t1; +a +0 +DROP TABLE t1; ############################################################################## diff --git a/mysql-test/suite/parts/r/partition_decimal_innodb.result b/mysql-test/suite/parts/r/partition_decimal_innodb.result index 70debf3c595..8eb408d05d9 100644 --- a/mysql-test/suite/parts/r/partition_decimal_innodb.result +++ b/mysql-test/suite/parts/r/partition_decimal_innodb.result @@ -86,3 +86,57 @@ select count(*) from t2; count(*) 3072 drop table t2; +create table t3 (a decimal(18,9) not null, primary key(a)) engine='InnoDB' +partition by range (floor(a)) subpartition by key (a) subpartitions 2 ( +partition pa2 values less than (2), +partition pa4 values less than (4), +partition pa6 values less than (6), +partition pa8 values less than (8), +partition pa10 values less than (10) +); +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` decimal(18,9) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY RANGE (floor(a)) +SUBPARTITION BY KEY (a) +SUBPARTITIONS 2 +(PARTITION pa2 VALUES LESS THAN (2) ENGINE = InnoDB, + PARTITION pa4 VALUES LESS THAN (4) ENGINE = InnoDB, + PARTITION pa6 VALUES LESS THAN (6) ENGINE = InnoDB, + PARTITION pa8 VALUES LESS THAN (8) ENGINE = InnoDB, + PARTITION pa10 VALUES LESS THAN (10) ENGINE = InnoDB) */ +9*3 inserts; +select count(*) from t3; +count(*) +27 +drop table t3; +create table t4 (a decimal(18,9) not null, primary key(a)) engine='InnoDB' +partition by list (ceiling(a)) subpartition by key (a) subpartitions 2 ( +partition pa2 values in (1,2), +partition pa4 values in (3,4), +partition pa6 values in (5,6), +partition pa8 values in (7,8), +partition pa10 values in (9,10) +); +show create table t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `a` decimal(18,9) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (ceiling(a)) +SUBPARTITION BY KEY (a) +SUBPARTITIONS 2 +(PARTITION pa2 VALUES IN (1,2) ENGINE = InnoDB, + PARTITION pa4 VALUES IN (3,4) ENGINE = InnoDB, + PARTITION pa6 VALUES IN (5,6) ENGINE = InnoDB, + PARTITION pa8 VALUES IN (7,8) ENGINE = InnoDB, + PARTITION pa10 VALUES IN (9,10) ENGINE = InnoDB) */ +9*3 inserts; +select count(*) from t4; +count(*) +27 +drop table t4; diff --git a/mysql-test/suite/parts/r/partition_decimal_myisam.result b/mysql-test/suite/parts/r/partition_decimal_myisam.result index f9f7a1e4fe2..2b214bd94cf 100644 --- a/mysql-test/suite/parts/r/partition_decimal_myisam.result +++ b/mysql-test/suite/parts/r/partition_decimal_myisam.result @@ -86,3 +86,57 @@ select count(*) from t2; count(*) 196605 drop table t2; +create table t3 (a decimal(18,9) not null, primary key(a)) engine='MYISAM' +partition by range (floor(a)) subpartition by key (a) subpartitions 2 ( +partition pa2 values less than (2), +partition pa4 values less than (4), +partition pa6 values less than (6), +partition pa8 values less than (8), +partition pa10 values less than (10) +); +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` decimal(18,9) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY RANGE (floor(a)) +SUBPARTITION BY KEY (a) +SUBPARTITIONS 2 +(PARTITION pa2 VALUES LESS THAN (2) ENGINE = MyISAM, + PARTITION pa4 VALUES LESS THAN (4) ENGINE = MyISAM, + PARTITION pa6 VALUES LESS THAN (6) ENGINE = MyISAM, + PARTITION pa8 VALUES LESS THAN (8) ENGINE = MyISAM, + PARTITION pa10 VALUES LESS THAN (10) ENGINE = MyISAM) */ +9*3 inserts; +select count(*) from t3; +count(*) +27 +drop table t3; +create table t4 (a decimal(18,9) not null, primary key(a)) engine='MYISAM' +partition by list (ceiling(a)) subpartition by key (a) subpartitions 2 ( +partition pa2 values in (1,2), +partition pa4 values in (3,4), +partition pa6 values in (5,6), +partition pa8 values in (7,8), +partition pa10 values in (9,10) +); +show create table t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `a` decimal(18,9) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (ceiling(a)) +SUBPARTITION BY KEY (a) +SUBPARTITIONS 2 +(PARTITION pa2 VALUES IN (1,2) ENGINE = MyISAM, + PARTITION pa4 VALUES IN (3,4) ENGINE = MyISAM, + PARTITION pa6 VALUES IN (5,6) ENGINE = MyISAM, + PARTITION pa8 VALUES IN (7,8) ENGINE = MyISAM, + PARTITION pa10 VALUES IN (9,10) ENGINE = MyISAM) */ +9*3 inserts; +select count(*) from t4; +count(*) +27 +drop table t4; diff --git a/mysql-test/suite/parts/r/partition_recover_myisam.result b/mysql-test/suite/parts/r/partition_recover_myisam.result index df737ec2853..ccbc9a6c9ef 100644 --- a/mysql-test/suite/parts/r/partition_recover_myisam.result +++ b/mysql-test/suite/parts/r/partition_recover_myisam.result @@ -17,7 +17,7 @@ a 10 11 Warnings: -Error 145 Table './test/t1_will_crash' is marked as crashed and should be repaired +Error 145 Table 't1_will_crash' is marked as crashed and should be repaired Error 1194 Table 't1_will_crash' is marked as crashed and should be repaired Error 1034 1 client is using or hasn't closed the table properly Error 1034 Size of indexfile is: 1024 Should be: 2048 @@ -47,7 +47,7 @@ a 10 11 Warnings: -Error 145 Table './test/t1_will_crash#P#p1' is marked as crashed and should be repaired +Error 145 Table 't1_will_crash#P#p1' is marked as crashed and should be repaired Error 1194 Table 't1_will_crash' is marked as crashed and should be repaired Error 1034 1 client is using or hasn't closed the table properly Error 1034 Size of indexfile is: 1024 Should be: 2048 diff --git a/mysql-test/suite/parts/r/rpl_partition.result b/mysql-test/suite/parts/r/rpl_partition.result index 9c5ac34b1b0..00247f218e4 100644 --- a/mysql-test/suite/parts/r/rpl_partition.result +++ b/mysql-test/suite/parts/r/rpl_partition.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set @old_global_binlog_format= @@global.binlog_format; set @old_session_binlog_format= @@session.binlog_format; SET GLOBAL binlog_format = 'ROW'; @@ -11,10 +7,6 @@ SET SESSION binlog_format = 'ROW'; select @@global.binlog_format, @@session.binlog_format; @@global.binlog_format ROW @@session.binlog_format ROW -DROP TABLE IF EXISTS t1, t2, t3; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP PROCEDURE IF EXISTS p3; CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT, dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, fkid MEDIUMINT, filler VARCHAR(255), @@ -138,7 +130,7 @@ SUBPARTITIONS 2 PARTITION pa9 VALUES LESS THAN (90) ENGINE = InnoDB, PARTITION pa10 VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ -Checking that both slave threads are running. +include/check_slave_is_running.inc SELECT count(*) "Slave norm" FROM t1; Slave norm 500 SELECT count(*) "Slave bykey" FROM t2; @@ -148,6 +140,7 @@ Slave byrange 500 set @@global.binlog_format= @old_global_binlog_format; set @@session.binlog_format= @old_session_binlog_format; DROP TABLE t1, t2, t3; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP PROCEDURE IF EXISTS p3; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP PROCEDURE p3; +include/rpl_end.inc diff --git a/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test b/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test index fef41990e28..115bc08a624 100644 --- a/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test +++ b/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test @@ -30,6 +30,9 @@ let $do_long_tests= 1; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter1_2_innodb.test b/mysql-test/suite/parts/t/partition_alter1_2_innodb.test index edb0a981c20..71f9d33c72b 100644 --- a/mysql-test/suite/parts/t/partition_alter1_2_innodb.test +++ b/mysql-test/suite/parts/t/partition_alter1_2_innodb.test @@ -28,8 +28,6 @@ #------------------------------------------------------------------------------# # General not engine specific settings and requirements ---source include/big_test.inc - ##### Options, for debugging support ##### let $debug= 0; let $with_partitioning= 1; @@ -51,6 +49,9 @@ let $more_pk_ui_tests= 0; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter2_1_myisam.test b/mysql-test/suite/parts/t/partition_alter2_1_myisam.test index 1c89a82b960..11ec9b51f7c 100644 --- a/mysql-test/suite/parts/t/partition_alter2_1_myisam.test +++ b/mysql-test/suite/parts/t/partition_alter2_1_myisam.test @@ -22,6 +22,8 @@ # any of the variables. # +--source include/long_test.inc + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter2_2_myisam.test b/mysql-test/suite/parts/t/partition_alter2_2_myisam.test index c9b22ed8595..8fbb943a48d 100644 --- a/mysql-test/suite/parts/t/partition_alter2_2_myisam.test +++ b/mysql-test/suite/parts/t/partition_alter2_2_myisam.test @@ -22,6 +22,8 @@ # any of the variables. # +--source include/long_test.inc + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter4_innodb.test b/mysql-test/suite/parts/t/partition_alter4_innodb.test index 46883c390af..cf4bd610ff1 100644 --- a/mysql-test/suite/parts/t/partition_alter4_innodb.test +++ b/mysql-test/suite/parts/t/partition_alter4_innodb.test @@ -22,8 +22,6 @@ # any of the variables. # ---source include/big_test.inc - #------------------------------------------------------------------------------# # General not engine specific settings and requirements @@ -48,6 +46,9 @@ let $more_pk_ui_tests= 0; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_basic_innodb.test b/mysql-test/suite/parts/t/partition_basic_innodb.test index 2fa94cbde21..8240257f087 100644 --- a/mysql-test/suite/parts/t/partition_basic_innodb.test +++ b/mysql-test/suite/parts/t/partition_basic_innodb.test @@ -22,6 +22,8 @@ # any of the variables. # +--source include/long_test.inc + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test index 79ef3d537bf..3e3f23136ac 100644 --- a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test +++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test @@ -14,6 +14,7 @@ partition by range (a) insert into t1 values (1), (11), (21), (33); SELECT * FROM t1; SHOW CREATE TABLE t1; +--replace_result #p#p #P#p --list_files $MYSQLD_DATADIR/test SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open'; @@ -36,6 +37,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO disconnect con1; connection default; --reap +--replace_result #p#p #P#p --list_files $MYSQLD_DATADIR/test SHOW CREATE TABLE t1; SELECT * FROM t1; diff --git a/mysql-test/suite/parts/t/partition_decimal_innodb.test b/mysql-test/suite/parts/t/partition_decimal_innodb.test index 6d0aa156abe..5be42fb8fc3 100644 --- a/mysql-test/suite/parts/t/partition_decimal_innodb.test +++ b/mysql-test/suite/parts/t/partition_decimal_innodb.test @@ -28,6 +28,7 @@ ##### Options, for debugging support ##### let $debug= 0; +--source include/big_test.inc # The server must support partitioning. --source include/have_partition.inc diff --git a/mysql-test/suite/parts/t/partition_decimal_myisam.test b/mysql-test/suite/parts/t/partition_decimal_myisam.test index 49fc64cbd37..2715f2b9afb 100644 --- a/mysql-test/suite/parts/t/partition_decimal_myisam.test +++ b/mysql-test/suite/parts/t/partition_decimal_myisam.test @@ -28,6 +28,7 @@ ##### Options, for debugging support ##### let $debug= 0; +--source include/big_test.inc # The server must support partitioning. --source include/have_partition.inc diff --git a/mysql-test/suite/parts/t/partition_float_myisam.test b/mysql-test/suite/parts/t/partition_float_myisam.test index 51e0f1f5a21..f15e6ad3636 100644 --- a/mysql-test/suite/parts/t/partition_float_myisam.test +++ b/mysql-test/suite/parts/t/partition_float_myisam.test @@ -22,6 +22,8 @@ # any of the variables. # +--source include/long_test.inc + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_int_myisam.test b/mysql-test/suite/parts/t/partition_int_myisam.test index b0ede4995e8..5f29b575244 100644 --- a/mysql-test/suite/parts/t/partition_int_myisam.test +++ b/mysql-test/suite/parts/t/partition_int_myisam.test @@ -22,6 +22,8 @@ # any of the variables. # +--source include/long_test.inc + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_recover_myisam.test b/mysql-test/suite/parts/t/partition_recover_myisam.test index c96cd938f8b..b001306b580 100644 --- a/mysql-test/suite/parts/t/partition_recover_myisam.test +++ b/mysql-test/suite/parts/t/partition_recover_myisam.test @@ -3,6 +3,7 @@ --disable_query_log call mtr.add_suppression("..test.t1_will_crash"); call mtr.add_suppression("Got an error from unknown thread, ha_myisam.cc"); +call mtr.add_suppression("Table 't1_will_crash' is marked as crashed and should be repaired"); --enable_query_log --source include/have_partition.inc @@ -23,7 +24,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; --remove_file $MYSQLD_DATADIR/test/t1_will_crash.MYI --copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1_will_crash.MYI # Embedded server doesn't chdir to data directory ---replace_regex /Table '.*\/data\/test\/t1_will_crash/Table '.\/test\/t1_will_crash/ +--replace_regex /Table '.*t1_will_crash/Table 't1_will_crash/ --enable_prepare_warnings SELECT * FROM t1_will_crash; --disable_prepare_warnings @@ -40,7 +41,7 @@ FLUSH TABLES; --remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI --copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI # Embedded server doesn't chdir to data directory ---replace_regex /Table '.*\/data\/test\/t1_will_crash/Table '.\/test\/t1_will_crash/ +--replace_regex /Table '.*t1_will_crash/Table 't1_will_crash/ --enable_prepare_warnings SELECT * FROM t1_will_crash; --disable_prepare_warnings diff --git a/mysql-test/suite/parts/t/rpl_partition.test b/mysql-test/suite/parts/t/rpl_partition.test index 4b4915b89ec..409f428b34b 100644 --- a/mysql-test/suite/parts/t/rpl_partition.test +++ b/mysql-test/suite/parts/t/rpl_partition.test @@ -13,13 +13,6 @@ SET GLOBAL binlog_format = 'ROW'; SET SESSION binlog_format = 'ROW'; select @@global.binlog_format, @@session.binlog_format; ---disable_warnings -DROP TABLE IF EXISTS t1, t2, t3; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP PROCEDURE IF EXISTS p3; ---enable_warnings - eval CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT, dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, fkid MEDIUMINT, filler VARCHAR(255), @@ -141,7 +134,6 @@ SELECT count(*) as "Master bykey" FROM t2; CALL p3(); SELECT count(*) as "Master byrange" FROM t3; -#--source include/master-slave-end.inc --sync_slave_with_master connection slave; show create table t3; @@ -154,11 +146,9 @@ connection master; set @@global.binlog_format= @old_global_binlog_format; set @@session.binlog_format= @old_session_binlog_format; DROP TABLE t1, t2, t3; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP PROCEDURE IF EXISTS p3; -save_master_pos; -connection slave; -sync_with_master; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP PROCEDURE p3; # End of 5.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/pbxt/r/key_cache.result b/mysql-test/suite/pbxt/r/key_cache.result index 5ff41bd29d7..1ea3b2a714a 100644 --- a/mysql-test/suite/pbxt/r/key_cache.result +++ b/mysql-test/suite/pbxt/r/key_cache.result @@ -315,8 +315,7 @@ test.t1 check status OK DROP TABLE t1,t2; set global key_cache_block_size= @my_key_cache_block_size; set @@global.key_buffer_size=0; -Warnings: -Warning 1438 Cannot drop default keycache +ERROR HY000: Cannot drop default keycache select @@global.key_buffer_size; @@global.key_buffer_size 1048576 diff --git a/mysql-test/suite/pbxt/t/key_cache.test b/mysql-test/suite/pbxt/t/key_cache.test index 10dbdda6068..99d785db014 100644 --- a/mysql-test/suite/pbxt/t/key_cache.test +++ b/mysql-test/suite/pbxt/t/key_cache.test @@ -220,6 +220,7 @@ set global key_cache_block_size= @my_key_cache_block_size; # Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO # (One cannot drop the default key cache.) # +--error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE set @@global.key_buffer_size=0; select @@global.key_buffer_size; diff --git a/mysql-test/suite/percona/have_response_time_distribution.inc b/mysql-test/suite/percona/have_response_time_distribution.inc new file mode 100644 index 00000000000..aa4bf40ce67 --- /dev/null +++ b/mysql-test/suite/percona/have_response_time_distribution.inc @@ -0,0 +1,4 @@ +-- require r/have_response_time_distribution.require +disable_query_log; +show variables like 'have_response_time_distribution'; +enable_query_log; diff --git a/mysql-test/suite/percona/have_response_time_distribution.require b/mysql-test/suite/percona/have_response_time_distribution.require new file mode 100644 index 00000000000..fd7196830ff --- /dev/null +++ b/mysql-test/suite/percona/have_response_time_distribution.require @@ -0,0 +1,2 @@ +Variable_name Value +have_response_time_distribution YES diff --git a/mysql-test/suite/percona/log_connection_error.patch/percona_log_connection_error-master.opt b/mysql-test/suite/percona/log_connection_error.patch/percona_log_connection_error-master.opt new file mode 100644 index 00000000000..4658d62af60 --- /dev/null +++ b/mysql-test/suite/percona/log_connection_error.patch/percona_log_connection_error-master.opt @@ -0,0 +1 @@ +--log-error diff --git a/mysql-test/suite/percona/log_connection_error.patch/percona_log_connection_error.result b/mysql-test/suite/percona/log_connection_error.patch/percona_log_connection_error.result new file mode 100644 index 00000000000..3c6c67f770c --- /dev/null +++ b/mysql-test/suite/percona/log_connection_error.patch/percona_log_connection_error.result @@ -0,0 +1,15 @@ +SET @old_max_connections = @@max_connections; +SET @old_log_warnings = @@log_warnings; +SET GLOBAL max_connections=2; +SET GLOBAL LOG_WARNINGS = 0; +connect(localhost,root,,test,port,socket); +ERROR HY000: Too many connections +SET GLOBAL LOG_WARNINGS = 1; +connect(localhost,root,,test,port,socket); +ERROR HY000: Too many connections +SET GLOBAL LOG_WARNINGS = 0; +connect(localhost,root,,test,port,socket); +ERROR HY000: Too many connections +SET GLOBAL max_connections = @old_max_connections; +SET GLOBAL log_warnings = @old_log_warnings; +1 diff --git a/mysql-test/suite/percona/log_connection_error.patch/percona_log_connection_error.test b/mysql-test/suite/percona/log_connection_error.patch/percona_log_connection_error.test new file mode 100644 index 00000000000..57cd652bd24 --- /dev/null +++ b/mysql-test/suite/percona/log_connection_error.patch/percona_log_connection_error.test @@ -0,0 +1,52 @@ +--source include/not_embedded.inc + +connect (main,localhost,root,,); +connection main; +SET @old_max_connections = @@max_connections; +SET @old_log_warnings = @@log_warnings; +SET GLOBAL max_connections=2; +let $port=`SELECT Variable_value FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE Variable_name LIKE 'port'`; +let $socket=`SELECT Variable_value FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE Variable_name LIKE 'socket'`; + +SET GLOBAL LOG_WARNINGS = 0; +--connect (conn0,localhost,root,,) +connection conn0; +replace_result $port port $socket socket; +--error 1040 +--connect(conn1,localhost,root,,) +disconnect conn0; +SLEEP 0.1; # tsarev: hack, but i don't know (and didn't find) how right + +connection main; +SET GLOBAL LOG_WARNINGS = 1; +--connect (conn1,localhost,root,,) +replace_result $port port $socket socket; +--error 1040 +--connect (conn0,localhost,root,,) +disconnect conn1; +SLEEP 0.1; # tsarev: hack, but i don't know (and didn't find) how right + +connection main; +SET GLOBAL LOG_WARNINGS = 0; +--connect (conn0,localhost,root,,) +replace_result $port port $socket socket; +--error 1040 +--connect(conn1,localhost,root,,) +disconnect conn0; +SLEEP 0.1; # tsarev: hack, but i don't know (and didn't find) how right + +connection main; +SET GLOBAL max_connections = @old_max_connections; +SET GLOBAL log_warnings = @old_log_warnings; +let $log_error_= `SELECT @@GLOBAL.log_error`; +if(!`select LENGTH('$log_error_')`) +{ + # MySQL Server on windows is started with --console and thus + # does not know the location of its .err log, use default location + let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err; +} +# Assign env variable LOG_ERROR +let LOG_ERROR=$log_error_; + +let cmd=cat $log_error | grep "Too many connections" | wc -l; +exec $cmd; diff --git a/mysql-test/suite/percona/percona_innodb_buffer_pool_shm-master.opt b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm-master.opt new file mode 100644 index 00000000000..521fd9f459e --- /dev/null +++ b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm-master.opt @@ -0,0 +1,2 @@ +--innodb_buffer_pool_shm_key=123456 +--innodb=FORCE diff --git a/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.result b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.result new file mode 100644 index 00000000000..04ca5f4b877 --- /dev/null +++ b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.result @@ -0,0 +1,8 @@ +show variables like 'innodb_buffer_pool_shm%'; +Variable_name Value +innodb_buffer_pool_shm_checksum ON +innodb_buffer_pool_shm_key 123456 +show variables like 'innodb_buffer_pool_shm%'; +Variable_name Value +innodb_buffer_pool_shm_checksum ON +innodb_buffer_pool_shm_key 123456 diff --git a/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.test b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.test new file mode 100644 index 00000000000..a7f9c8eb72f --- /dev/null +++ b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.test @@ -0,0 +1,19 @@ +--source include/big_test.inc +--source include/have_innodb.inc +show variables like 'innodb_buffer_pool_shm%'; + +#clean shutdown (restart_mysqld.inc is not clean if over 10 sec...) +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait +EOF +shutdown_server 120; +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF +--enable_reconnect +--source include/wait_until_connected_again.inc +--disable_reconnect + +show variables like 'innodb_buffer_pool_shm%'; +--sleep 1 +--system ipcrm -M 123456 diff --git a/mysql-test/suite/percona/percona_log_connection_error-master.opt b/mysql-test/suite/percona/percona_log_connection_error-master.opt deleted file mode 100644 index 32a891789f3..00000000000 --- a/mysql-test/suite/percona/percona_log_connection_error-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-error
\ No newline at end of file diff --git a/mysql-test/suite/percona/percona_server_variables.result b/mysql-test/suite/percona/percona_server_variables.result index 6533829cfd9..9eeb1bd90e5 100644 --- a/mysql-test/suite/percona/percona_server_variables.result +++ b/mysql-test/suite/percona/percona_server_variables.result @@ -36,10 +36,12 @@ delayed_insert_limit Value delayed_insert_timeout Value delayed_queue_size Value div_precision_increment Value +enable_query_response_time_stats Value engine_condition_pushdown Value error_count Value event_scheduler Value expire_logs_days Value +fast_index_creation Value flush Value flush_time Value foreign_key_checks Value @@ -62,6 +64,7 @@ have_ndbcluster Value have_openssl Value have_partitioning Value have_query_cache Value +have_response_time_distribution Value have_rtree_keys Value have_ssl Value have_symlink Value @@ -78,6 +81,8 @@ innodb_additional_mem_pool_size Value innodb_auto_lru_dump Value innodb_autoextend_increment Value innodb_autoinc_lock_mode Value +innodb_buffer_pool_shm_checksum Value +innodb_buffer_pool_shm_key Value innodb_buffer_pool_size Value innodb_change_buffering Value innodb_checkpoint_age_target Value @@ -246,6 +251,7 @@ query_cache_strip_comments Value query_cache_type Value query_cache_wlock_invalidate Value query_prealloc_size Value +query_response_time_range_base Value rand_seed1 Value rand_seed2 Value range_alloc_block_size Value diff --git a/mysql-test/suite/percona/percona_server_variables.test b/mysql-test/suite/percona/percona_server_variables.test index 232cbb15e25..2e158ed2755 100644 --- a/mysql-test/suite/percona/percona_server_variables.test +++ b/mysql-test/suite/percona/percona_server_variables.test @@ -1,3 +1,4 @@ +--source include/have_response_time_distribution.inc --source include/have_innodb.inc --source include/have_debug.inc diff --git a/mysql-test/suite/percona/profiling_slow.patch/percona_bug643149.result b/mysql-test/suite/percona/profiling_slow.patch/percona_bug643149.result new file mode 100644 index 00000000000..c2a15c97e8c --- /dev/null +++ b/mysql-test/suite/percona/profiling_slow.patch/percona_bug643149.result @@ -0,0 +1,16 @@ +SET @old_slow_query_log_file=@@global.slow_query_log_file; +SET GLOBAL slow_query_log=on; +SET LOCAL profiling_server=on; +SET LOCAL long_query_time=1; +SET GLOBAL slow_query_log_file='MYSQLTEST_VARDIR/percona_bug643149_slow.log';; +SELECT SLEEP(2); +SLEEP(2) +0 +# Time: X X:X:X +# User@Host: root[root] @ localhost [] +# Thread_id: X Schema: test Last_errno: X Killed: X +# Query_time: X.X Lock_time: X.X Rows_sent: X Rows_examined: X Rows_affected: X Rows_read: X +# Bytes_sent: X Tmp_tables: X Tmp_disk_tables: X Tmp_table_sizes: X +# Profile_starting: X.X Profile_starting_cpu: X.X Profile_checking_permissions: X.X Profile_checking_permissions_cpu: X.X Profile_Opening_tables: X.X Profile_Opening_tables_cpu: X.X Profile_init: X.X Profile_init_cpu: X.X Profile_optimizing: X.X Profile_optimizing_cpu: X.X Profile_executing: X.X Profile_executing_cpu: X.X Profile_User_sleep: X.X Profile_User_sleep_cpu: X.X Profile_end: X.X Profile_end_cpu: X.X Profile_query_end: X.X Profile_query_end_cpu: X.X Profile_freeing_items: X.X Profile_freeing_items_cpu: X.X Profile_logging_slow_query: X.X Profile_logging_slow_query_cpu: X.X +# Profile_total: X.X Profile_total_cpu: X.X +SET GLOBAL slow_query_log_file=@old_slow_query_log_file; diff --git a/mysql-test/suite/percona/profiling_slow.patch/percona_bug643149.test b/mysql-test/suite/percona/profiling_slow.patch/percona_bug643149.test new file mode 100644 index 00000000000..b4a9ac7bc65 --- /dev/null +++ b/mysql-test/suite/percona/profiling_slow.patch/percona_bug643149.test @@ -0,0 +1,50 @@ +# +# This test suffers from server +# Bug#38124 "general_log_file" variable silently unset when using expression +# In short: +# SET GLOBAL general_log_file = @<whatever> +# SET GLOBAL slow_query_log = @<whatever> +# cause that the value of these server system variables is set to default +# instead of the assigned values. There comes no error message or warning. +# If this bug is fixed please +# 1. try this test with "let $fixed_bug38124 = 0;" +# 2. remove all workarounds if 1. was successful. +let $fixed_bug38124 = 0; + +SET @old_slow_query_log_file=@@global.slow_query_log_file; +SET GLOBAL slow_query_log=on; +SET LOCAL profiling_server=on; +SET LOCAL long_query_time=1; + +let slogfile=$MYSQLTEST_VARDIR/percona_bug643149_slow.log; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SET GLOBAL slow_query_log_file='$slogfile'; + +--disable_ps_protocol +SELECT SLEEP(2); +--enable_ps_protocol + +perl; + $slogfile= $ENV{'slogfile'}; + + open(FILE, "$slogfile") or + die("Unable to read slow query log file $slogfile: $!\n"); + while(<FILE>) { + next if (!/^#/); + s/[0-9]+/X/g; + s/ +/ /g; + print; + } + + close(FILE); +EOF + +SET GLOBAL slow_query_log_file=@old_slow_query_log_file; + +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} diff --git a/mysql-test/suite/percona/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test b/mysql-test/suite/percona/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test index 64a9fe7db71..3bbfe0edca9 100644 --- a/mysql-test/suite/percona/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test +++ b/mysql-test/suite/percona/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test @@ -34,4 +34,4 @@ SET SESSION debug="+d,status_wait_query_cache_mutex_sleep"; SHOW PROCESSLIST; DROP TABLE t; -set GLOBAL query_cache_size=0;
\ No newline at end of file +set GLOBAL query_cache_size=0; diff --git a/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-replication.result b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-replication.result new file mode 100644 index 00000000000..950cdbf7532 --- /dev/null +++ b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-replication.result @@ -0,0 +1,70 @@ +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 SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds"; +DROP TABLE IF EXISTS t; +CREATE TABLE t(id INT); +SELECT * from t; +id +SELECT * from t; +id +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1' +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 10 +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=ON; +INSERT INTO t SELECT SLEEP(0.4); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) +0 +INSERT INTO t SELECT SLEEP(0.4); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) +0 +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) +2 +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) +3 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +FLUSH QUERY_RESPONSE_TIME; +INSERT INTO t SELECT SLEEP(0.4); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) +0 +INSERT INTO t SELECT SLEEP(0.4); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) +0 +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) +2 +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) +3 +DROP TABLE IF EXISTS t; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=OFF; +SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds"; diff --git a/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-replication.test b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-replication.test new file mode 100644 index 00000000000..b215d3b45b2 --- /dev/null +++ b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-replication.test @@ -0,0 +1,57 @@ +--source include/have_response_time_distribution.inc +--source include/master-slave.inc +--source include/have_binlog_format_statement.inc +--source include/have_debug.inc +SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds"; + +connection master; +-- disable_warnings +DROP TABLE IF EXISTS t; +-- enable_warnings +CREATE TABLE t(id INT); +SELECT * from t; + +sync_slave_with_master; + +connection slave; +SELECT * from t; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +source include/percona_query_response_time_flush.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=ON; + +connection master; +INSERT INTO t SELECT SLEEP(0.4); +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +INSERT INTO t SELECT SLEEP(0.4); +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +sync_slave_with_master; + +connection slave; +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; + +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +source include/percona_query_response_time_flush.inc; + +connection master; +INSERT INTO t SELECT SLEEP(0.4); +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +INSERT INTO t SELECT SLEEP(0.4); +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +sync_slave_with_master; + +connection slave; +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; + +connection master; +DROP TABLE IF EXISTS t; +sync_slave_with_master; +connection slave; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=OFF; +SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds"; diff --git a/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-stored.result b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-stored.result new file mode 100644 index 00000000000..6ca471867ab --- /dev/null +++ b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-stored.result @@ -0,0 +1,313 @@ +SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds"; +CREATE FUNCTION test_f() +RETURNS CHAR(30) DETERMINISTIC +BEGIN +DECLARE first VARCHAR(5); +DECLARE second VARCHAR(5); +DECLARE result VARCHAR(20); +SELECT SLEEP(1.11) INTO first; +SET first= 'Hello'; +SET second=', '; +SET result= CONCAT(first,second); +SET result= CONCAT(result,'world!'); +RETURN result; +END/ +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1' +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +FLUSH QUERY_RESPONSE_TIME; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +44 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.000003 + 0.000007 + 0.000015 + 0.000030 + 0.000061 + 0.000122 + 0.000244 + 0.000488 + 0.000976 + 0.001953 + 0.003906 + 0.007812 + 0.015625 + 0.031250 + 0.062500 + 0.125000 + 0.250000 + 0.500000 + 1.000000 + 2.000000 + 4.000000 + 8.000000 + 16.000000 + 32.000000 + 64.000000 + 128.000000 + 256.000000 + 512.000000 + 1024.000000 + 2048.000000 + 4096.000000 + 8192.000000 + 16384.000000 + 32768.000000 + 65536.000000 + 131072.000000 + 262144.000000 + 524288.000000 + 1048576.00000 + 2097152.00000 + 4194304.00000 + 8388608.00000 +TOO LONG +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +test_f() +Hello, world! +SELECT test_f(); +test_f() +Hello, world! +SELECT test_f(); +test_f() +Hello, world! +SELECT test_f(); +test_f() +Hello, world! +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +4 4 4 1 44 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +44 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.000003 + 0.000007 + 0.000015 + 0.000030 + 0.000061 + 0.000122 + 0.000244 + 0.000488 + 0.000976 + 0.001953 + 0.003906 + 0.007812 + 0.015625 + 0.031250 + 0.062500 + 0.125000 + 0.250000 + 0.500000 + 1.000000 + 2.000000 + 4.000000 + 8.000000 + 16.000000 + 32.000000 + 64.000000 + 128.000000 + 256.000000 + 512.000000 + 1024.000000 + 2048.000000 + 4096.000000 + 8192.000000 + 16384.000000 + 32768.000000 + 65536.000000 + 131072.000000 + 262144.000000 + 524288.000000 + 1048576.00000 + 2097152.00000 + 4194304.00000 + 8388608.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 10 +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +test_f() +Hello, world! +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +1 1 1 1 14 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +14 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.000010 + 0.000100 + 0.001000 + 0.010000 + 0.100000 + 1.000000 + 10.000000 + 100.000000 + 1000.000000 + 10000.000000 + 100000.000000 + 1000000.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 10 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 7 +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +test_f() +Hello, world! +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +1 1 1 1 17 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +17 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.000008 + 0.000059 + 0.000416 + 0.002915 + 0.020408 + 0.142857 + 1.000000 + 7.000000 + 49.000000 + 343.000000 + 2401.000000 + 16807.000000 + 117649.000000 + 823543.000000 + 5764801.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 7 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 156 +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +test_f() +Hello, world! +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +1 1 1 1 7 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +7 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000041 + 0.006410 + 1.000000 + 156.000000 + 24336.000000 + 3796416.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 156 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +test_f() +Hello, world! +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +1 1 1 1 6 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +6 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.001000 + 1.000000 + 1000.000000 + 1000000.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1001' +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10; +DROP FUNCTION test_f; +SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds"; diff --git a/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-stored.test b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-stored.test new file mode 100644 index 00000000000..01651aae928 --- /dev/null +++ b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time-stored.test @@ -0,0 +1,90 @@ +--source include/have_response_time_distribution.inc +--source include/have_debug.inc +SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds"; + +delimiter /; +CREATE FUNCTION test_f() +RETURNS CHAR(30) DETERMINISTIC +BEGIN + DECLARE first VARCHAR(5); + DECLARE second VARCHAR(5); + DECLARE result VARCHAR(20); + SELECT SLEEP(1.11) INTO first; + SET first= 'Hello'; + SET second=', '; + SET result= CONCAT(first,second); + SET result= CONCAT(result,'world!'); + RETURN result; +END/ +delimiter ;/ + +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +source include/percona_query_response_time_show.inc; + +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +SELECT test_f(); +SELECT test_f(); +SELECT test_f(); +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT test_f(); +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10; + +DROP FUNCTION test_f; +SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds"; diff --git a/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time.result b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time.result new file mode 100644 index 00000000000..7599c9f0263 --- /dev/null +++ b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time.result @@ -0,0 +1,567 @@ +SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds"; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1' +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +FLUSH QUERY_RESPONSE_TIME; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +44 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.000003 + 0.000007 + 0.000015 + 0.000030 + 0.000061 + 0.000122 + 0.000244 + 0.000488 + 0.000976 + 0.001953 + 0.003906 + 0.007812 + 0.015625 + 0.031250 + 0.062500 + 0.125000 + 0.250000 + 0.500000 + 1.000000 + 2.000000 + 4.000000 + 8.000000 + 16.000000 + 32.000000 + 64.000000 + 128.000000 + 256.000000 + 512.000000 + 1024.000000 + 2048.000000 + 4096.000000 + 8192.000000 + 16384.000000 + 32768.000000 + 65536.000000 + 131072.000000 + 262144.000000 + 524288.000000 + 1048576.00000 + 2097152.00000 + 4194304.00000 + 8388608.00000 +TOO LONG +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT SLEEP(0.31); +SLEEP(0.31) +0 +SELECT SLEEP(0.32); +SLEEP(0.32) +0 +SELECT SLEEP(0.33); +SLEEP(0.33) +0 +SELECT SLEEP(0.34); +SLEEP(0.34) +0 +SELECT SLEEP(0.35); +SLEEP(0.35) +0 +SELECT SLEEP(0.36); +SLEEP(0.36) +0 +SELECT SLEEP(0.37); +SLEEP(0.37) +0 +SELECT SLEEP(0.38); +SLEEP(0.38) +0 +SELECT SLEEP(0.39); +SLEEP(0.39) +0 +SELECT SLEEP(0.40); +SLEEP(0.40) +0 +SELECT SLEEP(1.1); +SLEEP(1.1) +0 +SELECT SLEEP(1.2); +SLEEP(1.2) +0 +SELECT SLEEP(1.3); +SLEEP(1.3) +0 +SELECT SLEEP(1.5); +SLEEP(1.5) +0 +SELECT SLEEP(1.4); +SLEEP(1.4) +0 +SELECT SLEEP(0.5); +SLEEP(0.5) +0 +SELECT SLEEP(2.1); +SLEEP(2.1) +0 +SELECT SLEEP(2.3); +SLEEP(2.3) +0 +SELECT SLEEP(2.5); +SLEEP(2.5) +0 +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +10 19 15 4 44 +1 19 15 4 44 +5 19 15 4 44 +3 19 15 4 44 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +44 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.000003 + 0.000007 + 0.000015 + 0.000030 + 0.000061 + 0.000122 + 0.000244 + 0.000488 + 0.000976 + 0.001953 + 0.003906 + 0.007812 + 0.015625 + 0.031250 + 0.062500 + 0.125000 + 0.250000 + 0.500000 + 1.000000 + 2.000000 + 4.000000 + 8.000000 + 16.000000 + 32.000000 + 64.000000 + 128.000000 + 256.000000 + 512.000000 + 1024.000000 + 2048.000000 + 4096.000000 + 8192.000000 + 16384.000000 + 32768.000000 + 65536.000000 + 131072.000000 + 262144.000000 + 524288.000000 + 1048576.00000 + 2097152.00000 + 4194304.00000 + 8388608.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 10 +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT SLEEP(0.31); +SLEEP(0.31) +0 +SELECT SLEEP(0.32); +SLEEP(0.32) +0 +SELECT SLEEP(0.33); +SLEEP(0.33) +0 +SELECT SLEEP(0.34); +SLEEP(0.34) +0 +SELECT SLEEP(0.35); +SLEEP(0.35) +0 +SELECT SLEEP(0.36); +SLEEP(0.36) +0 +SELECT SLEEP(0.37); +SLEEP(0.37) +0 +SELECT SLEEP(0.38); +SLEEP(0.38) +0 +SELECT SLEEP(0.39); +SLEEP(0.39) +0 +SELECT SLEEP(0.40); +SLEEP(0.40) +0 +SELECT SLEEP(1.1); +SLEEP(1.1) +0 +SELECT SLEEP(1.2); +SLEEP(1.2) +0 +SELECT SLEEP(1.3); +SLEEP(1.3) +0 +SELECT SLEEP(1.5); +SLEEP(1.5) +0 +SELECT SLEEP(1.4); +SLEEP(1.4) +0 +SELECT SLEEP(0.5); +SLEEP(0.5) +0 +SELECT SLEEP(2.1); +SLEEP(2.1) +0 +SELECT SLEEP(2.3); +SLEEP(2.3) +0 +SELECT SLEEP(2.5); +SLEEP(2.5) +0 +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +11 19 17 2 14 +8 19 17 2 14 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +14 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.000010 + 0.000100 + 0.001000 + 0.010000 + 0.100000 + 1.000000 + 10.000000 + 100.000000 + 1000.000000 + 10000.000000 + 100000.000000 + 1000000.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 10 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 7 +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT SLEEP(0.31); +SLEEP(0.31) +0 +SELECT SLEEP(0.32); +SLEEP(0.32) +0 +SELECT SLEEP(0.33); +SLEEP(0.33) +0 +SELECT SLEEP(0.34); +SLEEP(0.34) +0 +SELECT SLEEP(0.35); +SLEEP(0.35) +0 +SELECT SLEEP(0.36); +SLEEP(0.36) +0 +SELECT SLEEP(0.37); +SLEEP(0.37) +0 +SELECT SLEEP(0.38); +SLEEP(0.38) +0 +SELECT SLEEP(0.39); +SLEEP(0.39) +0 +SELECT SLEEP(0.40); +SLEEP(0.40) +0 +SELECT SLEEP(1.1); +SLEEP(1.1) +0 +SELECT SLEEP(1.2); +SLEEP(1.2) +0 +SELECT SLEEP(1.3); +SLEEP(1.3) +0 +SELECT SLEEP(1.5); +SLEEP(1.5) +0 +SELECT SLEEP(1.4); +SLEEP(1.4) +0 +SELECT SLEEP(0.5); +SLEEP(0.5) +0 +SELECT SLEEP(2.1); +SLEEP(2.1) +0 +SELECT SLEEP(2.3); +SLEEP(2.3) +0 +SELECT SLEEP(2.5); +SLEEP(2.5) +0 +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +11 19 17 2 17 +8 19 17 2 17 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +17 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.000008 + 0.000059 + 0.000416 + 0.002915 + 0.020408 + 0.142857 + 1.000000 + 7.000000 + 49.000000 + 343.000000 + 2401.000000 + 16807.000000 + 117649.000000 + 823543.000000 + 5764801.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 7 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 156 +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT SLEEP(0.31); +SLEEP(0.31) +0 +SELECT SLEEP(0.32); +SLEEP(0.32) +0 +SELECT SLEEP(0.33); +SLEEP(0.33) +0 +SELECT SLEEP(0.34); +SLEEP(0.34) +0 +SELECT SLEEP(0.35); +SLEEP(0.35) +0 +SELECT SLEEP(0.36); +SLEEP(0.36) +0 +SELECT SLEEP(0.37); +SLEEP(0.37) +0 +SELECT SLEEP(0.38); +SLEEP(0.38) +0 +SELECT SLEEP(0.39); +SLEEP(0.39) +0 +SELECT SLEEP(0.40); +SLEEP(0.40) +0 +SELECT SLEEP(1.1); +SLEEP(1.1) +0 +SELECT SLEEP(1.2); +SLEEP(1.2) +0 +SELECT SLEEP(1.3); +SLEEP(1.3) +0 +SELECT SLEEP(1.5); +SLEEP(1.5) +0 +SELECT SLEEP(1.4); +SLEEP(1.4) +0 +SELECT SLEEP(0.5); +SLEEP(0.5) +0 +SELECT SLEEP(2.1); +SLEEP(2.1) +0 +SELECT SLEEP(2.3); +SLEEP(2.3) +0 +SELECT SLEEP(2.5); +SLEEP(2.5) +0 +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +11 19 17 2 7 +8 19 17 2 7 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +7 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000041 + 0.006410 + 1.000000 + 156.000000 + 24336.000000 + 3796416.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 156 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +SELECT SLEEP(0.31); +SLEEP(0.31) +0 +SELECT SLEEP(0.32); +SLEEP(0.32) +0 +SELECT SLEEP(0.33); +SLEEP(0.33) +0 +SELECT SLEEP(0.34); +SLEEP(0.34) +0 +SELECT SLEEP(0.35); +SLEEP(0.35) +0 +SELECT SLEEP(0.36); +SLEEP(0.36) +0 +SELECT SLEEP(0.37); +SLEEP(0.37) +0 +SELECT SLEEP(0.38); +SLEEP(0.38) +0 +SELECT SLEEP(0.39); +SLEEP(0.39) +0 +SELECT SLEEP(0.40); +SLEEP(0.40) +0 +SELECT SLEEP(1.1); +SLEEP(1.1) +0 +SELECT SLEEP(1.2); +SLEEP(1.2) +0 +SELECT SLEEP(1.3); +SLEEP(1.3) +0 +SELECT SLEEP(1.5); +SLEEP(1.5) +0 +SELECT SLEEP(1.4); +SLEEP(1.4) +0 +SELECT SLEEP(0.5); +SLEEP(0.5) +0 +SELECT SLEEP(2.1); +SLEEP(2.1) +0 +SELECT SLEEP(2.3); +SLEEP(2.3) +0 +SELECT SLEEP(2.5); +SLEEP(2.5) +0 +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +count query_count query_total not_zero_region_count region_count +11 19 17 2 6 +8 19 17 2 6 +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +region_count +6 +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time + 0.000001 + 0.001000 + 1.000000 + 1000.000000 + 1000000.00000 +TOO LONG +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1001' +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10; +SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds"; diff --git a/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time.test b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time.test new file mode 100644 index 00000000000..6dd0f54abf5 --- /dev/null +++ b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time.test @@ -0,0 +1,68 @@ +--source include/have_response_time_distribution.inc +--source include/have_debug.inc +SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds"; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +source include/percona_query_response_time_show.inc; + +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +source include/percona_query_response_time_sleep.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +source include/percona_query_response_time_sleep.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +source include/percona_query_response_time_sleep.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +source include/percona_query_response_time_sleep.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +source include/percona_query_response_time_flush.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1; +source include/percona_query_response_time_sleep.inc; +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; + +source include/percona_query_response_time_show.inc; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; + +SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10; +SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds"; diff --git a/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time_flush.inc b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time_flush.inc new file mode 100644 index 00000000000..44bb320fe13 --- /dev/null +++ b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time_flush.inc @@ -0,0 +1 @@ +FLUSH QUERY_RESPONSE_TIME; diff --git a/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time_show.inc b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time_show.inc new file mode 100644 index 00000000000..709abf9872e --- /dev/null +++ b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time_show.inc @@ -0,0 +1,8 @@ +SELECT d.count, +(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, +(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count, +(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count +FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0; +SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; diff --git a/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time_sleep.inc b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time_sleep.inc new file mode 100644 index 00000000000..40688b173b0 --- /dev/null +++ b/mysql-test/suite/percona/response-time-distribution.patch/percona_query_response_time_sleep.inc @@ -0,0 +1,19 @@ +SELECT SLEEP(0.31); +SELECT SLEEP(0.32); +SELECT SLEEP(0.33); +SELECT SLEEP(0.34); +SELECT SLEEP(0.35); +SELECT SLEEP(0.36); +SELECT SLEEP(0.37); +SELECT SLEEP(0.38); +SELECT SLEEP(0.39); +SELECT SLEEP(0.40); +SELECT SLEEP(1.1); +SELECT SLEEP(1.2); +SELECT SLEEP(1.3); +SELECT SLEEP(1.5); +SELECT SLEEP(1.4); +SELECT SLEEP(0.5); +SELECT SLEEP(2.1); +SELECT SLEEP(2.3); +SELECT SLEEP(2.5); diff --git a/mysql-test/suite/percona/show_slave_status_nolock.patch/percona_show_slave_status_nolock.result b/mysql-test/suite/percona/show_slave_status_nolock.patch/percona_show_slave_status_nolock.result new file mode 100644 index 00000000000..a028aeadde4 --- /dev/null +++ b/mysql-test/suite/percona/show_slave_status_nolock.patch/percona_show_slave_status_nolock.result @@ -0,0 +1,21 @@ +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; +DROP TABLE IF EXISTS t; +CREATE TABLE t(id INT); +INSERT INTO t SELECT SLEEP(10); +STOP SLAVE; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +master count(*) +master 1 +slave count(*) +slave 0 +SHOW SLAVE STATUS NOLOCK; +START SLAVE; +slave count(*) +slave 1 +DROP TABLE t; diff --git a/mysql-test/suite/percona/show_slave_status_nolock.patch/percona_show_slave_status_nolock.test b/mysql-test/suite/percona/show_slave_status_nolock.patch/percona_show_slave_status_nolock.test new file mode 100644 index 00000000000..9e856d24956 --- /dev/null +++ b/mysql-test/suite/percona/show_slave_status_nolock.patch/percona_show_slave_status_nolock.test @@ -0,0 +1,47 @@ +--source include/master-slave.inc +--source include/have_binlog_format_statement.inc + +connection master; + --disable_warnings + DROP TABLE IF EXISTS t; + --enable_warnings + CREATE TABLE t(id INT); + sync_slave_with_master; + +connection master; + send INSERT INTO t SELECT SLEEP(10); + +connection slave; + sleep 15; + send STOP SLAVE; + +connection master; + reap; + + --disable_query_log + select "master",count(*) from t; + --enable_query_log + +connection slave1; + --disable_query_log + select "slave",count(*) from t; + --enable_query_log + + --disable_result_log + SHOW SLAVE STATUS NOLOCK; + --enable_result_log + +connection slave; + reap; + + --source include/wait_for_slave_to_stop.inc + START SLAVE; + --source include/wait_for_slave_to_start.inc + + --disable_query_log + select "slave",count(*) from t; + --enable_query_log + +connection master; + DROP TABLE t; +sync_slave_with_master; diff --git a/mysql-test/suite/percona/slow_extended.patch/grep.inc b/mysql-test/suite/percona/slow_extended.patch/grep.inc new file mode 100644 index 00000000000..c9c823fa695 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/grep.inc @@ -0,0 +1,16 @@ +perl; + + $file = $ENV{'grep_file'}; + $pattern = $ENV{'grep_pattern'}; + + open(FILE, "$file") + or die("Cannot open file $file: $!\n"); + + $lines = 0; + while(<FILE>) { + $lines++ if (/$pattern/); + } + print "$lines\n"; + + close(FILE); +EOF diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined-master.opt new file mode 100644 index 00000000000..b6f54503c34 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined-master.opt @@ -0,0 +1 @@ +--use_global_long_query_time --log_slow_verbosity="full" diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined.result new file mode 100644 index 00000000000..d51e0722fa2 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined.result @@ -0,0 +1,18 @@ +show variables like 'use_global_long_query_time'; +Variable_name Value +use_global_long_query_time ON +show variables like 'use_global_log_slow_control'; +Variable_name Value +use_global_log_slow_control long_query_time +show variables like 'log_slow_verbosity'; +Variable_name Value +log_slow_verbosity microtime,query_plan,innodb +show global variables like 'use_global_long_query_time'; +Variable_name Value +use_global_long_query_time ON +show global variables like 'log_slow_verbosity'; +Variable_name Value +log_slow_verbosity microtime,query_plan,innodb +show global variables like 'use_global_log_slow_control'; +Variable_name Value +use_global_log_slow_control long_query_time diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined.test new file mode 100644 index 00000000000..9a4d57a3efc --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined.test @@ -0,0 +1,6 @@ +show variables like 'use_global_long_query_time'; +show variables like 'use_global_log_slow_control'; +show variables like 'log_slow_verbosity'; +show global variables like 'use_global_long_query_time'; +show global variables like 'log_slow_verbosity'; +show global variables like 'use_global_log_slow_control'; diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined2-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined2-master.opt new file mode 100644 index 00000000000..267fe17fabe --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined2-master.opt @@ -0,0 +1 @@ +--use_global_log_slow_control="long_query_time" diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined2.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined2.result new file mode 100644 index 00000000000..e66a7dc1968 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined2.result @@ -0,0 +1,12 @@ +show variables like 'use_global_long_query_time'; +Variable_name Value +use_global_long_query_time ON +show variables like 'use_global_log_slow_control'; +Variable_name Value +use_global_log_slow_control long_query_time +show global variables like 'use_global_long_query_time'; +Variable_name Value +use_global_long_query_time ON +show global variables like 'use_global_log_slow_control'; +Variable_name Value +use_global_log_slow_control long_query_time diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined2.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined2.test new file mode 100644 index 00000000000..2c79c137844 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-combined2.test @@ -0,0 +1,4 @@ +show variables like 'use_global_long_query_time'; +show variables like 'use_global_log_slow_control'; +show global variables like 'use_global_long_query_time'; +show global variables like 'use_global_log_slow_control'; diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow-master.opt index 91dd41305cd..bd62c08c475 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow-master.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow-master.opt @@ -1 +1 @@ ---slow-query-log-file=percona_slow_query_log-control_global_slow.log --long-query-time=1
\ No newline at end of file +--slow-query-log-file=percona_slow_query_log-control_global_slow.log --long-query-time=1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow.result index 15463408878..f91d1af2fb3 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow.result @@ -8,5 +8,5 @@ sleep(2) 0 set global use_global_log_slow_control=none; set global log_slow_verbosity=microtime; -cat var/mysqld.1/data/percona_slow_query_log-control_global_slow.log | grep "No InnoDB statistics available for this query" | wc -l +FLUSH LOGS; 1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow.test index bfe49d09563..bbf90f8ec9b 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-control_global_slow.test @@ -5,6 +5,8 @@ set global use_global_log_slow_control="log_slow_verbosity,long_query_time"; SELECT sleep(2); set global use_global_log_slow_control=none; set global log_slow_verbosity=microtime; -let $cmd = cat var/mysqld.1/data/percona_slow_query_log-control_global_slow.log | grep "No InnoDB statistics available for this query" | wc -l; -echo $cmd; -exec $cmd; + +FLUSH LOGS; +--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-control_global_slow.log +--let grep_pattern = No InnoDB statistics available for this query +--source include/grep.inc diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter-master.opt index cb93f7abf05..660c51a0b7c 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter-master.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter-master.opt @@ -1 +1 @@ ---slow-query-log-file=percona_slow_query_log-log_slow_filter.log --long-query-time=1
\ No newline at end of file +--slow-query-log-file=percona_slow_query_log-log_slow_filter.log --long-query-time=1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter.result index 07c90fa05a3..19643db3819 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter.result @@ -21,5 +21,5 @@ SELECT sleep(2); sleep(2) 0 drop table if exists t; -cat var/mysqld.1/data/percona_slow_query_log-log_slow_filter.log | grep Query_time | wc -l +FLUSH LOGS; 2 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter.test index bd903e88050..c9efa2d8a48 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_filter.test @@ -26,6 +26,7 @@ SELECT sleep(2); drop table if exists t; --enable_warnings -let $cmd = cat var/mysqld.1/data/percona_slow_query_log-log_slow_filter.log | grep Query_time | wc -l; -echo $cmd; -exec $cmd; +FLUSH LOGS; +--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-log_slow_filter.log +--let grep_pattern = Query_time +--source include/grep.inc diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_sp_statements-cl-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_sp_statements-cl-master.opt new file mode 100644 index 00000000000..4368453928a --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_sp_statements-cl-master.opt @@ -0,0 +1 @@ +--log_slow_sp_statements diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_sp_statements-cl.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_sp_statements-cl.result new file mode 100644 index 00000000000..c5653429327 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_sp_statements-cl.result @@ -0,0 +1,3 @@ +show global variables like 'log_slow_sp_statements'; +Variable_name Value +log_slow_sp_statements ON diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_sp_statements-cl.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_sp_statements-cl.test new file mode 100644 index 00000000000..47bd960feb5 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_sp_statements-cl.test @@ -0,0 +1 @@ +show global variables like 'log_slow_sp_statements'; diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_timestamp_every-cl-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_timestamp_every-cl-master.opt new file mode 100644 index 00000000000..8595eaf73d2 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_timestamp_every-cl-master.opt @@ -0,0 +1 @@ +--log_slow_timestamp_every diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_timestamp_every-cl.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_timestamp_every-cl.result new file mode 100644 index 00000000000..119bc26a743 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_timestamp_every-cl.result @@ -0,0 +1,3 @@ +show global variables like 'log_slow_timestamp_every'; +Variable_name Value +log_slow_timestamp_every ON diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_timestamp_every-cl.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_timestamp_every-cl.test new file mode 100644 index 00000000000..f1d058b9ba4 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_timestamp_every-cl.test @@ -0,0 +1 @@ +show global variables like 'log_slow_timestamp_every'; diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-cl-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-cl-master.opt new file mode 100644 index 00000000000..d8809c36981 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-cl-master.opt @@ -0,0 +1 @@ +--log_slow_verbosity="full" diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-cl.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-cl.result new file mode 100644 index 00000000000..eb8228efb08 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-cl.result @@ -0,0 +1,9 @@ +show global variables like 'log_slow_verbosity'; +Variable_name Value +log_slow_verbosity microtime,query_plan,innodb +show variables like 'log_slow_verbosity'; +Variable_name Value +log_slow_verbosity microtime,query_plan,innodb +select @@log_slow_verbosity; +@@log_slow_verbosity +microtime,query_plan,innodb diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-cl.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-cl.test new file mode 100644 index 00000000000..740c4deaebd --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-cl.test @@ -0,0 +1,3 @@ +show global variables like 'log_slow_verbosity'; +show variables like 'log_slow_verbosity'; +select @@log_slow_verbosity; diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-master.opt index 8d21f40a34f..19ae9c117f0 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-master.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity-master.opt @@ -1 +1 @@ ---slow-query-log-file=percona_slow_query_log-log_slow_verbosity.log --long-query-time=1
\ No newline at end of file +--slow-query-log-file=percona_slow_query_log-log_slow_verbosity.log --long-query-time=1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity.result index 75f842f22a0..1e7db10c8bd 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity.result @@ -5,5 +5,5 @@ set log_slow_verbosity=innodb; SELECT sleep(2); sleep(2) 0 -cat var/mysqld.1/data/percona_slow_query_log-log_slow_verbosity.log | grep "No InnoDB statistics available for this query" | wc -l +FLUSH LOGS; 1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity.test index 56d14e33513..4fb854d6de6 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-log_slow_verbosity.test @@ -6,6 +6,7 @@ set log_slow_verbosity=innodb; SELECT sleep(2); -let $cmd = cat var/mysqld.1/data/percona_slow_query_log-log_slow_verbosity.log | grep "No InnoDB statistics available for this query" | wc -l; -echo $cmd; -exec $cmd; +FLUSH LOGS; +--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-log_slow_verbosity.log +--let grep_pattern = No InnoDB statistics available for this query +--source include/grep.inc diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time-master.opt index 473323e0bd9..8064e04b846 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time-master.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time-master.opt @@ -1 +1 @@ ---slow-query-log-file=percona_slow_query_log-long_query_time.log --long-query-time=2
\ No newline at end of file +--slow-query-log-file=percona_slow_query_log-long_query_time.log --long-query-time=2 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time.result index ed934610211..0b72a23dd1b 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time.result @@ -18,5 +18,5 @@ SELECT sleep(5); sleep(5) 0 set long_query_time=2; -cat var/mysqld.1/data/percona_slow_query_log-long_query_time.log | grep Query_time | wc -l +FLUSH LOGS; 3 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time.test index 9954ef4ee40..1d4babd6402 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-long_query_time.test @@ -12,6 +12,8 @@ SELECT sleep(5); set long_query_time=2; -let $cmd = cat var/mysqld.1/data/percona_slow_query_log-long_query_time.log | grep Query_time | wc -l; -echo $cmd; -exec $cmd; +FLUSH LOGS; +--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-long_query_time.log +--let grep_pattern = Query_time +--source include/grep.inc + diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended-master.opt index 6433539d3d1..37a30b1384f 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended-master.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended-master.opt @@ -1 +1 @@ ---slow-query-log-file=percona_slow_query_log-microseconds_in_slow_query_log.log --long-query-time=1
\ No newline at end of file +--slow-query-log-file=percona_slow_query_log-microseconds_in_slow_query_log.log --long-query-time=1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended.result index 3cdab58aad0..7eb925618b7 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended.result @@ -6,7 +6,6 @@ SELECT sleep(2); sleep(2) 0 set global slow_query_log_microseconds_timestamp=OFF; -cat var/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+.[0-9]+' | wc -l +FLUSH LOGS; 1 -cat var/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+' | wc -l 2 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended.test index 18eb6830405..80fa6834150 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-microseconds_in_slow_extended.test @@ -8,10 +8,12 @@ SELECT sleep(2); set global slow_query_log_microseconds_timestamp=OFF; -let $cmd = cat var/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+.[0-9]+' | wc -l; -echo $cmd; -exec $cmd; +FLUSH LOGS; +--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log +--let grep_pattern = # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+.[0-9]+ +--source include/grep.inc + +--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log +--let grep_pattern = # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+ +--source include/grep.inc -let $cmd = cat var/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+' | wc -l; -echo $cmd; -exec $cmd; diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit-master.opt index 6f82556fb0c..d3f4e7eeb03 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit-master.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit-master.opt @@ -1 +1 @@ ---slow-query-log-file=percona_slow_query_log-min_examined_row_limit.log --long-query-time=1
\ No newline at end of file +--slow-query-log-file=percona_slow_query_log-min_examined_row_limit.log --long-query-time=1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit.result index bf5a2131826..5c299bd3e5c 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit.result @@ -21,5 +21,5 @@ SELECT sleep(2); sleep(2) 0 drop table if exists t; -cat var/mysqld.1/data/percona_slow_query_log-min_examined_row_limit.log | grep Query_time | wc -l +FLUSH LOGS; 2 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit.test index 83edb1c366f..861a8f17cce 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-min_examined_row_limit.test @@ -26,6 +26,7 @@ SELECT sleep(2); drop table if exists t; --enable_warnings -let $cmd = cat var/mysqld.1/data/percona_slow_query_log-min_examined_row_limit.log | grep Query_time | wc -l; -echo $cmd; -exec $cmd; +FLUSH LOGS; +--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-min_examined_row_limit.log +--let grep_pattern = Query_time +--source include/grep.inc diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.result index c2406bdfd85..162c92afbd9 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.result @@ -18,4 +18,5 @@ STOP SLAVE; START SLAVE; INSERT INTO t SELECT t.id,t.data from t; DROP TABLE IF EXISTS t; +FLUSH LOGS; 4 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.test index 247a7028772..27e34ec71ad 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.test @@ -41,4 +41,8 @@ connection master; DROP TABLE IF EXISTS t; sync_slave_with_master; -exec cat var/mysqld.2/mysqld-slow.log | grep InnoDB_IO_r_ops | wc -l; +connection slave; +FLUSH LOGS; +--let grep_file = $MYSQLTEST_VARDIR/mysqld.2/mysqld-slow.log +--let grep_pattern = InnoDB_IO_r_ops +--source include/grep.inc diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time-master.opt index d600400af08..49038530c56 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time-master.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time-master.opt @@ -1 +1 @@ ---slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=1
\ No newline at end of file +--slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time-slave.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time-slave.opt index c79e637317b..648f309f744 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time-slave.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time-slave.opt @@ -1 +1 @@ ---slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=1
\ No newline at end of file +--slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time.result index 8aed50caba2..386faf225ec 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time.result @@ -75,12 +75,14 @@ Variable_name Value use_global_long_query_time ON set global long_query_time=1; set global use_global_long_query_time=0; +FLUSH LOGS; # Analyse master slow_query_log 0 0 0 0 0 +FLUSH LOGS; # Analyse slave slow_query_log 0 0 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time.test index 6b7d2750e68..b5a6154bbfc 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-and-use_global_long_query_time.test @@ -75,26 +75,32 @@ show global variables like 'use_global_long_query_time'; set global long_query_time=1; set global use_global_long_query_time=0; +connection master; +FLUSH LOGS; + -- echo # Analyse master slow_query_log let $i=5; let $k=1; -let $cmd=cat ./var/mysqld.1/data/percona_log_slow_slave_statements-master.log | grep; while($i) { - let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l; - exec $current_cmd; + --let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_log_slow_slave_statements-master.log + --let grep_pattern = INSERT INTO t VALUES \($k\) + --source include/grep.inc dec $i; inc $k; } +connection slave; +FLUSH LOGS; + -- echo # Analyse slave slow_query_log let $i=5; let $k=1; -let $cmd=cat ./var/mysqld.2/data/percona_log_slow_slave_statements-slave.log | grep; while($i) { - let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l; - exec $current_cmd; + --let grep_file = $MYSQLTEST_VARDIR/mysqld.2/data/percona_log_slow_slave_statements-slave.log + --let grep_pattern = INSERT INTO t VALUES \($k\) + --source include/grep.inc dec $i; inc $k; } diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-master.opt index dd94fd90a57..ebf25ddd37d 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-master.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-master.opt @@ -1 +1 @@ ---slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=0
\ No newline at end of file +--slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=0 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-slave.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-slave.opt index e276b0bcfc8..96cd9004493 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-slave.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements-slave.opt @@ -1 +1 @@ ---slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=0
\ No newline at end of file +--slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=0 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements.result index e3bf3e92c94..9f9085ff444 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements.result @@ -64,6 +64,7 @@ START SLAVE; INSERT INTO t VALUES (7); # Read information about master binlog # Sync slave(7) thread +FLUSH LOGS; # Analyse master slow_query_log 1 1 @@ -72,6 +73,7 @@ INSERT INTO t VALUES (7); 1 1 1 +FLUSH LOGS; # Analyse slave slow_query_log 0 0 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements.test index bb6e1c5f28a..bce7a5f0530 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_statements.test @@ -122,26 +122,32 @@ let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1); connection slave; let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`; +connection master; +FLUSH LOGS; + -- echo # Analyse master slow_query_log let $i=7; let $k=1; -let $cmd=cat ./var/mysqld.1/data/percona_log_slow_slave_statements-master.log | grep; while($i) { - let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l; - exec $current_cmd; + --let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_log_slow_slave_statements-master.log + --let grep_pattern = INSERT INTO t VALUES \($k\) + --source include/grep.inc dec $i; inc $k; } +connection slave; +FLUSH LOGS; + -- echo # Analyse slave slow_query_log let $i=7; let $k=1; -let $cmd=cat ./var/mysqld.2/data/percona_log_slow_slave_statements-slave.log | grep; while($i) { - let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l; - exec $current_cmd; + --let grep_file = $MYSQLTEST_VARDIR/mysqld.2/data/percona_log_slow_slave_statements-slave.log + --let grep_pattern = INSERT INTO t VALUES \($k\) + --source include/grep.inc dec $i; inc $k; } diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slow_query_log_microseconds_timestamp-cl-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slow_query_log_microseconds_timestamp-cl-master.opt new file mode 100644 index 00000000000..597ad08f268 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slow_query_log_microseconds_timestamp-cl-master.opt @@ -0,0 +1 @@ +--slow_query_log_microseconds_timestamp diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.result new file mode 100644 index 00000000000..4f3357f95bb --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.result @@ -0,0 +1,3 @@ +show global variables like 'slow_query_log_microseconds_timestamp'; +Variable_name Value +slow_query_log_microseconds_timestamp ON diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.test new file mode 100644 index 00000000000..d568f4eb816 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.test @@ -0,0 +1 @@ +show global variables like 'slow_query_log_microseconds_timestamp'; diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-cl-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-cl-master.opt new file mode 100644 index 00000000000..cf93591c365 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-cl-master.opt @@ -0,0 +1 @@ +--use_global_long_query_time diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-cl.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-cl.result new file mode 100644 index 00000000000..d554a64bdb4 --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-cl.result @@ -0,0 +1,3 @@ +show global variables like 'use_global_long_query_time'; +Variable_name Value +use_global_long_query_time ON diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-cl.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-cl.test new file mode 100644 index 00000000000..662aee24ebe --- /dev/null +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-cl.test @@ -0,0 +1 @@ +show global variables like 'use_global_long_query_time'; diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-master.opt b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-master.opt index f2dbf2253f4..5e6a2405b02 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-master.opt +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time-master.opt @@ -1 +1 @@ ---slow-query-log-file=percona_slow_query_log-use_global_long_query_time.log --long-query-time=2 --use_global_log_slow_control=long_query_time --use_global_long_query_time=1
\ No newline at end of file +--slow-query-log-file=percona_slow_query_log-use_global_long_query_time.log --long-query-time=2 --use_global_log_slow_control=long_query_time --use_global_long_query_time=1 diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time.result b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time.result index e04762db9d1..c0333e4b59b 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time.result +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time.result @@ -20,7 +20,7 @@ sleep(5) 0 set global long_query_time=2; set global use_global_long_query_time=0; -cat var/mysqld.1/data/percona_slow_query_log-use_global_long_query_time.log | grep Query_time | wc -l +FLUSH LOGS; 3 show global variables like 'use_global_log_slow_control'; Variable_name Value diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time.test index 3582b13a3e9..a3d74036bfe 100644 --- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time.test +++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-use_global_long_query_time.test @@ -14,9 +14,10 @@ SELECT sleep(5); set global long_query_time=2; set global use_global_long_query_time=0; -let $cmd = cat var/mysqld.1/data/percona_slow_query_log-use_global_long_query_time.log | grep Query_time | wc -l; -echo $cmd; -exec $cmd; +FLUSH LOGS; +--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-use_global_long_query_time.log +--let grep_pattern = Query_time +--source include/grep.inc show global variables like 'use_global_log_slow_control'; show global variables like 'use_global_long_query_time'; diff --git a/mysql-test/suite/percona/slow_extended.patch/show_slave_status_nolock.patch/percona_show_slave_status_nolock.result b/mysql-test/suite/percona/slow_extended.patch/show_slave_status_nolock.patch/percona_show_slave_status_nolock.result deleted file mode 100644 index aa1717f9a18..00000000000 --- a/mysql-test/suite/percona/slow_extended.patch/show_slave_status_nolock.patch/percona_show_slave_status_nolock.result +++ /dev/null @@ -1,23 +0,0 @@ -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; -DROP TABLE IF EXISTS t; -CREATE TABLE t(id INT); -INSERT INTO t SELECT SLEEP(5); -STOP SLAVE; -select count(*) from t; -count(*) -0 -SHOW SLAVE STATUS NOLOCK; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error - host user port 1 master-bin.000001 276 slave-relay-bin.000003 422 master-bin.000001 No No 0 0 276 577 None 0 No NULL No 0 0 -select count(*) from t; -count(*) -0 -START SLAVE; -Warnings: -Note 1592 Statement may not be safe to log in statement format. -DROP TABLE t; diff --git a/mysql-test/suite/percona/slow_extended.patch/show_slave_status_nolock.patch/percona_show_slave_status_nolock.test b/mysql-test/suite/percona/slow_extended.patch/show_slave_status_nolock.patch/percona_show_slave_status_nolock.test deleted file mode 100644 index 03531db3b12..00000000000 --- a/mysql-test/suite/percona/slow_extended.patch/show_slave_status_nolock.patch/percona_show_slave_status_nolock.test +++ /dev/null @@ -1,28 +0,0 @@ ---source include/master-slave.inc - -connection master; --- disable_warnings -DROP TABLE IF EXISTS t; --- enable_warnings -CREATE TABLE t(id INT); -sync_slave_with_master; -connection master; -send INSERT INTO t SELECT SLEEP(5); -sleep 1; -connection slave; -send STOP SLAVE; -connection slave1; -select count(*) from t; -replace_column 2 host 3 user 4 port; -SHOW SLAVE STATUS NOLOCK; -select count(*) from t; - -connection slave; -reap; ---source include/wait_for_slave_to_stop.inc -START SLAVE; ---source include/wait_for_slave_to_start.inc -connection master; -reap; -DROP TABLE t; -sync_slave_with_master; diff --git a/mysql-test/suite/percona/sql_no_fcache.patch/percona_sql_no_fcache.result b/mysql-test/suite/percona/sql_no_fcache.patch/percona_sql_no_fcache.result new file mode 100644 index 00000000000..bc1413fb96d --- /dev/null +++ b/mysql-test/suite/percona/sql_no_fcache.patch/percona_sql_no_fcache.result @@ -0,0 +1,12 @@ +drop table if exists t1; +create table t (a int not null); +insert into t values (1),(2),(3); +SELECT SQL_NO_FCACHE SLEEP(0); +SLEEP(0) +0 +SELECT /*!40001 SQL_NO_CACHE */ /*!50084 SQL_NO_FCACHE */ * FROM t; +a +1 +2 +3 +DROP TABLE t; diff --git a/mysql-test/suite/percona/sql_no_fcache.patch/percona_sql_no_fcache.test b/mysql-test/suite/percona/sql_no_fcache.patch/percona_sql_no_fcache.test new file mode 100644 index 00000000000..1ed8be2196b --- /dev/null +++ b/mysql-test/suite/percona/sql_no_fcache.patch/percona_sql_no_fcache.test @@ -0,0 +1,11 @@ +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t (a int not null); +insert into t values (1),(2),(3); + +SELECT SQL_NO_FCACHE SLEEP(0); +SELECT /*!40001 SQL_NO_CACHE */ /*!50084 SQL_NO_FCACHE */ * FROM t; + +DROP TABLE t; diff --git a/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc b/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc index 79825016448..89db1c3545d 100644 --- a/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc +++ b/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc @@ -1,6 +1,4 @@ ######################################### -# Author: Serge Kozlov skozlov@mysql.com -# Date: 07/10/2006 # Purpose: testing the replication in mixed mode # Requirements: define binlog format for mysqld as in example below: # ./mysql-test-run.pl --mysqld=--binlog-format=mixed @@ -82,3 +80,4 @@ sync_slave_with_master; # the files your self to see what is not matching --diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc index d953397c0cb..dc245b8d38c 100644 --- a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc +++ b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc @@ -1,6 +1,4 @@ ######################################### -# Author: Serge Kozlov skozlov@mysql.com -# Date: 07/10/2006 # Purpose: testing the replication in mixed mode # Requirements: define binlog format for mysqld as in example below: # ./mysql-test-run.pl --mysqld=--binlog-format=mixed @@ -342,3 +340,4 @@ sync_slave_with_master; # the files your self to see what is not matching --diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl000011.result b/mysql-test/suite/rpl/r/rpl000011.result deleted file mode 100644 index dd0fa2fbe74..00000000000 --- a/mysql-test/suite/rpl/r/rpl000011.result +++ /dev/null @@ -1,16 +0,0 @@ -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; -create table t1 (n int); -insert into t1 values(1); -stop slave; -start slave; -insert into t1 values(2); -select * from t1; -n -1 -2 -drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl000010.result b/mysql-test/suite/rpl/r/rpl_000010.result index 65191ea411f..4bb87a765cd 100644 --- a/mysql-test/suite/rpl/r/rpl000010.result +++ b/mysql-test/suite/rpl/r/rpl_000010.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (n int not null auto_increment primary key); insert into t1 values(NULL); insert into t1 values(2); @@ -12,3 +8,4 @@ n 1 2 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_000011.result b/mysql-test/suite/rpl/r/rpl_000011.result new file mode 100644 index 00000000000..9160d1952c2 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_000011.result @@ -0,0 +1,13 @@ +include/master-slave.inc +[connection master] +create table t1 (n int); +insert into t1 values(1); +stop slave; +start slave; +insert into t1 values(2); +select * from t1; +n +1 +2 +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl000013.result b/mysql-test/suite/rpl/r/rpl_000013.result index 37838bb88e0..e94a469e970 100644 --- a/mysql-test/suite/rpl/r/rpl000013.result +++ b/mysql-test/suite/rpl/r/rpl_000013.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); @@ -26,3 +22,4 @@ Slave_open_temp_tables 0 drop table if exists t1,t2; Warnings: Note 1051 Unknown table 't1' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl000017.result b/mysql-test/suite/rpl/r/rpl_000017.result index 1c611357e64..1b4f9f1e8a3 100644 --- a/mysql-test/suite/rpl/r/rpl000017.result +++ b/mysql-test/suite/rpl/r/rpl_000017.result @@ -1,14 +1,8 @@ -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; -stop slave; +include/master-slave.inc +[connection master] grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; -start slave; -drop table if exists t1; +include/start_slave.inc create table t1(n int); insert into t1 values(24); select * from t1; @@ -16,3 +10,4 @@ n 24 drop table t1; delete from mysql.user where user="replicate"; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_EE_err.result b/mysql-test/suite/rpl/r/rpl_EE_err.result index 16fa931e303..3795deedee3 100644 --- a/mysql-test/suite/rpl/r/rpl_EE_err.result +++ b/mysql-test/suite/rpl/r/rpl_EE_err.result @@ -1,11 +1,8 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int) engine=myisam; flush tables; drop table if exists t1; Warnings: Error 2 Can't find file: 't1' (errno: 2) +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result index b092dd9e088..3280d4bbaf7 100644 --- a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result +++ b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a)); LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; @@ -115,3 +111,4 @@ abasement abased abase DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_alter.result b/mysql-test/suite/rpl/r/rpl_alter.result index cedb6854239..d60f1b68082 100644 --- a/mysql-test/suite/rpl/r/rpl_alter.result +++ b/mysql-test/suite/rpl/r/rpl_alter.result @@ -1,10 +1,5 @@ -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; -drop database if exists mysqltest; +include/master-slave.inc +[connection master] create database mysqltest; create table mysqltest.t1 ( n int); alter table mysqltest.t1 add m int; @@ -35,7 +30,8 @@ ALTER TABLE t1 CHANGE b c INT; ALTER TABLE t2 CHANGE b c VARCHAR(255); INSERT INTO t1 (a) VALUES(2); -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_alter_db.result b/mysql-test/suite/rpl/r/rpl_alter_db.result index 60c07d0dede..55adbfeda79 100644 --- a/mysql-test/suite/rpl/r/rpl_alter_db.result +++ b/mysql-test/suite/rpl/r/rpl_alter_db.result @@ -1,12 +1,9 @@ -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; +include/master-slave.inc +[connection master] ==== Verify that alter database does not stop replication ==== create database temp_db; use temp_db; alter database collate latin1_bin; ==== Clean up ==== drop database temp_db; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result index 9fcd9bbd54c..ba73487cf16 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3; insert into t1 values (NULL,1),(NULL,2),(NULL,3); select * from t1; @@ -244,12 +240,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 drop table t1; -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; +include/rpl_reset.inc DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb; @@ -303,12 +294,12 @@ id INSERT INTO t1 VALUES(4); INSERT INTO t2 VALUES(4); FLUSH LOGS; -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1; DROP TABLE t2; -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1; DROP TABLE t2; SET SQL_MODE=''; @@ -341,3 +332,21 @@ DROP TABLE slave_only; DROP TABLE t1; DROP TABLE t_ignored1; DROP TABLE t_ignored2; +CREATE TABLE t1 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, data INT) ENGINE=innodb; +BEGIN; +# Set sql_mode with NO_AUTO_VALUE_ON_ZERO for allowing +# zero to fill the auto_increment field. +SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; +INSERT INTO t1(id,data) VALUES(0,2); +# Resetting sql_mode without NO_AUTO_VALUE_ON_ZERO to +# affect the execution of the transaction on slave. +SET SQL_MODE=0; +COMMIT; +SELECT * FROM t1; +id data +0 2 +SELECT * FROM t1; +id data +0 2 +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result b/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result index 25eda6ee454..62ff28e7159 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists test1; create database test1; use test1; @@ -44,4 +40,4 @@ id fname 1 testtest 1 2 test drop database test1; -drop database test1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result new file mode 100644 index 00000000000..71c6ff57f80 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result @@ -0,0 +1,45 @@ +include/master-slave.inc +[connection master] +==== Initialize ==== +SET @old_relay_log_purge= @@global.relay_log_purge; +include/setup_fake_relay_log.inc +Setting up fake replication from MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 +==== Test ==== +start slave sql_thread; +include/wait_for_slave_param.inc [Exec_Master_Log_Pos] +# Result on slave +SELECT * FROM t1; +id +5 +6 +7 +8 +9 +10 +11 +SELECT * FROM t2; +id +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +==== Clean up ==== +stop slave sql_thread; +include/cleanup_fake_relay_log.inc +DROP TABLE t1, t2; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP FUNCTION f1; +SET @@global.relay_log_purge= @old_relay_log_purge; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result b/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result index b2cc92491c3..af84978dc80 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] # Test case1: INVOKES A TRIGGER with after insert action create table t1(a int, b int) engine=innodb; create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb; @@ -110,9 +106,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with after insert action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -226,9 +222,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with before insert action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -342,9 +338,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with after update action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -458,9 +454,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with before update action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -574,9 +570,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with after delete action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -690,9 +686,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with before delete action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -761,8 +757,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'CALLS A FUNCTION which INVOKES A TRIGGER with after insert action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t3, slave:t3] drop table t1; drop table t2; drop table t3; @@ -828,8 +824,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'CALLS A FUNCTION which INVOKES A TRIGGER with before insert action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t3, slave:t3] drop table t1; drop table t2; drop table t3; @@ -853,7 +849,7 @@ INSERT INTO v16(c1) VALUES (25), (26); commit; #Test if the results are consistent on master and slave #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS' -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t3, slave:t3] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -877,7 +873,7 @@ INSERT INTO v16(c1) VALUES (25), (26); commit; #Test if the results are consistent on master and slave #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS' -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t3, slave:t3] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -980,8 +976,8 @@ master-bin.000001 # Query # # use `test`; insert into t2(a,b) values(3,3) master-bin.000001 # Xid # # COMMIT /* XID */ #Test if the results are consistent on master and slave #for 'UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT' -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] drop table t1; drop table t2; # Test case14: INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES @@ -1034,8 +1030,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO v15(c2) VALUES (25), (26) master-bin.000001 # Xid # # COMMIT /* XID */ #Test if the results are consistent on master and slave #for 'INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES' -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] drop table t1; drop table t2; drop view v15; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result index f826136e81e..1fdbb5a7786 100644 --- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result +++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS db1; DROP DATABASE IF EXISTS db2; CREATE DATABASE db1; @@ -49,6 +45,7 @@ before call db1.p1() after call db1.p1() [on slave] start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_POS; +include/wait_for_slave_sql_to_stop.inc # # If we got non-zero here, then we're suffering BUG#43263 # @@ -87,6 +84,7 @@ executed db1.p2() after call db1.p2() [on slave] start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_POS; +include/wait_for_slave_sql_to_stop.inc # # If we got non-zero here, then we're suffering BUG#43263 # @@ -105,6 +103,7 @@ s before call db1.p1() executed db1.p2() START SLAVE; +include/wait_for_slave_sql_to_start.inc # # SAVEPOINT and ROLLBACK TO have the same problem in BUG#43263 # This was reported by BUG#50407 @@ -167,3 +166,4 @@ a # DROP DATABASE db1; DROP DATABASE db2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result index f94d2833603..4f1eca42e1a 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result @@ -1,8 +1,15 @@ +include/master-slave.inc +[connection master] call mtr.add_suppression('Found invalid event in binary log'); ==== Initialize ==== +include/stop_slave.inc +RESET SLAVE; +include/setup_fake_relay_log.inc Setting up fake replication from MYSQL_TEST_DIR/std_data/bug40482-bin.000001 ==== Test ==== START SLAVE SQL_THREAD; +include/wait_for_slave_sql_error.inc [errno=1594] Last_SQL_Error = Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. ==== Clean up ==== -Cleaning up after setup_fake_relay_log.inc +include/cleanup_fake_relay_log.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result new file mode 100644 index 00000000000..be1b3b150bc --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result @@ -0,0 +1,278 @@ +include/master-slave.inc +[connection master] +####################################################################### +####################### PART 1: MASTER TESTS ########################## +####################################################################### +include/stop_slave.inc +call mtr.add_suppression("Can't generate a unique log-filename"); +call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); +call mtr.add_suppression("Error writing file .*"); +SET @old_debug= @@global.debug; +SELECT repeat('x',8192) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data'; +SELECT repeat('x',10) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data'; +RESET MASTER; +###################### TEST #1 +FLUSH LOGS; +# assert: must show two binlogs +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +###################### TEST #2 +RESET MASTER; +SET GLOBAL debug="+d,error_unique_log_filename"; +FLUSH LOGS; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show one binlog +show binary logs; +Log_name File_size +master-bin.000001 # +SET GLOBAL debug=""; +RESET MASTER; +###################### TEST #3 +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB; +CREATE TABLE t4 (a VARCHAR(16384)); +INSERT INTO t1 VALUES (1); +RESET MASTER; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +# assert: must show two binlog +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; +###################### TEST #4 +SET GLOBAL debug="+d,error_unique_log_filename"; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show one entry +SELECT count(*) FROM t2; +count(*) +1 +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; +###################### TEST #5 +SET GLOBAL debug="+d,error_unique_log_filename"; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2; +# assert: must show one entry +SELECT count(*) FROM t2; +count(*) +1 +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; +###################### TEST #6 +SET GLOBAL debug="+d,error_unique_log_filename"; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES ('muse'); +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +INSERT INTO t2 VALUES ('muse'); +COMMIT; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show three entries +SELECT count(*) FROM t2; +count(*) +3 +SET AUTOCOMMIT= 1; +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; +###################### TEST #7 +SET GLOBAL debug="+d,error_unique_log_filename"; +SELECT count(*) FROM t4; +count(*) +0 +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show 1 entry +SELECT count(*) FROM t4; +count(*) +1 +### check that the incident event is written to the current log +SET GLOBAL debug="-d,error_unique_log_filename"; +FLUSH LOGS; +SHOW BINLOG EVENTS IN 'BINLOG_FILE' FROM <binlog_start> LIMIT 1; +Log_name Pos Event_type Server_id End_log_pos Info +BINLOG_FILE # Incident # # #1 (LOST_EVENTS) +DELETE FROM t4; +RESET MASTER; +###################### TEST #8 +SET GLOBAL debug="+d,error_unique_log_filename"; +# must show 0 entries +SELECT count(*) FROM t4; +count(*) +0 +SELECT count(*) FROM t2; +count(*) +0 +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# INFO: Count(*) Before Offending DELETEs +# assert: must show 1 entry +SELECT count(*) FROM t4; +count(*) +1 +# assert: must show 4 entries +SELECT count(*) FROM t2; +count(*) +4 +DELETE FROM t4; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +DELETE FROM t2; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# INFO: Count(*) After Offending DELETEs +# assert: must show zero entries +SELECT count(*) FROM t4; +count(*) +0 +SELECT count(*) FROM t2; +count(*) +0 +SET GLOBAL debug="-d,error_unique_log_filename"; +###################### TEST #9 +SET GLOBAL debug="+d,error_unique_log_filename"; +SET SQL_LOG_BIN=0; +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); +INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); +# assert: must show four entries +SELECT count(*) FROM t2; +count(*) +4 +SELECT count(*) FROM t4; +count(*) +4 +DELETE FROM t2; +DELETE FROM t4; +# assert: must show zero entries +SELECT count(*) FROM t2; +count(*) +0 +SELECT count(*) FROM t4; +count(*) +0 +SET SQL_LOG_BIN=1; +SET GLOBAL debug="-d,error_unique_log_filename"; +###################### TEST #10 +call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Could not open .*"); +RESET MASTER; +SHOW WARNINGS; +Level Code Message +SET GLOBAL debug="+d,fault_injection_registering_index"; +FLUSH LOGS; +ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1) +SET GLOBAL debug="-d,fault_injection_registering_index"; +SHOW BINARY LOGS; +ERROR HY000: You are not using binary logging +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +###################### TEST #11 +include/rpl_restart_server.inc [server_number=1] +SET GLOBAL debug="+d,fault_injection_openning_index"; +FLUSH LOGS; +ERROR HY000: Can't open file: 'master-bin.index' (errno: 1) +SET GLOBAL debug="-d,fault_injection_openning_index"; +RESET MASTER; +ERROR HY000: Binlog closed, cannot RESET MASTER +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +include/rpl_restart_server.inc [server_number=1] +###################### TEST #12 +SET GLOBAL debug="+d,fault_injection_new_file_rotate_event"; +FLUSH LOGS; +ERROR HY000: Can't open file: 'master-bin' (errno: 2) +SET GLOBAL debug="-d,fault_injection_new_file_rotate_event"; +RESET MASTER; +ERROR HY000: Binlog closed, cannot RESET MASTER +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +include/rpl_restart_server.inc [server_number=1] +SET GLOBAL debug= @old_debug; +DROP TABLE t1, t2, t4; +RESET MASTER; +include/start_slave.inc +####################################################################### +####################### PART 2: SLAVE TESTS ########################### +####################################################################### +include/rpl_reset.inc +call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); +call mtr.add_suppression("Error writing file .*"); +call mtr.add_suppression("Could not open .*"); +call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Can't generate a unique log-filename .*"); +###################### TEST #13 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug="+d,error_unique_log_filename"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug="-d,error_unique_log_filename"; +SET GLOBAL debug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +###################### TEST #14 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug="+d,fault_injection_new_file_rotate_event"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug="-d,fault_injection_new_file_rotate_event"; +SET GLOBAL debug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +###################### TEST #15 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug="+d,fault_injection_registering_index"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug="-d,fault_injection_registering_index"; +SET GLOBAL debug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +###################### TEST #16 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug="+d,fault_injection_openning_index"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug="-d,fault_injection_openning_index"; +SET GLOBAL debug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +include/stop_slave_sql.inc +Warnings: +Note 1255 Slave already has been stopped +SET GLOBAL debug=@old_debug; +RESET SLAVE; +RESET MASTER; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_grant.result b/mysql-test/suite/rpl/r/rpl_binlog_grant.result index 7a2e3183d5b..93138fa5b43 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_grant.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_grant.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists d1; create database d1; use d1; @@ -30,3 +26,4 @@ Grants for x@y GRANT USAGE ON *.* TO 'x'@'y' drop user x@y; drop database d1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result index f9e492db6bc..a7e8b86ac79 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET GLOBAL max_binlog_cache_size = 4096; SET GLOBAL binlog_cache_size = 4096; CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; @@ -17,14 +13,11 @@ Got one of the listed errors *** Single statement on non-transactional table *** *** After WL#2687 the difference between STATEMENT/MIXED and ROW will not exist. *** Got one of the listed errors ---source include/wait_for_slave_sql_error_and_skip.inc -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] *** Single statement on both transactional and non-transactional tables. *** *** After WL#2687 we will be able to change the order of the tables. *** Got one of the listed errors ---source include/wait_for_slave_sql_error_and_skip.inc -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] TRUNCATE TABLE t1; TRUNCATE TABLE t2; TRUNCATE TABLE t3; @@ -39,7 +32,7 @@ Got one of the listed errors BEGIN; Got one of the listed errors Got one of the listed errors -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 3 - BEGIN - COMMIT ######################################################################################## @@ -51,7 +44,7 @@ Got one of the listed errors Got one of the listed errors Got one of the listed errors COMMIT; -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 4 - BEGIN - ROLLBACK ######################################################################################## @@ -65,7 +58,7 @@ Got one of the listed errors ROLLBACK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 5 - PROCEDURE ######################################################################################## @@ -89,7 +82,7 @@ TRUNCATE TABLE t1; BEGIN; Got one of the listed errors ROLLBACK; -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 6 - XID ######################################################################################## @@ -104,7 +97,7 @@ ROLLBACK TO sv; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back COMMIT; -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 7 - NON-TRANS TABLE ######################################################################################## @@ -121,9 +114,7 @@ COMMIT; BEGIN; Got one of the listed errors COMMIT; ---source include/wait_for_slave_sql_error_and_skip.inc -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] ######################################################################## # 8 - Bug#55375(Regression Bug) Transaction bigger than # max_binlog_cache_size crashes slave @@ -140,6 +131,7 @@ SET GLOBAL binlog_cache_size= ORIGINAL_VALUE; BEGIN; Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times COMMIT; +include/wait_for_slave_sql_error.inc [errno=1197] SELECT count(*) FROM t1; count(*) 0 @@ -159,6 +151,6 @@ DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; DROP TABLE IF EXISTS t4; -DROP TABLE IF EXISTS t5; -DROP TABLE IF EXISTS t6; +DROP TABLE t5; DROP PROCEDURE p1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bit.result b/mysql-test/suite/rpl/r/rpl_bit.result index 924de8a65f8..fa935cd9e56 100644 --- a/mysql-test/suite/rpl/r/rpl_bit.result +++ b/mysql-test/suite/rpl/r/rpl_bit.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 ( dummyKey INTEGER NOT NULL, @@ -136,3 +132,4 @@ hex(bit3) 24 35 DROP TABLE IF EXISTS test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bit_npk.result b/mysql-test/suite/rpl/r/rpl_bit_npk.result index 9599660f18f..13c9985614e 100644 --- a/mysql-test/suite/rpl/r/rpl_bit_npk.result +++ b/mysql-test/suite/rpl/r/rpl_bit_npk.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 ( dummyKey INTEGER NOT NULL, @@ -167,3 +163,4 @@ a b DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_blackhole.result b/mysql-test/suite/rpl/r/rpl_blackhole.result index b48a782b570..566fb828fc7 100644 --- a/mysql-test/suite/rpl/r/rpl_blackhole.result +++ b/mysql-test/suite/rpl/r/rpl_blackhole.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT, b INT, c INT); CREATE TABLE t2 (a INT, b INT, c INT); ALTER TABLE t1 ENGINE=BLACKHOLE; @@ -98,4 +94,5 @@ SELECT COUNT(*) FROM t1; COUNT(*) 0 >>> Something was written to binary log <<< -drop table t1,t2; +DROP TABLE t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug26395.result b/mysql-test/suite/rpl/r/rpl_bug26395.result index c6dd2d01ed3..a3725f34a55 100644 --- a/mysql-test/suite/rpl/r/rpl_bug26395.result +++ b/mysql-test/suite/rpl/r/rpl_bug26395.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialize ==== [on master] CREATE TABLE tinnodb (a INT) ENGINE = INNODB; @@ -20,6 +16,7 @@ SELECT * FROM tinnodb ORDER BY a; a 1 [on slave] +include/sync_slave_io_with_master.inc ==== Verify results on slave ==== include/stop_slave.inc SELECT "" AS Slave_IO_State; @@ -39,3 +36,4 @@ DROP TABLE tinnodb; set @@debug= @old_debug; [on slave] DROP TABLE tinnodb; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug31076.result b/mysql-test/suite/rpl/r/rpl_bug31076.result index fd66ca85d57..09330b35fbd 100644 --- a/mysql-test/suite/rpl/r/rpl_bug31076.result +++ b/mysql-test/suite/rpl/r/rpl_bug31076.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE DATABASE track; USE track; CREATE TABLE `visits` ( @@ -67,3 +63,4 @@ event_id visit_id timestamp src data visits_events_id 20000 21231038 2007-09-18 03:59:02 Downloads/MySQL-4.1/mysql-4.1.12a-win32.zip 33712207 DROP DATABASE track; End of 5.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result index 292922a1afd..d27308db1d5 100644 --- a/mysql-test/suite/rpl/r/rpl_bug33931.result +++ b/mysql-test/suite/rpl/r/rpl_bug33931.result @@ -1,8 +1,12 @@ -reset master; +include/master-slave.inc +[connection master] call mtr.add_suppression("Failed during slave I/O thread initialization"); -stop slave; +include/stop_slave.inc reset slave; SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; -Last_SQL_Error = Failed during slave thread initialization +include/wait_for_slave_sql_error.inc [errno=1593] +Last_SQL_Error = 'Failed during slave thread initialization' SET GLOBAL debug=""; +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug38694.result b/mysql-test/suite/rpl/r/rpl_bug38694.result index 711c4a91c03..84180af0870 100644 --- a/mysql-test/suite/rpl/r/rpl_bug38694.result +++ b/mysql-test/suite/rpl/r/rpl_bug38694.result @@ -1,6 +1,4 @@ -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; +include/master-slave.inc +[connection master] +call mtr.add_suppression("Aborted connection"); +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result index 883feb42b3f..6674ab168ef 100644 --- a/mysql-test/suite/rpl/r/rpl_change_master.result +++ b/mysql-test/suite/rpl/r/rpl_change_master.result @@ -1,15 +1,12 @@ -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; +include/master-slave.inc +[connection master] create table t1(n int); select * from t1; n stop slave sql_thread; insert into t1 values(1); insert into t1 values(2); +include/wait_for_slave_param.inc [Read_Master_Log_Pos] include/stop_slave.inc change master to master_user='root'; start slave; @@ -18,3 +15,4 @@ n 1 2 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_charset.result b/mysql-test/suite/rpl/r/rpl_charset.result index ae5cf3b0fd1..fff11542f6b 100644 --- a/mysql-test/suite/rpl/r/rpl_charset.result +++ b/mysql-test/suite/rpl/r/rpl_charset.result @@ -1,12 +1,6 @@ -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; +include/master-slave.inc +[connection master] set timestamp=1000000000; -drop database if exists mysqltest2; -drop database if exists mysqltest3; create database mysqltest2 character set latin2; set @@character_set_server=latin5; create database mysqltest3; @@ -142,3 +136,4 @@ primary key (`pk`) set @p=_latin1 'test'; update t1 set pk='test' where pk=@p; drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_charset_sjis.result b/mysql-test/suite/rpl/r/rpl_charset_sjis.result index 770ad0588d1..b31bad28a59 100644 --- a/mysql-test/suite/rpl/r/rpl_charset_sjis.result +++ b/mysql-test/suite/rpl/r/rpl_charset_sjis.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1; drop procedure if exists p1; create table t1 (a varchar(255) character set sjis); @@ -24,3 +20,4 @@ hex(a) 965C drop table t1; drop procedure p1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result index c3ccc76d1bc..fb1d3f8258e 100644 --- a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result +++ b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result @@ -1,60 +1,10 @@ -*** Set up circular ring by schema A->B->C->D->A *** -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; -STOP SLAVE; -RESET SLAVE; -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -SET auto_increment_increment = 4; -SET auto_increment_offset = 1; -RESET MASTER; -RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_A_PORT,master_user='root',MASTER_LOG_FILE='MASTER_A_LOG_FILE'; -SET auto_increment_increment = 4; -SET auto_increment_offset = 2; -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',MASTER_LOG_FILE='MASTER_B_LOG_FILE'; -SET auto_increment_increment = 4; -SET auto_increment_offset = 3; -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',MASTER_LOG_FILE='MASTER_C_LOG_FILE'; -SET auto_increment_increment = 4; -SET auto_increment_offset = 4; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_D_PORT,master_user='root',MASTER_LOG_FILE='MASTER_D_LOG_FILE'; -SHOW VARIABLES LIKE 'auto_increment_%'; -Variable_name Value -auto_increment_increment 4 -auto_increment_offset 1 -SHOW VARIABLES LIKE 'auto_increment_%'; -Variable_name Value -auto_increment_increment 4 -auto_increment_offset 2 -SHOW VARIABLES LIKE 'auto_increment_%'; -Variable_name Value -auto_increment_increment 4 -auto_increment_offset 3 -SHOW VARIABLES LIKE 'auto_increment_%'; -Variable_name Value -auto_increment_increment 4 -auto_increment_offset 4 -1 -START SLAVE; -START SLAVE; -START SLAVE; -START SLAVE; +*** Set up circular replication on four servers *** +include/rpl_init.inc [topology=1->2->3->4->1] *** Preparing data *** CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM; CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB; +include/rpl_sync.inc *** Testing schema A->B->C->D->A *** @@ -62,6 +12,7 @@ INSERT INTO t1(b,c) VALUES('A',1); INSERT INTO t1(b,c) VALUES('B',1); INSERT INTO t1(b,c) VALUES('C',1); INSERT INTO t1(b,c) VALUES('D',1); +include/rpl_sync.inc SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b; Master A a b Master A 1 A @@ -95,6 +46,7 @@ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; include/start_slave.inc INSERT INTO t1 VALUES(6,'C',2); INSERT INTO t1(b,c) VALUES('B',2); +include/wait_for_slave_sql_error.inc [errno=1062] INSERT INTO t1(b,c) VALUES('A',2); INSERT INTO t1(b,c) VALUES('D',2); @@ -116,9 +68,9 @@ Master D a b Master D 8 D * Reconfigure replication to schema A->B->D->A * -STOP SLAVE; -STOP SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS; +include/stop_slave_io.inc +include/stop_slave.inc +include/rpl_change_topology.inc [new topology=1->2->4->1,2->3] include/start_slave.inc * Check data inserted before failure * @@ -145,6 +97,7 @@ Master D 8 D INSERT INTO t1(b,c) VALUES('A',3); INSERT INTO t1(b,c) VALUES('B',3); INSERT INTO t1(b,c) VALUES('D',3); +include/rpl_sync.inc SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b; Master A a b Master A 9 A @@ -171,8 +124,9 @@ DELETE FROM t1 WHERE a = 6; START SLAVE; RESET MASTER; RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS; +include/rpl_change_topology.inc [new topology=1->2->3->4->1] START SLAVE; +include/rpl_sync.inc * Check data inserted before restoring schema A->B->C->D->A * SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; @@ -213,6 +167,7 @@ INSERT INTO t1(b,c) VALUES('A',4); INSERT INTO t1(b,c) VALUES('B',4); INSERT INTO t1(b,c) VALUES('C',4); INSERT INTO t1(b,c) VALUES('D',4); +include/rpl_sync.inc SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b; Master A a b Master A 13 A @@ -241,6 +196,7 @@ Master D 16 D * Transactions with commits * BEGIN; BEGIN; +include/rpl_sync.inc SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; Master A b COUNT(*) Master A A 100 @@ -269,6 +225,7 @@ Master D D 100 * Transactions with rollbacks * BEGIN; BEGIN; +include/rpl_sync.inc SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; Master A b COUNT(*) Master A B 100 @@ -288,11 +245,4 @@ Master D D 100 *** Clean up *** DROP TABLE t1,t2; -STOP SLAVE; -RESET SLAVE; -STOP SLAVE; -RESET SLAVE; -STOP SLAVE; -RESET SLAVE; -STOP SLAVE; -RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_colSize.result b/mysql-test/suite/rpl/r/rpl_colSize.result index 91456742833..8147ab2db37 100644 --- a/mysql-test/suite/rpl/r/rpl_colSize.result +++ b/mysql-test/suite/rpl/r/rpl_colSize.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; **** Testing WL#3228 changes. **** *** Create "wider" table on slave *** @@ -177,3 +173,4 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 *** Cleanup *** DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_commit_after_flush.result b/mysql-test/suite/rpl/r/rpl_commit_after_flush.result index eaddda63b6a..b91b273e64e 100644 --- a/mysql-test/suite/rpl/r/rpl_commit_after_flush.result +++ b/mysql-test/suite/rpl/r/rpl_commit_after_flush.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT) ENGINE=innodb; begin; insert into t1 values(1); @@ -11,3 +7,4 @@ flush tables with read lock; commit; unlock tables; drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_concurrency_error.result b/mysql-test/suite/rpl/r/rpl_concurrency_error.result index 83e5f66a9c4..c6bd8dc6062 100644 --- a/mysql-test/suite/rpl/r/rpl_concurrency_error.result +++ b/mysql-test/suite/rpl/r/rpl_concurrency_error.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ######################################################################## # Environment ######################################################################## @@ -101,11 +97,12 @@ master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 1' WHERE f master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (6 + (1 * 10),"brown") master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown") master-bin.000001 # Xid # # COMMIT /* XID */ -source include/diff_master_slave.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc +include/rpl_diff.inc ######################################################################## # Cleanup ######################################################################## DROP TRIGGER tr; DROP TABLE t; DROP TABLE n; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_conditional_comments.result b/mysql-test/suite/rpl/r/rpl_conditional_comments.result index 105d3bc59f3..f520ac04bb4 100644 --- a/mysql-test/suite/rpl/r/rpl_conditional_comments.result +++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1(c1 INT); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info @@ -17,7 +13,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; /* 99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /* 99999 ,(11)*/ -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Case 2: # ----------------------------------------------------------------- @@ -28,7 +24,7 @@ EXECUTE stmt; DROP TABLE t1; CREATE TABLE t1(c1 INT); EXECUTE stmt; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] SET @value=62; PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/'; @@ -46,7 +42,7 @@ master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALU master-bin.000001 # Query # # use `test`; DROP TABLE t1 master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/ -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Case 3: # ----------------------------------------------------------------- @@ -55,3 +51,4 @@ Comparing tables master:test.t1 and slave:test.t1 SELECT c1 FROM /*!99999 t1 WHEREN; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!99999 t1 WHEREN' at line 1 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_create_database.result b/mysql-test/suite/rpl/r/rpl_create_database.result index 9780b65f334..6bb950483ed 100644 --- a/mysql-test/suite/rpl/r/rpl_create_database.result +++ b/mysql-test/suite/rpl/r/rpl_create_database.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS mysqltest_prometheus; DROP DATABASE IF EXISTS mysqltest_sisyfos; DROP DATABASE IF EXISTS mysqltest_bob; @@ -60,3 +56,4 @@ t2 DROP DATABASE IF EXISTS mysqltest_prometheus; DROP DATABASE IF EXISTS mysqltest_sisyfos; DROP DATABASE IF EXISTS mysqltest_bob; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result index e3cddf4c606..dbb48f734b8 100644 --- a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result +++ b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS mysqltest; CREATE DATABASE IF NOT EXISTS mysqltest; USE mysqltest; @@ -74,3 +70,4 @@ CREATE TABLE IF NOT EXISTS t1 AS SELECT SLEEP(3); KILL QUERY master1; DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result index de44a1e5d2a..b31a6d399e2 100644 --- a/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result +++ b/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS mysqltest; CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int); CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int); @@ -25,3 +21,4 @@ master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS ` ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`tmp2` (`c1`) SELECT * FROM tmp master-bin.000001 # Query # # COMMIT +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_cross_version.result b/mysql-test/suite/rpl/r/rpl_cross_version.result index de5dd134516..ddb97ffa8c5 100644 --- a/mysql-test/suite/rpl/r/rpl_cross_version.result +++ b/mysql-test/suite/rpl/r/rpl_cross_version.result @@ -1,12 +1,19 @@ +include/master-slave.inc +[connection master] ==== Initialize ==== +include/stop_slave.inc +RESET SLAVE; +include/setup_fake_relay_log.inc Setting up fake replication from MYSQL_TEST_DIR/suite/binlog/std_data/binlog_old_version_4_1.000001 ==== Test ==== start slave sql_thread; +include/wait_for_slave_param.inc [Exec_Master_Log_Pos] ==== a prove that the fake has been processed successfully ==== SELECT COUNT(*) - 17920 as zero FROM t3; zero 0 ==== Clean up ==== -stop slave sql_thread; -Cleaning up after setup_fake_relay_log.inc +include/stop_slave_sql.inc +include/cleanup_fake_relay_log.inc drop table t1, t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result index 85490c2571c..7d8fc4e492e 100644 --- a/mysql-test/suite/rpl/r/rpl_current_user.result +++ b/mysql-test/suite/rpl/r/rpl_current_user.result @@ -1,25 +1,6 @@ -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; - -# On slave2 -# Connect slave2 to slave -CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;, -MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; -START SLAVE; - -# [On master] -DROP VIEW IF EXISTS v_user; -DROP VIEW IF EXISTS v_tables_priv; -DROP VIEW IF EXISTS v_procs_priv; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS my_grant; -DROP PROCEDURE IF EXISTS my_revoke; -DROP FUNCTION IF EXISTS my_user; -DROP EVENT IF EXISTS e1; +include/rpl_init.inc [topology=1->2->3] +include/rpl_connect.inc [creating master] +include/rpl_connect.inc [creating slave] CREATE TABLE t1(c1 char(100)); CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; @@ -41,76 +22,76 @@ ERROR HY000: String '01234567890123456789012345678901234567890123456789012345678 # [On conn1] # Verify 'REVOKE ALL' statement REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] # Verify 'GRANT ... ON TABLE ...' statement GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv] # Verify 'GRANT ... ON PROCEDURE...' statement GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); -Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv -Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv] # Verify 'GRANT ... ON *.* ...' statement GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; -Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv -Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv] # Verify 'REVOKE ... ON TABLE ...' statement REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv] # Verify 'REVOKE ... ON PROCEDURE...' statement REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); -Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv -Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv] # Verify 'REVOKE ... ON *.* ...' statement REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] # Verify 'GRANT ...' statement in the procedure CREATE PROCEDURE my_grant() GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); call my_grant; -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv] # Verify 'REVOKE ... ON TABLE ...' statement in the procedure CREATE PROCEDURE my_revoke() REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); call my_revoke; -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv] # Verify 'RENAME USER ...' statement RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] # Verify 'DROP USER ...' statement GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; DROP USER CURRENT_USER(); -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] # Verify 'ALTER EVENT...' statement CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; # Explicitly assign CURRENT_USER() to definer ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; -Comparing tables master:test.v_event and slave:test.v_event -Comparing tables master:test.v_event and slave2:test.v_event +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_event, server_2:v_event, server_3:v_event] # Session user will be set as definer, if the statement does not assign # a definer ALTER EVENT e1 ENABLE; -Comparing tables master:test.v_event and slave:test.v_event -Comparing tables master:test.v_event and slave2:test.v_event +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_event, server_2:v_event, server_3:v_event] # Verify that this patch does not affect the calling of CURRENT_USER() # in the other statements @@ -127,7 +108,7 @@ SELECT * FROM t1; c1 @ 1234 -# [On slave2] +# [On server_3] SELECT * FROM t1; c1 @ @@ -145,7 +126,7 @@ SELECT * FROM t1; c1 @ @ -# [On slave2] +# [On server_3] SELECT * FROM t1; c1 @ @@ -159,7 +140,7 @@ c1 # [On slave] SELECT * FROM t1; c1 -# [On slave2] +# [On server_3] SELECT * FROM t1; c1 # [On master] @@ -187,7 +168,7 @@ c1 SELECT * FROM t2; c1 @ -# [On slave2] +# [On server_3] SELECT * FROM t1; c1 @ @@ -203,3 +184,4 @@ DROP PROCEDURE my_grant; DROP PROCEDURE my_revoke; DROP FUNCTION my_user; DROP EVENT e1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ddl.result b/mysql-test/suite/rpl/r/rpl_ddl.result index af6b33966e9..e4f769a4c78 100644 --- a/mysql-test/suite/rpl/r/rpl_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_ddl.result @@ -1,15 +1,8 @@ -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; +include/master-slave.inc +[connection master] -------- switch to master ------- SET AUTOCOMMIT = 1; -DROP DATABASE IF EXISTS mysqltest1; -DROP DATABASE IF EXISTS mysqltest2; -DROP DATABASE IF EXISTS mysqltest3; CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest2; CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=InnoDB; @@ -1626,3 +1619,4 @@ use test; -------- switch to master ------- DROP DATABASE mysqltest1; DROP DATABASE mysqltest3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result index a894e1a4971..37d209bbcf6 100644 --- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] *** Prepare tables and data *** CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=innodb; CREATE TABLE t2 (a INT) ENGINE=innodb; @@ -50,7 +46,7 @@ a SELECT * FROM t3; a 3 -Checking that both slave threads are running. +include/check_slave_is_running.inc *** Test lock wait timeout *** include/stop_slave.inc @@ -61,6 +57,7 @@ SELECT * FROM t1 FOR UPDATE; a 1 START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1205] SELECT COUNT(*) FROM t2; COUNT(*) 0 @@ -74,7 +71,7 @@ SELECT * FROM t3; a 3 3 -Checking that both slave threads are running. +include/check_slave_is_running.inc *** Test lock wait timeout and purged relay logs *** SET @my_max_relay_log_size= @@global.max_relay_log_size; @@ -88,6 +85,7 @@ a 1 1 START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1205] SELECT COUNT(*) FROM t2; COUNT(*) 0 @@ -103,9 +101,10 @@ a 3 3 3 -Checking that both slave threads are running. +include/check_slave_is_running.inc *** Clean up *** DROP TABLE t1,t2,t3; SET global max_relay_log_size= @my_max_relay_log_size; End of 5.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_delete_no_where.result b/mysql-test/suite/rpl/r/rpl_delete_no_where.result index 78edf4bf3fa..923cd428aec 100644 --- a/mysql-test/suite/rpl/r/rpl_delete_no_where.result +++ b/mysql-test/suite/rpl/r/rpl_delete_no_where.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int, b int) engine=myisam; insert into t1 values(1,1); select * from t1; @@ -13,3 +9,4 @@ delete from t1; select * from t1; a b drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result index 74f61125735..52bcb90f357 100644 --- a/mysql-test/suite/rpl/r/rpl_do_grant.result +++ b/mysql-test/suite/rpl/r/rpl_do_grant.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] delete from mysql.user where user=_binary'rpl_do_grant'; delete from mysql.db where user=_binary'rpl_do_grant'; flush privileges; @@ -167,21 +163,13 @@ DROP FUNCTION bug42217_db.upgrade_del_func; DROP FUNCTION bug42217_db.upgrade_alter_func; DROP DATABASE bug42217_db; stop slave; +SET SQL_LOG_BIN= 0; DROP USER 'create_rout_db'@'localhost'; -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 SQL_LOG_BIN= 1; +include/rpl_reset.inc +USE test; ######## BUG#49119 ####### ### i) test case from the 'how to repeat section' -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; CREATE TABLE t1(c1 INT); CREATE PROCEDURE p1() SELECT * FROM t1 | REVOKE EXECUTE ON PROCEDURE p1 FROM 'root'@'localhost'; @@ -189,12 +177,7 @@ ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' DROP TABLE t1; DROP PROCEDURE p1; ### ii) Test case in which REVOKE partially succeeds -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; +include/rpl_reset.inc CREATE TABLE t1(c1 INT); CREATE PROCEDURE p1() SELECT * FROM t1 | CREATE USER 'user49119'@'localhost'; @@ -247,12 +230,7 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION DROP TABLE t1; DROP PROCEDURE p1; DROP USER 'user49119'@'localhost'; -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; +include/rpl_reset.inc grant all on *.* to foo@"1.2.3.4"; revoke all privileges, grant option from "foo"; ERROR HY000: Can't revoke all privileges for one or more of the requested users @@ -260,15 +238,11 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4" master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo" +include/check_slave_no_error.inc DROP USER foo@"1.2.3.4"; # Bug#27606 GRANT statement should be replicated with DEFINER information -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; +include/rpl_reset.inc GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost; SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; Grantor @@ -285,3 +259,4 @@ Grantor root@localhost DROP USER user_bug27606@localhost; "End of test" +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_drop.result b/mysql-test/suite/rpl/r/rpl_drop.result index 5ebbc4f9ce7..a32d3fd5fc7 100644 --- a/mysql-test/suite/rpl/r/rpl_drop.result +++ b/mysql-test/suite/rpl/r/rpl_drop.result @@ -1,10 +1,5 @@ -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; -drop table if exists t1, t2; +include/master-slave.inc +[connection master] create table t1 (a int); drop table t1, t2; ERROR 42S02: Unknown table 't2' @@ -32,3 +27,4 @@ DROP FUNCTION f1; DROP TABLE t2, t3; SET @@global.binlog_format= @old_binlog_format; SET @@global.binlog_format= @old_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_drop_db.result b/mysql-test/suite/rpl/r/rpl_drop_db.result index 8825797f80d..8a88f01a444 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_db.result +++ b/mysql-test/suite/rpl/r/rpl_drop_db.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; create table mysqltest1.t1 (n int); @@ -34,4 +30,4 @@ n use test; drop table t1; drop database mysqltest1; -include/stop_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_drop_temp.result b/mysql-test/suite/rpl/r/rpl_drop_temp.result index 03fbaa2256f..4aa0ba0bc0d 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_temp.result +++ b/mysql-test/suite/rpl/r/rpl_drop_temp.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create database if not exists mysqltest; use mysqltest; create temporary table mysqltest.t1 (n int)ENGINE=MyISAM; @@ -26,3 +22,4 @@ CREATE TEMPORARY TABLE tmp3 (a int); DROP TEMPORARY TABLE tmp3; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_drop_view.result b/mysql-test/suite/rpl/r/rpl_drop_view.result index c359011612a..0688ce42bc2 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_view.result +++ b/mysql-test/suite/rpl/r/rpl_drop_view.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1, t2; drop view if exists v1, v2, v3, not_exist_view; create table t1 (a int); @@ -27,3 +23,4 @@ select * from v3; ERROR 42S02: Table 'test.v3' doesn't exist ==== clean up ==== drop table t1, t2, t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result index aa1a573d052..3a3bed1a6fd 100644 --- a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result +++ b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result @@ -1,12 +1,4 @@ -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; -reset master; -change master to master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root"; -include/start_slave.inc +include/rpl_init.inc [topology=1->2->1] create table t1 (n int); include/stop_slave.inc create table t2 (n int); @@ -25,6 +17,7 @@ insert into t3 values(4); start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart +include/wait_for_slave_sql_to_stop.inc show tables; Tables_in_test t1 @@ -32,12 +25,14 @@ t2 start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart +include/wait_for_slave_sql_to_stop.inc select * from t3; n 1 start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart +include/wait_for_slave_sql_to_stop.inc select * from t3; n 1 @@ -55,6 +50,5 @@ t3 t4 t5 t6 -include/stop_slave.inc -reset slave; -drop table t1,t2,t3,t4,t5,t6; +drop table t1, t2, t3, t4, t5, t6; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_empty_master_crash.result b/mysql-test/suite/rpl/r/rpl_empty_master_crash.result index f71411c68dd..34281bc33d7 100644 --- a/mysql-test/suite/rpl/r/rpl_empty_master_crash.result +++ b/mysql-test/suite/rpl/r/rpl_empty_master_crash.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] load table t1 from master; ERROR 08S01: Error connecting to master: Master is not configured load table t1 from master; ERROR HY000: Error from master: 'Table 'test.t1' doesn't exist' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result b/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result index 75fefdad2a2..6d00774ef87 100644 --- a/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result +++ b/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Statement may not be safe to log in statement format."); create table t1 (a int primary key); create table t4 (a int primary key); @@ -41,3 +37,4 @@ a 3 4 DROP TABLE test.t4; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result index b724d284bfa..30ba1bb3828 100644 --- a/mysql-test/suite/rpl/r/rpl_events.result +++ b/mysql-test/suite/rpl/r/rpl_events.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET @old_event_scheduler = @@global.event_scheduler; set global event_scheduler=1; set binlog_format=row; @@ -257,3 +253,4 @@ DROP EVENT event44331_1; DROP EVENT event44331_2; DROP EVENT event44331_3; DROP EVENT event44331_4; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result index e8535a0bc5e..affb179d50e 100644 --- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set binlog_format=row; *********************************************************** @@ -91,7 +87,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -428,7 +424,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -464,10 +460,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254' *** Drop t10 *** DROP TABLE t10; @@ -502,10 +496,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15' *** Drop t11 *** DROP TABLE t11; @@ -616,7 +608,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +include/wait_for_slave_sql_error.inc [errno=1091] +Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'' STOP SLAVE; RESET SLAVE; @@ -664,7 +657,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 1054 *** ******************************************** -Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +include/wait_for_slave_sql_error.inc [errno=1054] +Last_SQL_Error = 'Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'' STOP SLAVE; RESET SLAVE; @@ -712,7 +706,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +include/wait_for_slave_sql_error.inc [errno=1072] +Last_SQL_Error = 'Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'' STOP SLAVE; RESET SLAVE; @@ -876,7 +871,6 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - set binlog_format=statement; *********************************************************** @@ -964,7 +958,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -1301,7 +1295,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -1337,10 +1331,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254' *** Drop t10 *** DROP TABLE t10; @@ -1375,10 +1367,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15' *** Drop t11 *** DROP TABLE t11; @@ -1489,7 +1479,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +include/wait_for_slave_sql_error.inc [errno=1091] +Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'' STOP SLAVE; RESET SLAVE; @@ -1537,7 +1528,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 1054 *** ******************************************** -Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +include/wait_for_slave_sql_error.inc [errno=1054] +Last_SQL_Error = 'Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'' STOP SLAVE; RESET SLAVE; @@ -1585,7 +1577,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +include/wait_for_slave_sql_error.inc [errno=1072] +Last_SQL_Error = 'Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'' STOP SLAVE; RESET SLAVE; @@ -1749,7 +1742,6 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - set binlog_format=mixed; *********************************************************** @@ -1837,7 +1829,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -2174,7 +2166,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -2210,10 +2202,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254' *** Drop t10 *** DROP TABLE t10; @@ -2248,10 +2238,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15' *** Drop t11 *** DROP TABLE t11; @@ -2362,7 +2350,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +include/wait_for_slave_sql_error.inc [errno=1091] +Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'' STOP SLAVE; RESET SLAVE; @@ -2410,7 +2399,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 1054 *** ******************************************** -Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +include/wait_for_slave_sql_error.inc [errno=1054] +Last_SQL_Error = 'Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'' STOP SLAVE; RESET SLAVE; @@ -2458,7 +2448,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +include/wait_for_slave_sql_error.inc [errno=1072] +Last_SQL_Error = 'Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'' STOP SLAVE; RESET SLAVE; @@ -2622,4 +2613,4 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result index f360a8847eb..8aeb5bdc1c9 100644 --- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set binlog_format=row; *********************************************************** @@ -91,7 +87,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -428,7 +424,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -464,10 +460,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254' *** Drop t10 *** DROP TABLE t10; @@ -502,10 +496,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15' *** Drop t11 *** DROP TABLE t11; @@ -616,7 +608,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +include/wait_for_slave_sql_error.inc [errno=1091] +Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'' STOP SLAVE; RESET SLAVE; @@ -664,7 +657,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 1054 *** ******************************************** -Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +include/wait_for_slave_sql_error.inc [errno=1054] +Last_SQL_Error = 'Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'' STOP SLAVE; RESET SLAVE; @@ -712,7 +706,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +include/wait_for_slave_sql_error.inc [errno=1072] +Last_SQL_Error = 'Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'' STOP SLAVE; RESET SLAVE; @@ -876,7 +871,6 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - set binlog_format=statement; *********************************************************** @@ -964,7 +958,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -1301,7 +1295,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -1337,10 +1331,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254' *** Drop t10 *** DROP TABLE t10; @@ -1375,10 +1367,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15' *** Drop t11 *** DROP TABLE t11; @@ -1489,7 +1479,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +include/wait_for_slave_sql_error.inc [errno=1091] +Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'' STOP SLAVE; RESET SLAVE; @@ -1537,7 +1528,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 1054 *** ******************************************** -Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +include/wait_for_slave_sql_error.inc [errno=1054] +Last_SQL_Error = 'Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'' STOP SLAVE; RESET SLAVE; @@ -1585,7 +1577,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +include/wait_for_slave_sql_error.inc [errno=1072] +Last_SQL_Error = 'Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'' STOP SLAVE; RESET SLAVE; @@ -1749,7 +1742,6 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - set binlog_format=mixed; *********************************************************** @@ -1837,7 +1829,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -2174,7 +2166,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -2210,10 +2202,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254' *** Drop t10 *** DROP TABLE t10; @@ -2248,10 +2238,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15' *** Drop t11 *** DROP TABLE t11; @@ -2362,7 +2350,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +include/wait_for_slave_sql_error.inc [errno=1091] +Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'' STOP SLAVE; RESET SLAVE; @@ -2410,7 +2399,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 1054 *** ******************************************** -Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +include/wait_for_slave_sql_error.inc [errno=1054] +Last_SQL_Error = 'Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'' STOP SLAVE; RESET SLAVE; @@ -2458,7 +2448,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +include/wait_for_slave_sql_error.inc [errno=1072] +Last_SQL_Error = 'Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'' STOP SLAVE; RESET SLAVE; @@ -2622,4 +2613,4 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result index 48fd0366c26..9ea319379c0 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** @@ -54,7 +50,8 @@ a b c 3 4 QA TESTING *** Start Slave *** START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.' STOP SLAVE; RESET SLAVE; SELECT * FROM t2 ORDER BY a; @@ -83,10 +80,8 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3' *** Drop t3 *** DROP TABLE t3; *** Create t4 on slave *** @@ -108,10 +103,8 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3' *** Drop t4 *** DROP TABLE t4; *** Create t5 on slave *** @@ -133,10 +126,8 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246' *** Drop t5 *** DROP TABLE t5; *** Create t6 on slave *** @@ -157,7 +148,8 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** -Last_SQL_Error = Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3' SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** DROP TABLE t6; @@ -237,6 +229,7 @@ a b c d e f g h i 1 b1b1b1b1b1b1b1b1 Kyle 0000-00-00 00:00:00 0 NULL NULL 2 b1b1b1b1b1b1b1b1 JOE 0000-00-00 00:00:00 0 NULL NULL 3 b1b1b1b1b1b1b1b1 QA 0000-00-00 00:00:00 0 NULL NULL +DROP TABLE t9; *** Create t10 on slave *** STOP SLAVE; RESET SLAVE; @@ -255,10 +248,8 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5' *** Drop t10 *** DROP TABLE t10; *** Create t11 on slave *** @@ -279,10 +270,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252' *** Drop t11 *** DROP TABLE t11; *** Create t12 on slave *** @@ -439,6 +428,7 @@ c1 c4 c5 c6 c7 4 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP 5 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP 6 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP +DROP TABLE t14a; *** connect to master and drop columns *** ALTER TABLE t14 DROP COLUMN c2; ALTER TABLE t14 DROP COLUMN c4; @@ -492,10 +482,8 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5; ******************************************** *** Expect slave to fail with Error 1060 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1060] +Last_SQL_Error = 'Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'' *** Try to insert in master **** INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2); SELECT * FROM t15 ORDER BY c1; @@ -595,9 +583,8 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2' ** DROP table t17 *** DROP TABLE t17; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result index 80b18ee4bd7..716a35b3464 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** @@ -54,7 +50,8 @@ a b c 3 4 QA TESTING *** Start Slave *** START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.' STOP SLAVE; RESET SLAVE; SELECT * FROM t2 ORDER BY a; @@ -83,10 +80,8 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3' *** Drop t3 *** DROP TABLE t3; *** Create t4 on slave *** @@ -108,10 +103,8 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3' *** Drop t4 *** DROP TABLE t4; *** Create t5 on slave *** @@ -133,10 +126,8 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246' *** Drop t5 *** DROP TABLE t5; *** Create t6 on slave *** @@ -157,7 +148,8 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** -Last_SQL_Error = Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3' SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** DROP TABLE t6; @@ -237,6 +229,7 @@ a b c d e f g h i 1 b1b1b1b1b1b1b1b1 Kyle 0000-00-00 00:00:00 0 NULL NULL 2 b1b1b1b1b1b1b1b1 JOE 0000-00-00 00:00:00 0 NULL NULL 3 b1b1b1b1b1b1b1b1 QA 0000-00-00 00:00:00 0 NULL NULL +DROP TABLE t9; *** Create t10 on slave *** STOP SLAVE; RESET SLAVE; @@ -255,10 +248,8 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5' *** Drop t10 *** DROP TABLE t10; *** Create t11 on slave *** @@ -279,10 +270,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252' *** Drop t11 *** DROP TABLE t11; *** Create t12 on slave *** @@ -439,6 +428,7 @@ c1 c4 c5 c6 c7 4 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP 5 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP 6 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP +DROP TABLE t14a; *** connect to master and drop columns *** ALTER TABLE t14 DROP COLUMN c2; ALTER TABLE t14 DROP COLUMN c4; @@ -492,10 +482,8 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5; ******************************************** *** Expect slave to fail with Error 1060 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1060] +Last_SQL_Error = 'Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'' *** Try to insert in master **** INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2); SELECT * FROM t15 ORDER BY c1; @@ -595,9 +583,8 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2' ** DROP table t17 *** DROP TABLE t17; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_failed_optimize.result b/mysql-test/suite/rpl/r/rpl_failed_optimize.result index 7210898d521..b0c331fa557 100644 --- a/mysql-test/suite/rpl/r/rpl_failed_optimize.result +++ b/mysql-test/suite/rpl/r/rpl_failed_optimize.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 ( a int ) ENGINE=InnoDB; BEGIN; INSERT INTO t1 VALUES (1); @@ -23,3 +19,4 @@ a 1 commit; drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result index 5f1f72a9a3a..4eaf61e5f9e 100644 --- a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result +++ b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (id int, a int); CREATE TABLE t2 (id int, b int); CREATE TABLE t3 (id int, c int); @@ -47,85 +43,53 @@ UPDATE t4 LEFT JOIN (t1, t6, t7) ON (t4.id=t1.id and t4.id=t6.id and t4.id=t7.id UPDATE t7 LEFT JOIN (t4, t1, t2) ON (t7.id=t4.id and t7.id=t1.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1; UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id) SET a=0, d=0, g=0, h=0 where t7.id=1; UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1'' UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1'' UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1'' UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1'' UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1'' UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1'' UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1'' UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1'' UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1'' UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1'' [on slave] show tables like 't%'; Tables_in_test (t%) @@ -149,3 +113,4 @@ id c 3 3 [on master] drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result index 3bb96b669d7..26b7640ccbc 100644 --- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result +++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result @@ -1,27 +1,15 @@ -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; +include/rpl_init.inc [topology=1->2->1] show variables like 'relay_log%'; Variable_name Value -relay_log MYSQLD_DATADIR/relay-log +relay_log master-relay-bin relay_log_index relay_log_info_file relay-log.info relay_log_purge ON relay_log_space_limit 0 -stop slave; -change master to master_host='127.0.0.1',master_user='root', -master_password='',master_port=MASTER_PORT; -start slave; -stop slave; -change master to master_host='127.0.0.1',master_user='root', -master_password='',master_port=SLAVE_PORT; -include/start_slave.inc CREATE TABLE t1 (a INT KEY) ENGINE= MyISAM; INSERT INTO t1 VALUE(1); FLUSH LOGS; INSERT INTO t1 VALUE(2); -Checking that both slave threads are running. -Relay_Log_File relay-log.000003 +include/check_slave_is_running.inc +Relay_Log_File = 'master-relay-bin.000003' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result b/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result index e7a912b75fa..038a29c12e2 100644 --- a/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT AUTO_INCREMENT KEY) ENGINE=INNODB; CREATE TABLE t2 (b INT AUTO_INCREMENT KEY, c INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=INNODB; SET FOREIGN_KEY_CHECKS=0; @@ -53,3 +49,4 @@ select count(*) from t1 /* must be zero */; count(*) 0 drop table t2,t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_found_rows.result b/mysql-test/suite/rpl/r/rpl_found_rows.result index 45a931872cf..f1f8cc6d32d 100644 --- a/mysql-test/suite/rpl/r/rpl_found_rows.result +++ b/mysql-test/suite/rpl/r/rpl_found_rows.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== 0. Setting it all up ==== SET BINLOG_FORMAT=STATEMENT; **** On Master **** @@ -102,11 +98,7 @@ DELETE FROM logtbl; DROP PROCEDURE just_log; DROP PROCEDURE calc_and_log; DROP FUNCTION log_rows; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc #### 2. Using mixed mode #### ==== 2.1. Checking a procedure ==== **** On Master **** @@ -231,3 +223,4 @@ DROP PROCEDURE just_log; DROP PROCEDURE log_me; DROP PROCEDURE log_me_inner; DROP FUNCTION log_rows; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_free_items.result b/mysql-test/suite/rpl/r/rpl_free_items.result index 91c1e2aa6e5..416f597aebc 100644 --- a/mysql-test/suite/rpl/r/rpl_free_items.result +++ b/mysql-test/suite/rpl/r/rpl_free_items.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int); create table t2 (a int); drop table t1; drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_geometry.result b/mysql-test/suite/rpl/r/rpl_geometry.result index 9b48dba4f22..7ec119c9ae8 100644 --- a/mysql-test/suite/rpl/r/rpl_geometry.result +++ b/mysql-test/suite/rpl/r/rpl_geometry.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a varchar(100), b multipoint not null, c varchar(256)); @@ -16,3 +12,4 @@ b geometrycollection default null, c decimal(10,0)); insert into t2(c) values (null); drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_get_lock.result b/mysql-test/suite/rpl/r/rpl_get_lock.result index cbad759b17f..8250ca348e6 100644 --- a/mysql-test/suite/rpl/r/rpl_get_lock.result +++ b/mysql-test/suite/rpl/r/rpl_get_lock.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Statement may not be safe to log in statement format."); create table t1(n int); insert into t1 values(get_lock("lock",2)); @@ -34,3 +30,4 @@ select is_free_lock(NULL); is_free_lock(NULL) NULL drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result index 432bcfcc94d..32d24e5867a 100644 --- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result +++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result @@ -1,33 +1,32 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); call mtr.add_suppression("Slave I/O thread .* register on master"); -stop slave; +include/stop_slave.inc SET @@global.debug= "+d,'debug_lock.before_get_UNIX_TIMESTAMP'"; -start slave; +include/start_slave.inc slave is going to hang in get_master_version_and_clock +include/rpl_stop_server.inc [server_number=1] slave is unblocked SET DEBUG_SYNC='now SIGNAL signal.get_unix_timestamp'; Check network error happened here +include/wait_for_slave_io_error.inc [errno=1040, 1053, 2002, 2003, 2006, 2013] set @@global.debug = "-d,'debug_lock.before_get_UNIX_TIMESTAMP'"; -stop slave; +include/rpl_start_server.inc [server_number=1] +include/wait_for_slave_param.inc [Slave_IO_Running] +include/stop_slave.inc SET @@global.debug= "+d,'debug_lock.before_get_SERVER_ID'"; -start slave; +include/start_slave.inc slave is going to hang in get_master_version_and_clock +include/rpl_stop_server.inc [server_number=1] slave is unblocked SET DEBUG_SYNC='now SIGNAL signal.get_server_id'; Check network error happened here +include/wait_for_slave_io_error.inc [errno=1040, 1053, 2002, 2003, 2006, 2013] set @@global.debug = "-d,'debug_lock.before_get_SERVER_ID'"; +include/rpl_start_server.inc [server_number=1] +include/wait_for_slave_param.inc [Slave_IO_Running] set global debug= ''; -reset master; -include/stop_slave.inc -change master to master_port=SLAVE_PORT; -start slave; -*** must be having the replicate-same-server-id IO thread error *** -Last_IO_Error = Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it). SET DEBUG_SYNC= 'RESET'; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_grant.result b/mysql-test/suite/rpl/r/rpl_grant.result index 285d52b7678..4ec8c51a5dc 100644 --- a/mysql-test/suite/rpl/r/rpl_grant.result +++ b/mysql-test/suite/rpl/r/rpl_grant.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] **** On Master **** CREATE USER dummy@localhost; CREATE USER dummy1@localhost, dummy2@localhost; @@ -41,3 +37,4 @@ user host SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%'; COUNT(*) 0 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result index bfdcbc6fa23..e25d5f81c91 100644 --- a/mysql-test/suite/rpl/r/rpl_idempotency.result +++ b/mysql-test/suite/rpl/r/rpl_idempotency.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032"); +call mtr.add_suppression("Can't find record in 't.'"); call mtr.add_suppression("Slave: Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451"); call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); SET @old_slave_exec_mode= @@global.slave_exec_mode; @@ -32,8 +29,7 @@ SELECT * FROM t2 ORDER BY a; a -3 -1 -Last_SQL_Error -0 +include/check_slave_no_error.inc INSERT IGNORE INTO t1 VALUES (-2); INSERT IGNORE INTO t1 VALUES (-2); SELECT * FROM t1 ORDER BY a; @@ -46,8 +42,7 @@ a -3 -2 -1 -Last_SQL_Error -0 +include/check_slave_no_error.inc UPDATE t1 SET a = 1 WHERE a = -1; UPDATE t2 SET a = 1 WHERE a = -1; UPDATE t1 SET a = 1 WHERE a = -1; @@ -70,8 +65,7 @@ SELECT * FROM t2 ORDER BY a; a -3 1 -Last_SQL_Error -0 +include/check_slave_no_error.inc DROP TABLE t1, t2; select @@global.slave_exec_mode /* must be IDEMPOTENT */; @@global.slave_exec_mode @@ -143,8 +137,7 @@ b 2 3 *** slave must stop (Trying to delete a referenced foreing key) -Last_SQL_Error -1451 +include/wait_for_slave_sql_error.inc [errno=1451] select * from ti1 order by b /* must be (1),(2),(3) - not deleted */; b 1 @@ -161,8 +154,7 @@ set global slave_exec_mode='STRICT'; delete from ti1 where b=3; insert into ti2 set a=3, b=3 /* offending write event */; *** slave must stop (Trying to insert an invalid foreign key) -Last_SQL_Error -1452 +include/wait_for_slave_sql_error.inc [errno=1452] select * from ti2 order by b /* must be (2,2) */; a b 2 2 @@ -181,8 +173,7 @@ a b insert into ti1 set b=1; insert into ti1 set b=1 /* offending write event */; *** slave must stop (Trying to insert a dupliacte key) -Last_SQL_Error -1062 +include/wait_for_slave_sql_error.inc [errno=1062] set foreign_key_checks= 0; delete from ti1 where b=1; set foreign_key_checks= 1; @@ -197,15 +188,13 @@ DELETE FROM t1 WHERE a = -2; DELETE FROM t2 WHERE a = -2; DELETE FROM t1 WHERE a = -2; *** slave must stop (Key was not found) -Last_SQL_Error -1032 +include/wait_for_slave_sql_error.inc [errno=1032] set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; set global slave_exec_mode='STRICT'; DELETE FROM t2 WHERE a = -2; *** slave must stop (Key was not found) -Last_SQL_Error -1032 +include/wait_for_slave_sql_error.inc [errno=1032] set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; set global slave_exec_mode='STRICT'; @@ -213,18 +202,17 @@ UPDATE t1 SET a = 1 WHERE a = -1; UPDATE t2 SET a = 1 WHERE a = -1; UPDATE t1 SET a = 1 WHERE a = -1; *** slave must stop (Key was not found) -Last_SQL_Error -1032 +include/wait_for_slave_sql_error.inc [errno=1032] set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; set global slave_exec_mode='STRICT'; UPDATE t2 SET a = 1 WHERE a = -1; *** slave must stop (Key was not found) -Last_SQL_Error -1032 +include/wait_for_slave_sql_error.inc [errno=1032] set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; SET @@global.slave_exec_mode= @old_slave_exec_mode; set @@session.binlog_format= @save_binlog_format; drop table t1,t2,ti2,ti1; +include/rpl_end.inc *** end of tests diff --git a/mysql-test/suite/rpl/r/rpl_ignore_grant.result b/mysql-test/suite/rpl/r/rpl_ignore_grant.result index 5169cc8e888..ae6d6ddfc8d 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_grant.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_grant.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; @@ -35,3 +31,4 @@ flush privileges; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ignore_revoke.result b/mysql-test/suite/rpl/r/rpl_ignore_revoke.result index b1ccd2f0442..84e1a3b40c7 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_revoke.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_revoke.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] grant select on *.* to 'user_foo'@'%' identified by 'user_foopass'; revoke select on *.* from 'user_foo'@'%'; select select_priv from mysql.user where user='user_foo' /* master:must be N */; @@ -28,3 +24,4 @@ Y revoke select on *.* FROM 'user_foo'; delete from mysql.user where user="user_foo"; delete from mysql.user where user="user_foo"; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result index d06dda66267..374053f322a 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result @@ -1,9 +1,8 @@ -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; +include/master-slave.inc +[connection master] +call mtr.add_suppression("Can't find record in 't.'"); +call mtr.add_suppression("Can't find record in 'user'"); +call mtr.add_suppression("Can't find record in 'tables_priv'"); **** Test case for BUG#16487 **** **** Master **** CREATE TABLE test.t4 (a int); @@ -142,3 +141,4 @@ HEX(word) SELECT * FROM tmptbl504451f4258$1; ERROR 42S02: Table 'test.tmptbl504451f4258$1' doesn't exist DROP TABLE t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table_update.result b/mysql-test/suite/rpl/r/rpl_ignore_table_update.result index a88a3c690ed..c3882d0b98f 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table_update.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table_update.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] use test; drop table if exists mysqltest_foo; drop table if exists mysqltest_bar; @@ -21,3 +17,4 @@ n m k 4 15 55 drop table mysqltest_foo,mysqltest_bar,t1; drop table mysqltest_foo,mysqltest_bar,t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result index 6c226aaf2f7..b54d7d400f7 100644 --- a/mysql-test/suite/rpl/r/rpl_incident.result +++ b/mysql-test/suite/rpl/r/rpl_incident.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] **** On Master **** CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3); @@ -19,7 +15,8 @@ a 2 3 4 -Last_SQL_Error = The incident LOST_EVENTS occured on the master. Message: <none> +include/wait_for_slave_sql_error.inc [errno=1590] +Last_SQL_Error = 'The incident LOST_EVENTS occured on the master. Message: <none>' **** On Slave **** SELECT * FROM t1; a @@ -34,5 +31,6 @@ a 2 3 4 -Checking that both slave threads are running. +include/check_slave_is_running.inc DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_init_slave.result b/mysql-test/suite/rpl/r/rpl_init_slave.result index 908abf56c1f..fcf7114879c 100644 --- a/mysql-test/suite/rpl/r/rpl_init_slave.result +++ b/mysql-test/suite/rpl/r/rpl_init_slave.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set global max_connections=151; include/stop_slave.inc include/start_slave.inc @@ -25,6 +21,6 @@ set global init_connect="set @c=1"; show variables like 'init_connect'; Variable_name Value init_connect set @c=1 -include/stop_slave.inc set global init_connect= @my_global_init_connect; set global max_connections= default; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result index c6ee82b13f3..46bc66cbb65 100644 --- a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result +++ b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result @@ -1,19 +1,19 @@ -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; +include/master-slave.inc +[connection master] stop slave; reset slave; SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; -Reporting the following error: Failed during slave thread initialization +include/wait_for_slave_sql_error.inc [errno=1593] +Last_SQL_Error = 'Failed during slave thread initialization' call mtr.add_suppression("Failed during slave I/O thread initialization"); SET GLOBAL debug= ""; -stop slave; reset slave; SET GLOBAL init_slave= "garbage"; start slave; -Reporting the following error: Slave SQL thread aborted. Can't execute init_slave query +include/wait_for_slave_sql_error.inc [errno=1064] +Last_SQL_Error = 'Slave SQL thread aborted. Can't execute init_slave query' SET GLOBAL init_slave= ""; +include/stop_slave_io.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_innodb.result b/mysql-test/suite/rpl/r/rpl_innodb.result index bf6c3cb8c86..fe3feba10e1 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t4 ( id INT(5) unsigned NOT NULL auto_increment, name varchar(15) NOT NULL default '', @@ -81,4 +77,5 @@ FLUSH LOGS; -------- switch to master -------- FLUSH LOGS; DROP DATABASE mysqltest1; +include/rpl_end.inc End of 5.1 tests diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result index 6ad22c368b4..f8734b48295 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] use test; CREATE TABLE test.regular_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT, dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, @@ -140,3 +136,4 @@ DROP PROCEDURE test.proc_byrange; DROP TABLE test.regular_tbl; DROP TABLE test.bykey_tbl; DROP TABLE test.byrange_tbl; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result b/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result index abff02b4b07..d06e6681e81 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] use test; CREATE TABLE test.regular_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT, dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, @@ -33,3 +29,4 @@ END| CALL test.proc_norm(); DROP PROCEDURE test.proc_norm; DROP TABLE test.regular_tbl; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result index 549842198e8..36294a4333b 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==========MASTER========== show global variables like 'binlog_format%'; Variable_name Value @@ -157,3 +153,4 @@ master-bin.000001 # Query # # use `test_rpl`; CREATE INDEX index2 on t2 (d) master-bin.000001 # Query # # use `test_rpl`; CREATE INDEX index3 on t2 (a, d) master-bin.000001 # Query # # use `test_rpl`; ALTER TABLE t2 DROP COLUMN d drop database test_rpl; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index d076a24e1f0..acecb7a88be 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==========MASTER========== show global variables like 'binlog_format%'; Variable_name Value @@ -1104,3 +1100,4 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2 master-bin.000001 # Xid # # COMMIT /* XID */ drop database test_rpl; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert.result b/mysql-test/suite/rpl/r/rpl_insert.result index 6080d18c5aa..b8e5bfad5d5 100644 --- a/mysql-test/suite/rpl/r/rpl_insert.result +++ b/mysql-test/suite/rpl/r/rpl_insert.result @@ -1,12 +1,8 @@ # # Bug#20821: INSERT DELAYED fails to write some rows to binlog # -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; +include/master-slave.inc +[connection master] CREATE SCHEMA IF NOT EXISTS mysqlslap; USE mysqlslap; CREATE TABLE t1 (id INT, name VARCHAR(64)) ENGINE=MyISAM; @@ -21,3 +17,4 @@ COUNT(*) # USE test; DROP SCHEMA mysqlslap; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert_id.result b/mysql-test/suite/rpl/r/rpl_insert_id.result index e171e247b6c..7ac951576ce 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_id.result +++ b/mysql-test/suite/rpl/r/rpl_insert_id.result @@ -2,19 +2,14 @@ # Setup # use test; -drop table if exists t1, t2, t3; # # See if queries that use both auto_increment and LAST_INSERT_ID() # are replicated well # # We also check how the foreign_key_check variable is replicated # -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; +include/master-slave.inc +[connection master] SET @old_concurrent_insert= @@global.concurrent_insert; SET @@global.concurrent_insert= 0; create table t1(a int auto_increment, key(a)) engine=myisam; @@ -531,3 +526,4 @@ id last_id drop table t1, t2; drop procedure foo; SET @@global.concurrent_insert= @old_concurrent_insert; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert_id_pk.result b/mysql-test/suite/rpl/r/rpl_insert_id_pk.result index 79815355332..c2d6d2c9b0c 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_id_pk.result +++ b/mysql-test/suite/rpl/r/rpl_insert_id_pk.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int auto_increment, primary key(a)); create table t2(b int auto_increment, c int, primary key(b)); insert into t1 values (1),(2),(3); @@ -74,3 +70,4 @@ SET FOREIGN_KEY_CHECKS=0; INSERT INTO t1 VALUES (1),(1); Got one of the listed errors drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert_ignore.result b/mysql-test/suite/rpl/r/rpl_insert_ignore.result index da24c86627c..6937c3d0987 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_ignore.result +++ b/mysql-test/suite/rpl/r/rpl_insert_ignore.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned, @@ -68,3 +64,4 @@ a b 5 5 6 6 drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert_select.result b/mysql-test/suite/rpl/r/rpl_insert_select.result index 1aff39e0026..d98ae2538fa 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_select.result +++ b/mysql-test/suite/rpl/r/rpl_insert_select.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (n int not null primary key); insert into t1 values (1); create table t2 (n int); @@ -15,3 +11,4 @@ n 1 2 drop table t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_invoked_features.result b/mysql-test/suite/rpl/r/rpl_invoked_features.result index be9169c785b..514483e7995 100644 --- a/mysql-test/suite/rpl/r/rpl_invoked_features.result +++ b/mysql-test/suite/rpl/r/rpl_invoked_features.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] USE test; DROP VIEW IF EXISTS v1,v11; DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13; @@ -447,3 +443,4 @@ DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f2; DROP EVENT IF EXISTS e1; DROP EVENT IF EXISTS e11; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_killed_ddl.result b/mysql-test/suite/rpl/r/rpl_killed_ddl.result index c3cde16b9d2..a02c9b599bf 100644 --- a/mysql-test/suite/rpl/r/rpl_killed_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_killed_ddl.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS d1; DROP DATABASE IF EXISTS d2; DROP DATABASE IF EXISTS d3; @@ -59,62 +55,62 @@ CREATE VIEW v1 AS SELECT a FROM t1 WHERE a < 100; [on master1] CREATE DATABASE d2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP DATABASE d1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP DATABASE IF EXISTS d2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE EVENT e2 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY DO INSERT INTO test.t1 VALUES (2); source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP EVENT e1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP EVENT IF EXISTS e2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE FUNCTION f2 () RETURNS INT DETERMINISTIC RETURN 1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc ALTER FUNCTION f1 SQL SECURITY INVOKER; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP FUNCTION f1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE PROCEDURE p2 (OUT rows INT) BEGIN SELECT COUNT(*) INTO rows FROM t2; END; // source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table t1'; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP PROCEDURE p1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE TABLE t2 (b int); source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc ALTER TABLE t1 ADD (d int); source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc RENAME TABLE t3 TO t4; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE INDEX i2 on t1 (a); source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP INDEX i1 on t1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE TABLE IF NOT EXISTS t4 (a int); CREATE TRIGGER tr2 BEFORE INSERT ON t4 FOR EACH ROW BEGIN @@ -122,28 +118,28 @@ DELETE FROM t1 WHERE a=NEW.a; END; // source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP TRIGGER tr1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP TRIGGER IF EXISTS tr2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE VIEW v2 AS SELECT a FROM t1 WHERE a > 100; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP VIEW v1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP VIEW IF EXISTS v2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP TABLE t1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP TABLE IF EXISTS t2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP DATABASE IF EXISTS d1; DROP DATABASE IF EXISTS d2; DROP DATABASE IF EXISTS d3; @@ -168,3 +164,4 @@ DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p2; DROP PROCEDURE IF EXISTS p3; DROP PROCEDURE IF EXISTS p4; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result index daefee9c669..52980e81523 100644 --- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result +++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT, UNIQUE(b)); INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10; @@ -11,7 +7,8 @@ SELECT * FROM t1; a b 1 10 2 2 -Last_SQL_Error = Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10' +include/wait_for_slave_sql_error.inc [errno=1105] +Last_SQL_Error = 'Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'' SELECT * FROM t1; a b stop slave; @@ -56,12 +53,16 @@ id field_1 field_2 field_3 4 4 d 4d 5 5 e 5e 6 6 f 6f -Last_SQL_Error = Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1 (field_1, field_2, field_3) +include/wait_for_slave_sql_error.inc [errno=1105] +Last_SQL_Error = 'Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1 (field_1, field_2, field_3) SELECT t2.field_a, t2.field_b, t2.field_c FROM t2 ON DUPLICATE KEY UPDATE -t1.field_3 = t2.field_c' +t1.field_3 = t2.field_c'' SELECT * FROM t1; id field_1 field_2 field_3 drop table t1, t2; drop table t1, t2; +include/stop_slave_io.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_load_from_master.result b/mysql-test/suite/rpl/r/rpl_load_from_master.result index e1c2ecb35be..8ff9514d023 100644 --- a/mysql-test/suite/rpl/r/rpl_load_from_master.result +++ b/mysql-test/suite/rpl/r/rpl_load_from_master.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest; drop database if exists mysqltest2; drop database if exists mysqltest3; @@ -131,3 +127,4 @@ drop database mysqltest; drop database mysqltest2; drop database mysqltest2; drop database mysqltest3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result index 9d9a1d7d6cb..50bd11873f1 100644 --- a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result +++ b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] "******************** Test Requirment 1 *************" SET SQL_LOG_BIN=0,timestamp=200006; CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM; @@ -49,3 +45,4 @@ set SQL_LOG_BIN=1; drop table if exists t1,t2,t3; create table t1(n int); drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result index 32ec2e624e2..bd8bc5093aa 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata.result @@ -1,10 +1,5 @@ -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; -reset master; +include/master-slave.inc +[connection master] select last_insert_id(); last_insert_id() 0 @@ -32,32 +27,27 @@ drop table t3; create table t1(a int, b int, unique(b)); insert into t1 values(1,10); load data infile '../../std_data/rpl_loaddata.dat' into table t1; -set global sql_slave_skip_counter=1; -start slave; -Last_SQL_Errno=0 -Last_SQL_Error - +include/wait_for_slave_sql_error_and_skip.inc [errno=1062] +include/check_slave_no_error.inc set sql_log_bin=0; delete from t1; set sql_log_bin=1; load data infile '../../std_data/rpl_loaddata.dat' into table t1; -stop slave; +include/wait_for_slave_sql_error.inc [errno=1062] +include/stop_slave_io.inc change master to master_user='test'; change master to master_user='root'; -Last_SQL_Errno=0 -Last_SQL_Error - +include/check_slave_no_error.inc set global sql_slave_skip_counter=1; start slave; set sql_log_bin=0; delete from t1; set sql_log_bin=1; load data infile '../../std_data/rpl_loaddata.dat' into table t1; +include/wait_for_slave_sql_error.inc [errno=1062] stop slave; reset slave; -Last_SQL_Errno=0 -Last_SQL_Error - +include/check_slave_no_error.inc reset master; create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), unique(day)) engine=MyISAM; @@ -80,18 +70,15 @@ load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; ERROR 23000: Duplicate entry '2003-03-22' for key 'day' +include/wait_for_slave_sql_to_stop.inc drop table t1, t2; +include/stop_slave_io.inc drop table t1, t2; CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1; ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY' DROP TABLE IF EXISTS t1; -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; +include/rpl_reset.inc drop database if exists b48297_db1; drop database if exists b42897_db2; create database b48297_db1; @@ -112,15 +99,10 @@ LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1; ### disconnect and switch back to master connection use b48297_db1; -Comparing tables master:b48297_db1.t1 and slave:b48297_db1.t1 +include/diff_tables.inc [master:b48297_db1.t1, slave:b48297_db1.t1] DROP DATABASE b48297_db1; DROP DATABASE b42897_db2; -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; +include/rpl_reset.inc use test; CREATE TABLE t1 (`key` TEXT, `text` TEXT); LOAD DATA INFILE '../../std_data/loaddata2.dat' REPLACE INTO TABLE `t1` FIELDS TERMINATED BY ','; @@ -132,3 +114,4 @@ Field 3 'Field 4' 'Field 5' 'Field 6' Field 6 'Field 7' DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result index e0971b84e3d..6b60bffa365 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a varchar(10) character set utf8); load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=koi8r; @@ -76,3 +72,4 @@ E4B880E4BA8CE4B889 E59B9BE4BA94E585AD E4B883E585ABE4B99D DROP DATABASE mysqltest; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_concurrent.result b/mysql-test/suite/rpl/r/rpl_loaddata_concurrent.result index 126cc07f45f..bc40f32842d 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_concurrent.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_concurrent.result @@ -9,13 +9,8 @@ master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../s master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`c1`) ;file_id=# DROP TABLE t1; -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; -reset master; +include/master-slave.inc +[connection master] select last_insert_id(); last_insert_id() 0 @@ -43,32 +38,27 @@ drop table t3; create table t1(a int, b int, unique(b)); insert into t1 values(1,10); load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1; -set global sql_slave_skip_counter=1; -start slave; -Last_SQL_Errno=0 -Last_SQL_Error - +include/wait_for_slave_sql_error_and_skip.inc [errno=1062] +include/check_slave_no_error.inc set sql_log_bin=0; delete from t1; set sql_log_bin=1; load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1; -stop slave; +include/wait_for_slave_sql_error.inc [errno=1062] +include/stop_slave_io.inc change master to master_user='test'; change master to master_user='root'; -Last_SQL_Errno=0 -Last_SQL_Error - +include/check_slave_no_error.inc set global sql_slave_skip_counter=1; start slave; set sql_log_bin=0; delete from t1; set sql_log_bin=1; load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1; +include/wait_for_slave_sql_error.inc [errno=1062] stop slave; reset slave; -Last_SQL_Errno=0 -Last_SQL_Error - +include/check_slave_no_error.inc reset master; create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), unique(day)) engine=MyISAM; @@ -91,18 +81,15 @@ load data CONCURRENT infile '../../std_data/rpl_loaddata2.dat' into table t2 fie terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; ERROR 23000: Duplicate entry '2003-03-22' for key 'day' +include/wait_for_slave_sql_to_stop.inc drop table t1, t2; +include/stop_slave_io.inc drop table t1, t2; CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; LOAD DATA CONCURRENT INFILE "../../std_data/words.dat" INTO TABLE t1; ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY' DROP TABLE IF EXISTS t1; -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; +include/rpl_reset.inc drop database if exists b48297_db1; drop database if exists b42897_db2; create database b48297_db1; @@ -123,15 +110,10 @@ LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1; ### disconnect and switch back to master connection use b48297_db1; -Comparing tables master:b48297_db1.t1 and slave:b48297_db1.t1 +include/diff_tables.inc [master:b48297_db1.t1, slave:b48297_db1.t1] DROP DATABASE b48297_db1; DROP DATABASE b42897_db2; -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; +include/rpl_reset.inc use test; CREATE TABLE t1 (`key` TEXT, `text` TEXT); LOAD DATA INFILE '../../std_data/loaddata2.dat' REPLACE INTO TABLE `t1` FIELDS TERMINATED BY ','; @@ -143,3 +125,4 @@ Field 3 'Field 4' 'Field 5' 'Field 6' Field 6 'Field 7' DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result index 9acc1ad93ac..a81813de19f 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result @@ -1,14 +1,9 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT, b INT); INSERT INTO t1 VALUES (1,10); LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Fatal error: Not enough memory -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1593] +Last_SQL_Error = 'Fatal error: Not enough memory' DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_loaddata_m.result index a1294d515fa..ad9fb6e0896 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_m.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_m.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest; USE test; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); @@ -37,3 +33,4 @@ COUNT(*) 2 DROP DATABASE mysqltest; DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_map.result b/mysql-test/suite/rpl/r/rpl_loaddata_map.result index 91624b15ef8..ca6271012dc 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_map.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_map.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Create a big file ==== ==== Load our big file into a table ==== create table t2 (id int not null primary key auto_increment); @@ -29,3 +25,4 @@ count(*) ==== Clean up ==== [on master] drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_s.result b/mysql-test/suite/rpl/r/rpl_loaddata_s.result index 779a3af9631..351c5b584c5 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_s.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_s.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] reset master; create table test.t1(a int, b int, unique(b)); load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; @@ -13,3 +9,4 @@ count(*) show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info drop table test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result index 5e3923616ed..24a1a35470d 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (word CHAR(20) NOT NULL); LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word; @@ -151,3 +147,4 @@ Abernathy aberrant aberration drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_symlink.result b/mysql-test/suite/rpl/r/rpl_loaddata_symlink.result index c7806f5ecce..c3b3c2232a6 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_symlink.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_symlink.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int not null auto_increment, b int, primary key(a) ); load data infile '../../std_data/rpl_loaddata.dat' into table t1; select * from t1; @@ -15,3 +11,4 @@ a b 1 10 2 15 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result index 6dccaa3d74c..37936871993 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int); select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; truncate table t1; @@ -82,3 +78,4 @@ LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; DROP TABLE t1; SET SESSION sql_mode=@old_mode; [slave] +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loadfile.result b/mysql-test/suite/rpl/r/rpl_loadfile.result index 22f65c0b5e5..640d1f72bf5 100644 --- a/mysql-test/suite/rpl/r/rpl_loadfile.result +++ b/mysql-test/suite/rpl/r/rpl_loadfile.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); @@ -225,11 +221,7 @@ aberration DROP PROCEDURE IF EXISTS test.p1; DROP TABLE test.t1; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc SELECT repeat('x',20) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_39701.data'; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (t text); @@ -240,6 +232,7 @@ END| include/stop_slave.inc CALL p('MYSQLTEST_VARDIR/tmp/bug_39701.data'); include/start_slave.inc -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; DROP PROCEDURE p; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_locale.result b/mysql-test/suite/rpl/r/rpl_locale.result index b7396084663..1f6bd40cd16 100644 --- a/mysql-test/suite/rpl/r/rpl_locale.result +++ b/mysql-test/suite/rpl/r/rpl_locale.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (s1 char(10)); set lc_time_names= 'de_DE'; insert into t1 values (date_format('2001-01-01','%W')); @@ -18,3 +14,4 @@ s1 Montag Monday drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result index 3a52029fa4e..58d0e202110 100644 --- a/mysql-test/suite/rpl/r/rpl_log_pos.result +++ b/mysql-test/suite/rpl/r/rpl_log_pos.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table if not exists t1 (n int); drop table t1; call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary"); @@ -14,8 +10,9 @@ master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB> include/stop_slave.inc change master to master_log_pos=MASTER_LOG_POS; start slave; -Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master' -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1236] +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'' +include/stop_slave_sql.inc show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB> @@ -32,3 +29,4 @@ n 3 drop table t1; End of 5.0 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result index 9061abca477..23238d9c97b 100644 --- a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result +++ b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result @@ -1,21 +1,18 @@ -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; +include/master-slave.inc +[connection master] FLUSH LOGS; CREATE TABLE t1(c1 INT); FLUSH LOGS; call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log'); -Last_IO_Error -Got fatal error 1236 from master when reading data from binary log: 'could not find next log' +include/wait_for_slave_io_error.inc [errno=1236] +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log'' CREATE TABLE t2(c1 INT); FLUSH LOGS; CREATE TABLE t3(c1 INT); FLUSH LOGS; CREATE TABLE t4(c1 INT); START SLAVE IO_THREAD; +include/wait_for_slave_io_to_start.inc SHOW TABLES; Tables_in_test t1 @@ -23,3 +20,4 @@ t2 t3 t4 DROP TABLE t1, t2, t3, t4; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_many_optimize.result b/mysql-test/suite/rpl/r/rpl_many_optimize.result index b2148892591..53be9b48c7b 100644 --- a/mysql-test/suite/rpl/r/rpl_many_optimize.result +++ b/mysql-test/suite/rpl/r/rpl_many_optimize.result @@ -1,9 +1,6 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int not null auto_increment primary key, b int, key(b)); INSERT INTO t1 (a) VALUES (1),(2); drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result index edcae6e7506..bf4347757f7 100644 --- a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result +++ b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] select master_pos_wait('master-bin.999999',0,2); master_pos_wait('master-bin.999999',0,2) -1 @@ -22,3 +18,4 @@ show slave status; select master_pos_wait('foo', 98); master_pos_wait('foo', 98) NULL +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_misc_functions.result b/mysql-test/suite/rpl/r/rpl_misc_functions.result index 6d69235927e..c8f294a7558 100644 --- a/mysql-test/suite/rpl/r/rpl_misc_functions.result +++ b/mysql-test/suite/rpl/r/rpl_misc_functions.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); create table t1(id int, i int, r1 int, r2 int, p varchar(100)); insert into t1 values(1, connection_id(), 0, 0, ""); @@ -54,3 +50,4 @@ DROP TABLE t1, t1_slave; DROP PROCEDURE test_replication_sp1; DROP PROCEDURE test_replication_sp2; DROP FUNCTION test_replication_sf; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result b/mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result index f1b0b2ae5cb..2b5b31201cb 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8; CREATE TABLE t1 (`bit_key` bit, `bit` bit, key (`bit_key` )) ENGINE=MyISAM; CREATE TABLE t2 (`bit_key` bit(4), `bit` bit, key (`bit_key` )) ENGINE=MyISAM; @@ -30,3 +26,4 @@ DELETE FROM `t7` WHERE `bit` < 2 LIMIT 4; INSERT INTO `t8` ( `bit` ) VALUES ( 0 ); DELETE FROM `t8` WHERE `bit` < 2 LIMIT 4; DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result index 308e6a05151..3ebcd64436b 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (n int auto_increment primary key); set insert_id = 2000; insert into t1 values (NULL),(NULL),(NULL); @@ -45,3 +41,4 @@ t5 CREATE TABLE `t5` ( `created` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t2,t3,t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_delete.result b/mysql-test/suite/rpl/r/rpl_multi_delete.result index 4831502eb88..ea1d87a3960 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_delete.result +++ b/mysql-test/suite/rpl/r/rpl_multi_delete.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int primary key); create table t2 (a int); insert into t1 values (1); @@ -20,3 +16,4 @@ select * from t2; a 1 drop table t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_delete2.result b/mysql-test/suite/rpl/r/rpl_multi_delete2.result index 87abe60b268..51112345a1d 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_delete2.result +++ b/mysql-test/suite/rpl/r/rpl_multi_delete2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set sql_log_bin=0; create database mysqltest_from; set sql_log_bin=1; @@ -42,3 +38,4 @@ set sql_log_bin=0; drop database mysqltest_from; set sql_log_bin=1; drop database mysqltest_to; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_engine.result b/mysql-test/suite/rpl/r/rpl_multi_engine.result index e26777c15ce..7815fa88c93 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_engine.result +++ b/mysql-test/suite/rpl/r/rpl_multi_engine.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1; CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT @@ -360,3 +356,4 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_update.result b/mysql-test/suite/rpl/r/rpl_multi_update.result index 524278be042..8634e86afed 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_update.result +++ b/mysql-test/suite/rpl/r/rpl_multi_update.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned @@ -25,3 +21,4 @@ a b 2 1 UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a; drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_update2.result b/mysql-test/suite/rpl/r/rpl_multi_update2.result index 5bb262764fa..a3cab693322 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_update2.result +++ b/mysql-test/suite/rpl/r/rpl_multi_update2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1,t2; CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, @@ -53,3 +49,4 @@ select * from t1; a 3 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_update3.result b/mysql-test/suite/rpl/r/rpl_multi_update3.result index dba7f770ba2..6b9ec5c3947 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_update3.result +++ b/mysql-test/suite/rpl/r/rpl_multi_update3.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] -------- Test for BUG#9361 -------- CREATE TABLE t1 ( @@ -195,3 +191,4 @@ idpro price nbprice 2 1.0000 2 3 2.0000 1 DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_update4.result b/mysql-test/suite/rpl/r/rpl_multi_update4.result index f6dde65a35d..0c4857bed60 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_update4.result +++ b/mysql-test/suite/rpl/r/rpl_multi_update4.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists d1; drop database if exists d2; drop database if exists d2; @@ -23,3 +19,4 @@ id 0 drop database d1; drop database d2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result index 09a9121d22c..5187cb0344d 100644 --- a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result +++ b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result @@ -1,13 +1,11 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS `#mysql50#mysqltest-1`; CREATE DATABASE `#mysql50#mysqltest-1`; Master position is not changed STOP SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_stop.inc Master position has been changed DROP DATABASE `mysqltest-1`; DROP DATABASE `#mysql50#mysqltest-1`; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_name_const.result b/mysql-test/suite/rpl/r/rpl_name_const.result index acb2684d2c8..89a48bad09b 100644 --- a/mysql-test/suite/rpl/r/rpl_name_const.result +++ b/mysql-test/suite/rpl/r/rpl_name_const.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialize ==== [on master] create table t1 (id int); @@ -26,3 +22,4 @@ id [on master] drop table t1; drop procedure test_procedure; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result b/mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result index 3b9b741e040..0b5673a383c 100644 --- a/mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result +++ b/mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); CREATE TABLE t1 (a VARCHAR(1000)); INSERT INTO t1 VALUES (CONNECTION_ID()); @@ -23,5 +19,6 @@ INSERT INTO t1 VALUES (UTC_TIMESTAMP()); INSERT INTO t1 VALUES (RAND()); INSERT INTO t1 VALUES (LAST_INSERT_ID()); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_not_null_innodb.result b/mysql-test/suite/rpl/r/rpl_not_null_innodb.result index b09fbab905a..1eaeaba05bb 100644 --- a/mysql-test/suite/rpl/r/rpl_not_null_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_not_null_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET SQL_LOG_BIN= 0; CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, `c` INT DEFAULT NULL, @@ -45,8 +41,8 @@ INSERT INTO t4(a,c) VALUES (4, 4); INSERT INTO t4(a) VALUES (5); ************* SHOWING THE RESULT SETS WITH INSERTS ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] TABLES t2 and t3 must be different. SELECT * FROM t3 ORDER BY a; a b @@ -80,7 +76,7 @@ UPDATE t1 set b= NULL, c= 300 where a= 1; REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300); ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ************* CLEANING ************* DROP TABLE t1; DROP TABLE t2; @@ -122,7 +118,7 @@ UPDATE t1 set b= NULL, c= b'00' where a= 1; REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00'); ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ################################################################################ # NULL ---> NOT NULL (STRICT MODE) @@ -200,3 +196,4 @@ a b c DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_not_null_myisam.result b/mysql-test/suite/rpl/r/rpl_not_null_myisam.result index 09611dc6480..ec17e3bfafa 100644 --- a/mysql-test/suite/rpl/r/rpl_not_null_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_not_null_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET SQL_LOG_BIN= 0; CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, `c` INT DEFAULT NULL, @@ -45,8 +41,8 @@ INSERT INTO t4(a,c) VALUES (4, 4); INSERT INTO t4(a) VALUES (5); ************* SHOWING THE RESULT SETS WITH INSERTS ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] TABLES t2 and t3 must be different. SELECT * FROM t3 ORDER BY a; a b @@ -80,7 +76,7 @@ UPDATE t1 set b= NULL, c= 300 where a= 1; REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300); ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ************* CLEANING ************* DROP TABLE t1; DROP TABLE t2; @@ -122,7 +118,7 @@ UPDATE t1 set b= NULL, c= b'00' where a= 1; REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00'); ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ################################################################################ # NULL ---> NOT NULL (STRICT MODE) @@ -200,3 +196,4 @@ a b c DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_optimize.result b/mysql-test/suite/rpl/r/rpl_optimize.result index 8c4bcf48a65..d3398556f59 100644 --- a/mysql-test/suite/rpl/r/rpl_optimize.result +++ b/mysql-test/suite/rpl/r/rpl_optimize.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop tables if exists t1; CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); create table t1 (a int not null auto_increment primary key, b int, key(b)); @@ -27,3 +23,4 @@ optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_packet.result b/mysql-test/suite/rpl/r/rpl_packet.result index 1ec9259a1fb..9239a718504 100644 --- a/mysql-test/suite/rpl/r/rpl_packet.result +++ b/mysql-test/suite/rpl/r/rpl_packet.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153"); call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:"); drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; @@ -33,22 +29,15 @@ include/stop_slave.inc include/start_slave.inc CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); -Slave_IO_Running = No (expect No) -SELECT "Got a packet bigger than 'max_allowed_packet' bytes" AS Last_IO_Error; -Last_IO_Error -Got a packet bigger than 'max_allowed_packet' bytes -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; +include/wait_for_slave_io_error.inc [errno=1153] +Last_IO_Error = 'Got a packet bigger than 'max_allowed_packet' bytes' +include/stop_slave_sql.inc +include/rpl_reset.inc +DROP TABLE t1; CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet)); -Slave_IO_Running = No (expect No) -SELECT "Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'" AS Last_IO_Error; -Last_IO_Error -Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master' +include/wait_for_slave_io_error.inc [errno=1236] +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'' STOP SLAVE; RESET SLAVE; RESET MASTER; @@ -62,3 +51,5 @@ DROP TABLE t1; SET @@global.max_allowed_packet= 1024; SET @@global.net_buffer_length= 1024; DROP TABLE t1; +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_plugin_load.result b/mysql-test/suite/rpl/r/rpl_plugin_load.result index 43e171a97c9..b33e29ef668 100644 --- a/mysql-test/suite/rpl/r/rpl_plugin_load.result +++ b/mysql-test/suite/rpl/r/rpl_plugin_load.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] Verify that example engine is not installed. SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE'; ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS @@ -33,4 +29,5 @@ Delta Verify that example engine is not installed. SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE'; ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +include/rpl_end.inc End of test diff --git a/mysql-test/suite/rpl/r/rpl_ps.result b/mysql-test/suite/rpl/r/rpl_ps.result index 89e822b3eb6..6e110227782 100644 --- a/mysql-test/suite/rpl/r/rpl_ps.result +++ b/mysql-test/suite/rpl/r/rpl_ps.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1; create table t1(n char(30)); prepare stmt1 from 'insert into t1 values (?)'; @@ -33,49 +29,22 @@ stop slave; # statement breaks binlog. # ######################################################################## - # Connection: slave - - START SLAVE; - # Connection: master - - CREATE DATABASE mysqltest1; CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32)); - PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)'; - EXECUTE stmt_d_1; - use mysqltest1; - EXECUTE stmt_d_1; - - # Connection: slave - - SELECT * FROM t1; db_name db_col_name test latin1_swedish_ci test latin1_swedish_ci - # Connection: master - - DROP DATABASE mysqltest1; - use test; DROP TABLE t1; - - -# Connection: slave - - -STOP SLAVE; - -######################################################################## -reset master; -reset slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result index 6bb9b139057..e5d722a841f 100644 --- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result +++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET @old_binlog_format= @@global.binlog_format; SET BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; @@ -33,3 +29,4 @@ slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT DROP TABLE IF EXISTS t1; SET @@global.binlog_format= @old_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_read_only.result b/mysql-test/suite/rpl/r/rpl_read_only.result index 6b1404b4f68..37bdc09a8c0 100644 --- a/mysql-test/suite/rpl/r/rpl_read_only.result +++ b/mysql-test/suite/rpl/r/rpl_read_only.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create user test; create table t1(a int) engine=InnoDB; create table t2(a int) engine=MyISAM; @@ -114,3 +110,4 @@ drop user test; drop table t1; drop table t2; set global read_only=0; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result b/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result index 54aac2eca35..4f10ac50f9a 100644 --- a/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 @@ -23,3 +19,4 @@ Andy 31 00000001 Jacob 2 00000002 Caleb 1 00000003 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result b/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result index e8d2d63e46e..4c1a50b2f33 100644 --- a/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 @@ -23,3 +19,4 @@ Andy 31 00000001 Jacob 2 00000002 Caleb 1 00000003 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_relayrotate.result b/mysql-test/suite/rpl/r/rpl_relayrotate.result index 20f19973d83..ea00aee0085 100644 --- a/mysql-test/suite/rpl/r/rpl_relayrotate.result +++ b/mysql-test/suite/rpl/r/rpl_relayrotate.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] stop slave; create table t1 (a int) engine=innodb; reset slave; @@ -14,3 +10,4 @@ select max(a) from t1; max(a) 8000 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_relayspace.result b/mysql-test/suite/rpl/r/rpl_relayspace.result index bb4e672e7e5..ff217af6431 100644 --- a/mysql-test/suite/rpl/r/rpl_relayspace.result +++ b/mysql-test/suite/rpl/r/rpl_relayspace.result @@ -1,19 +1,19 @@ +include/master-slave.inc +[connection master] 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; -stop slave; +include/wait_for_slave_to_stop.inc create table t1 (a int); drop table t1; create table t1 (a int); drop table t1; reset slave; start slave io_thread; +include/wait_for_slave_param.inc [Slave_IO_State] stop slave io_thread; +include/wait_for_slave_io_to_stop.inc reset slave; start slave; select master_pos_wait('MASTER_LOG_FILE',200,30)=-1; master_pos_wait('MASTER_LOG_FILE',200,30)=-1 0 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result index 637047a883b..6f85fc15b1e 100644 --- a/mysql-test/suite/rpl/r/rpl_replicate_do.result +++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t11; drop table if exists t11; create table t2 (n int); @@ -26,7 +22,7 @@ n select * from t11; ERROR 42S02: Table 'test.t11' doesn't exist drop table if exists t1,t2,t11; -Replicate_Do_Table test.t1 +Replicate_Do_Table = 'test.t1' create table t1 (ts timestamp); set one_shot time_zone='met'; insert into t1 values('2005-08-12 00:00:00'); @@ -73,3 +69,4 @@ Trigger Event Table Statement Timing Created sql_mode Definer character_set_clie *** master *** drop table t1; drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result b/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result index 0135804c02d..f0c46b0b966 100644 --- a/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result +++ b/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; drop database if exists mysqltest2; create database mysqltest1; @@ -21,3 +17,4 @@ a 1 drop database mysqltest1; drop database mysqltest2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_report.result b/mysql-test/suite/rpl/r/rpl_report.result index e129d7c8f22..b979d1faf5d 100644 --- a/mysql-test/suite/rpl/r/rpl_report.result +++ b/mysql-test/suite/rpl/r/rpl_report.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_host'; VARIABLE_NAME VARIABLE_VALUE REPORT_HOST 127.0.0.1 @@ -31,3 +27,4 @@ Value my_password set @@global.report_host='my.new.address.net'; ERROR HY000: Variable 'report_host' is a read only variable end of tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result index dae72d83b51..12071faecfd 100644 --- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result +++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; @@ -219,3 +215,4 @@ DROP DATABASE database_slave_temp_01; DROP DATABASE database_slave_temp_02; DROP DATABASE database_slave_temp_03; SET sql_log_bin= 1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result index b50c7cebcab..e41f56c0a71 100644 --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result @@ -1,5 +1,3 @@ -drop table if exists t1, t2, t3, t4; -drop table if exists t1, t2, t3, t4; start slave; Got one of the listed errors start slave; @@ -14,9 +12,9 @@ create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables"); create table t1 (s text); insert into t1 values('Could not break slave'),('Tried hard'); -Master_Log_File master-bin.000001 -Relay_Master_Log_File master-bin.000001 -Checking that both slave threads are running. +Master_Log_File = 'master-bin.000001' +Relay_Master_Log_File = 'master-bin.000001' +include/check_slave_is_running.inc select * from t1; s Could not break slave @@ -38,8 +36,7 @@ drop table temp_table, t3; insert into t2 values(1234); set insert_id=1234; insert into t2 values(NULL); -set global sql_slave_skip_counter=1; -start slave; +include/wait_for_slave_sql_error_and_skip.inc [errno=1062] purge master logs to 'master-bin.000002'; show master logs; Log_name master-bin.000002 @@ -57,9 +54,9 @@ show binary logs; Log_name File_size master-bin.000003 # insert into t2 values (65); -Master_Log_File master-bin.000003 -Relay_Master_Log_File master-bin.000003 -Checking that both slave threads are running. +Master_Log_File = 'master-bin.000003' +Relay_Master_Log_File = 'master-bin.000003' +include/check_slave_is_running.inc select * from t2; m 34 @@ -85,9 +82,9 @@ master-bin.000005 # <Binlog_Do_DB> <Binlog_Ignore_DB> select * from t4; a testing temporary tables part 2 -Master_Log_File master-bin.000005 -Relay_Master_Log_File master-bin.000005 -Checking that both slave threads are running. +Master_Log_File = 'master-bin.000005' +Relay_Master_Log_File = 'master-bin.000005' +include/check_slave_is_running.inc lock tables t3 read; select count(*) from t3 where n >= 4; count(*) @@ -102,3 +99,5 @@ show binlog events in ''; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log purge master logs before now(); End of 5.0 tests +include/stop_slave.inc +CHANGE MASTER TO MASTER_HOST = ''; diff --git a/mysql-test/suite/rpl/r/rpl_row_001.result b/mysql-test/suite/rpl/r/rpl_row_001.result index 0d682eb82e1..b5f6aea9698 100644 --- a/mysql-test/suite/rpl/r/rpl_row_001.result +++ b/mysql-test/suite/rpl/r/rpl_row_001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (word CHAR(20) NOT NULL); LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; @@ -53,3 +49,4 @@ SELECT n FROM t1; n 3456 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_4_bytes.result b/mysql-test/suite/rpl/r/rpl_row_4_bytes.result index e2431364ed3..ef9602204a1 100644 --- a/mysql-test/suite/rpl/r/rpl_row_4_bytes.result +++ b/mysql-test/suite/rpl/r/rpl_row_4_bytes.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; @@ -25,3 +21,4 @@ ABE ANG LIL DROP DATABASE mysqltest1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_NOW.result b/mysql-test/suite/rpl/r/rpl_row_NOW.result index 23f95878608..eb6271d6e93 100644 --- a/mysql-test/suite/rpl/r/rpl_row_NOW.result +++ b/mysql-test/suite/rpl/r/rpl_row_NOW.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create database if not exists mysqltest1; DROP TABLE IF EXISTS mysqltest1.t1; CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, @@ -27,3 +23,4 @@ INSERT INTO mysqltest1.t1 SET n = NULL, a = now(); DROP TABLE IF EXISTS mysqltest1.t1; DROP FUNCTION mysqltest1.f1; DROP DATABASE mysqltest1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_USER.result b/mysql-test/suite/rpl/r/rpl_row_USER.result index 98755fb4653..5298395da20 100644 --- a/mysql-test/suite/rpl/r/rpl_row_USER.result +++ b/mysql-test/suite/rpl/r/rpl_row_USER.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS mysqltest1; CREATE DATABASE mysqltest1; CREATE USER tester IDENTIFIED BY 'test'; @@ -36,3 +32,4 @@ REVOKE ALL ON mysqltest1.* FROM 'tester'@'%'; REVOKE ALL ON mysqltest1.* FROM ''@'localhost%'; DROP USER tester@'%'; DROP USER ''@'localhost%'; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_UUID.result b/mysql-test/suite/rpl/r/rpl_row_UUID.result index 02174a7ecae..b7d3f8914e0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_UUID.result +++ b/mysql-test/suite/rpl/r/rpl_row_UUID.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=myisam; @@ -38,3 +34,4 @@ DROP PROCEDURE test.p1; DROP FUNCTION test.fn1; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result index 34405b9cbba..0ece93e7aa5 100644 --- a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result +++ b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ######################################################################## # TABLES ON MASTER ######################################################################## @@ -142,3 +138,4 @@ a b # No Annotate_rows events should appear below ######################################################################## FLUSH LOGS; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result index 0c04c6abf61..8463256d5db 100644 --- a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result +++ b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ######################################################################## # TABLES ON MASTER ######################################################################## @@ -124,3 +120,4 @@ a b # No Annotate_rows events should appear below ######################################################################## FLUSH LOGS; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result index 458ae53e79c..d13d6722dc7 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result @@ -1,9 +1,6 @@ -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; +include/master-slave.inc +[connection master] +call mtr.add_suppression("Can't find record in 't.'"); CREATE DATABASE test_ignore; **** On Master **** SHOW DATABASES; @@ -27,6 +24,10 @@ t2 INSERT INTO t2 VALUES (3,3), (4,4); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (mtr.test_suppressions) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT) master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) @@ -46,11 +47,10 @@ t1 USE test_ignore; ERROR 42000: Unknown database 'test_ignore' DROP DATABASE test_ignore; -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; +USE test; +DROP TABLE t1; +USE test; +include/rpl_reset.inc CREATE TABLE t1 (a INT); DELETE FROM t1; INSERT INTO t1 VALUES (1),(2); @@ -65,11 +65,7 @@ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT DROP TABLE t1; ================ Test for BUG#17620 ================ -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; +include/rpl_reset.inc **** On Slave **** SET GLOBAL QUERY_CACHE_SIZE=0; **** On Master **** @@ -103,12 +99,9 @@ a 8 9 SET GLOBAL QUERY_CACHE_SIZE=0; +DROP TABLE t1; ================ Test for BUG#22550 ================ -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; +include/rpl_reset.inc CREATE TABLE t1 (a BIT(1), b INT) ENGINE=MYISAM; INSERT INTO t1 VALUES(1,2); SELECT HEX(a),b FROM t1; @@ -126,11 +119,7 @@ HEX(a) b 0 2 DROP TABLE IF EXISTS t1; ================ Test for BUG#22583 ================ -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; +include/rpl_reset.inc **** On Master **** CREATE TABLE t1_myisam (k INT, a BIT(1), b BIT(9)) ENGINE=MYISAM; CREATE TABLE t1_innodb (k INT, a BIT(1), b BIT(9)) ENGINE=INNODB; @@ -247,13 +236,8 @@ a b 3 1 4 4 drop table t1,t2; -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; +include/rpl_reset.inc **** On Master **** -SET SESSION BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT PRIMARY KEY, b SET('master','slave')); INSERT INTO t1 VALUES (1,'master,slave'), (2,'master,slave'); **** On Slave **** @@ -277,6 +261,6 @@ SELECT * FROM t1 ORDER BY a; a b 2 master,slave 5 slave -DROP TABLE t1; **** On Master **** DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result index a247c3a6039..7afc70bfa5c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'MYISAM' ; SELECT * FROM t1; C1 C2 @@ -422,11 +418,7 @@ a b c **** Test for BUG#31552 **** **** On Master **** DELETE FROM t1; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc **** On Master **** INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); **** On Master **** @@ -436,7 +428,7 @@ DELETE FROM t1; SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 set @@global.slave_exec_mode= default; -Checking that both slave threads are running. +include/check_slave_is_running.inc SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 **** Test for BUG#37076 **** @@ -478,50 +470,44 @@ j INT NOT NULL) ENGINE = 'MYISAM' ; [expecting slave to replicate correctly] INSERT INTO t1 VALUES (1, "", 1); INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] [expecting slave to replicate correctly] INSERT INTO t2 VALUES (1, "", 1); INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] [expecting slave to stop] INSERT INTO t3 VALUES (1, "", 1); INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t4 VALUES (1, "", 1); INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2); -Comparing tables master:test.t4 and slave:test.t4 +include/diff_tables.inc [master:t4, slave:t4] [expecting slave to stop] INSERT INTO t5 VALUES (1, "", 1); INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to stop] INSERT INTO t6 VALUES (1, "", 1); INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t7 VALUES (1, "", 1); INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2); -Comparing tables master:test.t7 and slave:test.t7 +include/diff_tables.inc [master:t7, slave:t7] drop table t1, t2, t3, t4, t5, t6, t7; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE='MYISAM' ; INSERT INTO t1 VALUES (1), (2), (3); UPDATE t1 SET a = 10; ERROR 23000: Duplicate entry '10' for key 'PRIMARY' INSERT INTO t1 VALUES (4); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( @@ -575,7 +561,7 @@ ERROR 23000: Duplicate entry '6' for key 'PRIMARY' DELETE FROM t2 WHERE `pk` < 7 LIMIT 1; UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6; *** results: t2 must be consistent **** -Comparing tables master:test.t2 and master:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1, t2; EOF OF TESTS CREATE TABLE t1 (a int) ENGINE='MYISAM' ; @@ -591,7 +577,7 @@ UPDATE t1 SET a = 9 WHERE a < 3; INSERT INTO t1 ( a ) VALUES ( 3 ); UPDATE t1 SET a = 0 WHERE a < 4; UPDATE t1 SET a = 8 WHERE a < 5; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; CREATE TABLE t1 (a bit) ENGINE='MYISAM' ; INSERT IGNORE INTO t1 VALUES (NULL); @@ -633,5 +619,6 @@ DELETE FROM t1 WHERE a < 3 LIMIT 0; UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2; INSERT INTO t1 ( a ) VALUES ( 1 ); UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result index fefe8e969dc..b8620894bd1 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'INNODB' ; SELECT * FROM t1; C1 C2 @@ -422,11 +418,7 @@ a b c **** Test for BUG#31552 **** **** On Master **** DELETE FROM t1; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc **** On Master **** INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); **** On Master **** @@ -436,7 +428,7 @@ DELETE FROM t1; SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 set @@global.slave_exec_mode= default; -Checking that both slave threads are running. +include/check_slave_is_running.inc SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 **** Test for BUG#37076 **** @@ -478,50 +470,44 @@ j INT NOT NULL) ENGINE = 'INNODB' ; [expecting slave to replicate correctly] INSERT INTO t1 VALUES (1, "", 1); INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] [expecting slave to replicate correctly] INSERT INTO t2 VALUES (1, "", 1); INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] [expecting slave to stop] INSERT INTO t3 VALUES (1, "", 1); INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t4 VALUES (1, "", 1); INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2); -Comparing tables master:test.t4 and slave:test.t4 +include/diff_tables.inc [master:t4, slave:t4] [expecting slave to stop] INSERT INTO t5 VALUES (1, "", 1); INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to stop] INSERT INTO t6 VALUES (1, "", 1); INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t7 VALUES (1, "", 1); INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2); -Comparing tables master:test.t7 and slave:test.t7 +include/diff_tables.inc [master:t7, slave:t7] drop table t1, t2, t3, t4, t5, t6, t7; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE='INNODB' ; INSERT INTO t1 VALUES (1), (2), (3); UPDATE t1 SET a = 10; ERROR 23000: Duplicate entry '10' for key 'PRIMARY' INSERT INTO t1 VALUES (4); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( @@ -575,7 +561,7 @@ ERROR 23000: Duplicate entry '6' for key 'PRIMARY' DELETE FROM t2 WHERE `pk` < 7 LIMIT 1; UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6; *** results: t2 must be consistent **** -Comparing tables master:test.t2 and master:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1, t2; EOF OF TESTS CREATE TABLE t1 (a int) ENGINE='INNODB' ; @@ -591,7 +577,7 @@ UPDATE t1 SET a = 9 WHERE a < 3; INSERT INTO t1 ( a ) VALUES ( 3 ); UPDATE t1 SET a = 0 WHERE a < 4; UPDATE t1 SET a = 8 WHERE a < 5; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; CREATE TABLE t1 (a bit) ENGINE='INNODB' ; INSERT IGNORE INTO t1 VALUES (NULL); @@ -633,5 +619,6 @@ DELETE FROM t1 WHERE a < 3 LIMIT 0; UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2; INSERT INTO t1 ( a ) VALUES ( 1 ); UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result index 3443e704031..c7241c52353 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; SET @@BINLOG_FORMAT = ROW; SELECT @@BINLOG_FORMAT; @@ -717,3 +713,4 @@ COUNT(*) 4 DELETE FROM t1; DROP TABLE IF EXISTS t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result b/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result index 055efffbd6a..4fb33dc4b6b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; ***** Table Create Section **** @@ -154,3 +150,4 @@ c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result b/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result index 055efffbd6a..4fb33dc4b6b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; ***** Table Create Section **** @@ -154,3 +150,4 @@ c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_colSize.result b/mysql-test/suite/rpl/r/rpl_row_colSize.result index 417bc65641a..49753d2b25c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_colSize.result +++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; **** Testing WL#3228 changes. **** *** Create "wider" table on slave *** @@ -18,7 +14,8 @@ CREATE TABLE t1 (a DECIMAL(20, 10)); RESET MASTER; INSERT INTO t1 VALUES (901251.90125); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -34,7 +31,8 @@ CREATE TABLE t1 (a DECIMAL(27, 18)); RESET MASTER; INSERT INTO t1 VALUES (901251.90125); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 12, test.t1 on slave has size 12. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 12, test.t1 on slave has size 12. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -50,7 +48,8 @@ CREATE TABLE t1 (a NUMERIC(20, 10)); RESET MASTER; INSERT INTO t1 VALUES (901251.90125); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -67,7 +66,8 @@ CREATE TABLE t1 (a FLOAT(47)); RESET MASTER; INSERT INTO t1 VALUES (901251.90125); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4 +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -84,7 +84,8 @@ CREATE TABLE t1 (a BIT(64)); RESET MASTER; INSERT INTO t1 VALUES (B'10101'); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 8, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 8, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -100,7 +101,8 @@ CREATE TABLE t1 (a BIT(12)); RESET MASTER; INSERT INTO t1 VALUES (B'10101'); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 2. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 2. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -117,7 +119,8 @@ CREATE TABLE t1 (a SET('1','2','3','4','5','6','7','8','9')); RESET MASTER; INSERT INTO t1 VALUES ('4'); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -134,7 +137,8 @@ CREATE TABLE t1 (a CHAR(20)); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 20, test.t1 on slave has size 11. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 20, test.t1 on slave has size 11. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -182,7 +186,8 @@ CREATE TABLE t1 (a ENUM( RESET MASTER; INSERT INTO t1 VALUES ('44'); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -199,7 +204,8 @@ CREATE TABLE t1 (a VARCHAR(2000)); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 100. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 100. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -215,7 +221,8 @@ CREATE TABLE t1 (a VARCHAR(200)); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 200, test.t1 on slave has size 10. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 200, test.t1 on slave has size 10. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -231,7 +238,8 @@ CREATE TABLE t1 (a VARCHAR(2000)); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 1000. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 1000. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -248,7 +256,8 @@ CREATE TABLE t1 (a LONGBLOB); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 size mismatch - master has size 4, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 4, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -258,3 +267,4 @@ RESET MASTER; START SLAVE; *** Cleanup *** DROP TABLE IF EXISTS t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result index 70303bf0159..7ad0c06448e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*"); +call mtr.add_suppression("Can't find record in 't.'"); [on slave] SET @old_slave_exec_mode= @@global.slave_exec_mode; ######## Run with slave_exec_mode=STRICT ######## @@ -24,6 +21,7 @@ a 1 [on slave] ---- Wait until slave stops with an error ---- +include/wait_for_slave_sql_error.inc [errno=1062] Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 480 (expected "duplicate key" error) SELECT * FROM t1; a @@ -31,6 +29,7 @@ a ---- Resolve the conflict on the slave and restart SQL thread ---- DELETE FROM t1 WHERE a = 1; START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc ---- Sync slave and verify that there is no error ---- Last_SQL_Error = '' (expected no error) SELECT * FROM t1; @@ -50,12 +49,15 @@ SELECT * FROM t1; a [on slave] ---- Wait until slave stops with an error ---- -Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 1116 (expected "can't find record" error) +include/wait_for_slave_sql_error.inc [errno=1032] +Last_SQL_Error (expected "duplicate key" error) +Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos END_LOG_POS SELECT * FROM t1; a ---- Resolve the conflict on the slave and restart SQL thread ---- INSERT INTO t1 VALUES (1); START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc ---- Sync slave and verify that there is no error ---- Last_SQL_Error = (expected no error) SELECT * FROM t1; @@ -64,6 +66,7 @@ a [on master] DROP TABLE t1; [on slave] +include/rpl_reset.inc ######## Run with slave_exec_mode=IDEMPOTENT ######## set @@global.slave_exec_mode= 'IDEMPOTENT'; ==== Initialize ==== @@ -107,3 +110,4 @@ a DROP TABLE t1; [on slave] SET @@global.slave_exec_mode= @old_slave_exec_mode; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result index 90b68428008..4575588b1ef 100644 --- a/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result +++ b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int not null primary key) engine=myisam; insert delayed into t1 values (1); insert delayed into t1 values (2); @@ -20,3 +16,4 @@ a 2 3 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_drop.result b/mysql-test/suite/rpl/r/rpl_row_drop.result index 048e07271b3..963a001f70a 100644 --- a/mysql-test/suite/rpl/r/rpl_row_drop.result +++ b/mysql-test/suite/rpl/r/rpl_row_drop.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] **** On Master **** CREATE TABLE t1 (a int); CREATE TABLE t2 (a int); @@ -53,3 +49,4 @@ t2 SHOW TABLES; Tables_in_test t2 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_find_row.result b/mysql-test/suite/rpl/r/rpl_row_find_row.result index 69516b47b7d..fff1f1b0c35 100644 --- a/mysql-test/suite/rpl/r/rpl_row_find_row.result +++ b/mysql-test/suite/rpl/r/rpl_row_find_row.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET SQL_LOG_BIN=0; CREATE TABLE t (a int, b int, c int, key(b)); SET SQL_LOG_BIN=1; @@ -12,27 +8,18 @@ INSERT INTO t VALUES (1,2,4); INSERT INTO t VALUES (4,3,4); DELETE FROM t; DROP TABLE t; -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; +include/rpl_reset.inc CREATE TABLE t (a int, b int, c int, key(b)); ALTER TABLE t DISABLE KEYS; INSERT INTO t VALUES (1,2,4); INSERT INTO t VALUES (4,3,4); DELETE FROM t; DROP TABLE t; -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 INT, UNIQUE KEY(c1,c3), KEY(c2)); INSERT INTO t1(c1,c2) VALUES(1,1); INSERT INTO t1(c1,c2) VALUES(1,2); UPDATE t1 SET c1=1000 WHERE c2=2; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result index fe2fb1d9da2..96d2a337e7c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int) ENGINE=MyISAM; insert into t1 values (10); create table t2 (a int) ENGINE=MyISAM; @@ -21,10 +17,13 @@ flush tables; select * from t3; a stop slave; +include/wait_for_slave_to_stop.inc drop table t1; flush tables with read lock; start slave; +include/wait_for_slave_to_start.inc stop slave; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction unlock tables; drop table t3, t4, t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_func001.result b/mysql-test/suite/rpl/r/rpl_row_func001.result index b20f3f724d0..74a053abb26 100644 --- a/mysql-test/suite/rpl/r/rpl_row_func001.result +++ b/mysql-test/suite/rpl/r/rpl_row_func001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP FUNCTION test.f1; DROP TABLE IF EXISTS test.t1; create table test.t1 (a int, PRIMARY KEY(a)); @@ -28,3 +24,4 @@ a 2 DROP FUNCTION test.f1; DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_func002.result b/mysql-test/suite/rpl/r/rpl_row_func002.result index 03f5b3115c3..69a732048b2 100644 --- a/mysql-test/suite/rpl/r/rpl_row_func002.result +++ b/mysql-test/suite/rpl/r/rpl_row_func002.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP FUNCTION test.f1; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -24,3 +20,4 @@ INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP); DROP FUNCTION test.f1; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_func003.result b/mysql-test/suite/rpl/r/rpl_row_func003.result index 94d01b50ce5..cdc5bf6afba 100644 --- a/mysql-test/suite/rpl/r/rpl_row_func003.result +++ b/mysql-test/suite/rpl/r/rpl_row_func003.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); DROP FUNCTION IF EXISTS test.f1; DROP TABLE IF EXISTS test.t1; @@ -28,3 +24,4 @@ ROLLBACK; SET AUTOCOMMIT=1; DROP FUNCTION test.f1; DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_index_choice.result b/mysql-test/suite/rpl/r/rpl_row_index_choice.result index d04576489af..2d955299e6e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_index_choice.result +++ b/mysql-test/suite/rpl/r/rpl_row_index_choice.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a int, b varchar(100), fulltext(b)) engine=MyISAM; INSERT INTO t1 VALUES (1,"a"), (2,"b"); UPDATE t1 SET b='A' WHERE a=1; @@ -141,3 +137,4 @@ a d DROP TABLE t2; DROP TABLE t1; SET GLOBAL debug=""; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result index 562e3dc2862..148840cc8c5 100644 --- a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result +++ b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Setup table on master but not on slave ==== [on master] CREATE TABLE t1 (a INT); @@ -14,8 +10,10 @@ DROP TABLE t1; INSERT INTO t1 VALUES (1); ==== Verify error on slave ==== [on slave] -Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables +include/wait_for_slave_sql_error.inc [errno=1146] ==== Clean up ==== -include/stop_slave.inc +include/stop_slave_io.inc +RESET SLAVE; [on master] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result b/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result index fa6c8cf9982..4df9b34e37e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result +++ b/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set @old_global_binlog_format = @@global.binlog_format; set @@global.binlog_format = row; CREATE SCHEMA IF NOT EXISTS mysqlslap; @@ -60,3 +56,4 @@ a drop table t1; End of 5.0 tests set @@global.binlog_format = @old_global_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result index 0f648539c47..b88634e2802 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log.result +++ b/mysql-test/suite/rpl/r/rpl_row_log.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] include/stop_slave.inc reset master; reset slave; @@ -240,18 +236,13 @@ slave-bin.000002 # Query # # BEGIN slave-bin.000002 # Table_map # # table_id: # (test.t2) slave-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000002 # Query # # COMMIT -Checking that both slave threads are running. +include/check_slave_is_running.inc show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; -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; +include/rpl_reset.inc create table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); set insert_id=5; @@ -273,3 +264,4 @@ a b 5 1 6 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result index ff189e676cc..6e1eec2056a 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] include/stop_slave.inc reset master; reset slave; @@ -240,18 +236,13 @@ slave-bin.000002 # Query # # BEGIN slave-bin.000002 # Table_map # # table_id: # (test.t2) slave-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000002 # Xid # # COMMIT /* XID */ -Checking that both slave threads are running. +include/check_slave_is_running.inc show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; -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; +include/rpl_reset.inc create table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); set insert_id=5; @@ -273,3 +264,4 @@ a b 5 1 6 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result index db06cb6d3de..871d3218b70 100644 --- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result +++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] stop slave; # # Generate a big enough master's binlog to cause relay log rotations @@ -21,7 +17,7 @@ select @@global.max_relay_log_size; @@global.max_relay_log_size 4096 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 2 # @@ -31,7 +27,7 @@ set global max_relay_log_size=(5*4096); select @@global.max_relay_log_size; @@global.max_relay_log_size 20480 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 3: max_relay_log_size = 0 # @@ -41,7 +37,7 @@ set global max_relay_log_size=0; select @@global.max_relay_log_size; @@global.max_relay_log_size 0 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions # @@ -55,13 +51,13 @@ reset slave; start slave; flush logs; create table t1 (a int); -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated # flush logs; drop table t1; -Checking that both slave threads are running. +include/check_slave_is_running.inc flush logs; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB @@ -70,3 +66,4 @@ set global max_binlog_size= @my_max_binlog_size; # # End of 4.1 tests # +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result index 538764da738..5fee82f6017 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ---Setup Section -- set timestamp=1000000000; @@ -380,3 +376,4 @@ a b 1 1 FLUSH LOGS; DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result b/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result index c461cafbd7c..d9ebb52493b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result @@ -1,46 +1,28 @@ -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; +include/master-slave.inc +[connection master] ## case #1 - last_null_bit_pos==0 in record_compare without X bit -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 ); INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); UPDATE t1 SET c5 = 'a'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit ## (1 column less and no varchar) -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 ); INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); UPDATE t1 SET c5 = 'a'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## case #2 - X bit is wrongly set. -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=InnoDB DEFAULT CHARSET= latin1; INSERT INTO t1(c1) VALUES (10); INSERT INTO t1(c1) VALUES (NULL); UPDATE t1 SET c1= 0; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result b/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result index 38fbe486d2e..e9ffcc927be 100644 --- a/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result @@ -1,60 +1,37 @@ -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; +include/master-slave.inc +[connection master] ## case #1 - last_null_bit_pos==0 in record_compare without X bit -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 ); INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); UPDATE t1 SET c5 = 'a'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit ## (1 column less and no varchar) -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 ); INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); UPDATE t1 SET c5 = 'a'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## case #2 - X bit is wrongly set. -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=MyISAM DEFAULT CHARSET= latin1; INSERT INTO t1(c1) VALUES (10); INSERT INTO t1(c1) VALUES (NULL); UPDATE t1 SET c1= 0; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## coverage purposes - Field_bits ## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==0 -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bit(5)) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO t1(c1,c2) VALUES (10, b'1'); INSERT INTO t1(c1,c2) VALUES (NULL, b'1'); UPDATE t1 SET c1= 0; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result index 7bf09df31ca..be4bc630e3f 100644 --- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result +++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result @@ -1,21 +1,17 @@ -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; -Master_User root -Master_Host 127.0.0.1 +include/master-slave.inc +[connection master] +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc change master to master_user='test'; -Master_User test -Master_Host 127.0.0.1 +Master_User = 'test' +Master_Host = '127.0.0.1' reset slave; -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/start_slave.inc -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc reset slave; include/start_slave.inc @@ -28,13 +24,19 @@ Variable_name Value Slave_open_temp_tables 0 include/stop_slave.inc reset slave; +include/check_slave_no_error.inc change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc change master to master_user='root'; include/start_slave.inc +include/check_slave_no_error.inc include/stop_slave.inc change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc reset slave; +include/check_slave_no_error.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp001.result b/mysql-test/suite/rpl/r/rpl_row_sp001.result index 8c26c061376..17117ce2fac 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp001.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] <Begin test section 1 (non deterministic SP)> --------------------------------------------- @@ -83,3 +79,4 @@ DROP PROCEDURE test.p1; DROP PROCEDURE test.p2; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result b/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result index a42c9af988c..f368cf6e356 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result @@ -1,15 +1,5 @@ -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; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP PROCEDURE IF EXISTS test.p3; -DROP TABLE IF EXISTS test.t3; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; +include/master-slave.inc +[connection master] CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=INNODB; CREATE TABLE test.t2 (a INT AUTO_INCREMENT KEY, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON DELETE CASCADE) ENGINE=INNODB; create procedure test.p1(IN i CHAR(6)) @@ -231,9 +221,10 @@ a t 98 NONE SET AUTOCOMMIT=1; SET FOREIGN_KEY_CHECKS=0; -DROP PROCEDURE IF EXISTS test.p3; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; +DROP PROCEDURE test.p3; +DROP PROCEDURE test.p1; +DROP PROCEDURE test.p2; +DROP TABLE test.t1; +DROP TABLE test.t2; +DROP TABLE test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp003.result b/mysql-test/suite/rpl/r/rpl_row_sp003.result index df3e2a7ceed..5650af7a916 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp003.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp003.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; @@ -47,3 +43,4 @@ a DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp005.result b/mysql-test/suite/rpl/r/rpl_row_sp005.result index 01e1970e0df..df877233e94 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp005.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp005.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t2; @@ -98,3 +94,4 @@ DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result index 6792a701577..da196bb3615 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; DROP PROCEDURE IF EXISTS p1; @@ -42,3 +38,4 @@ DROP TABLE t1; DROP TABLE t2; DROP PROCEDURE p1; DROP PROCEDURE p2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result b/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result index 9a2822835f8..fc49f968b4a 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result @@ -1,11 +1,5 @@ -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; -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t1; +include/master-slave.inc +[connection master] CREATE PROCEDURE test.p1(IN i INT) BEGIN DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END; @@ -46,5 +40,6 @@ num SELECT * FROM test.t1; num 13 -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t1; +DROP PROCEDURE test.p1; +DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp008.result b/mysql-test/suite/rpl/r/rpl_row_sp008.result index 23197964a24..f817e9c5f1b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp008.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp008.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t2; CREATE TABLE test.t1 (a INT,PRIMARY KEY(a)); @@ -32,3 +28,4 @@ a DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp009.result b/mysql-test/suite/rpl/r/rpl_row_sp009.result index 35ce0d7b420..8e9a2cbb8e9 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp009.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp009.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -75,3 +71,4 @@ a DROP PROCEDURE test.p1; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp010.result b/mysql-test/suite/rpl/r/rpl_row_sp010.result index 02567465428..d31f37d8411 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp010.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp010.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; @@ -54,3 +50,4 @@ DROP PROCEDURE IF EXISTS test.p3; DROP PROCEDURE IF EXISTS test.p4; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp011.result b/mysql-test/suite/rpl/r/rpl_row_sp011.result index e35c9f21adb..8588d739dff 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp011.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp011.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; @@ -67,3 +63,4 @@ DROP PROCEDURE IF EXISTS test.p6; DROP PROCEDURE IF EXISTS test.p7; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp012.result b/mysql-test/suite/rpl/r/rpl_row_sp012.result index b9c818bad9a..57d92386638 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp012.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp012.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; @@ -57,3 +53,4 @@ DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP USER user1@localhost; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result index 1934b01505c..09a3e4b73de 100644 --- a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result +++ b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result @@ -1,17 +1,14 @@ -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; +include/master-slave.inc +[connection master] create table t1 (words varchar(20)) engine=myisam; load data infile '../../std_data/words.dat' into table t1 (words); select count(*) from t1; count(*) 70 +include/wait_for_slave_sql_to_stop.inc select count(*) from t1; count(*) 70 drop table t1; -include/stop_slave.inc drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result index 2b83bffd85f..5a29acfda1d 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] STOP SLAVE; SET @my_sql_mode= @@global.sql_mode; SET GLOBAL SQL_MODE='STRICT_ALL_TABLES'; @@ -118,27 +114,21 @@ a b SELECT * FROM t2; a 2 -Checking that both slave threads are running. +include/check_slave_is_running.inc INSERT INTO t9 VALUES (4); INSERT INTO t4 VALUES (4); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4' INSERT INTO t9 VALUES (5); INSERT INTO t5 VALUES (5,10,25); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4' INSERT INTO t9 VALUES (6); INSERT INTO t6 VALUES (6,12,36); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4' INSERT INTO t9 VALUES (6); -Checking that both slave threads are running. +include/check_slave_is_running.inc INSERT INTO t7 VALUES (1),(2),(3); INSERT INTO t8 VALUES (1),(2),(3); SELECT * FROM t7 ORDER BY a; @@ -194,3 +184,4 @@ a b x y z DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef; DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9; SET @@global.sql_mode= @my_sql_mode; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result index a42530c354d..f6620ecf05f 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] STOP SLAVE; SET @my_sql_mode= @@global.sql_mode; SET GLOBAL SQL_MODE='STRICT_ALL_TABLES'; @@ -118,27 +114,21 @@ a b SELECT * FROM t2; a 2 -Checking that both slave threads are running. +include/check_slave_is_running.inc INSERT INTO t9 VALUES (4); INSERT INTO t4 VALUES (4); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4' INSERT INTO t9 VALUES (5); INSERT INTO t5 VALUES (5,10,25); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4' INSERT INTO t9 VALUES (6); INSERT INTO t6 VALUES (6,12,36); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4' INSERT INTO t9 VALUES (6); -Checking that both slave threads are running. +include/check_slave_is_running.inc INSERT INTO t7 VALUES (1),(2),(3); INSERT INTO t8 VALUES (1),(2),(3); SELECT * FROM t7 ORDER BY a; @@ -194,3 +184,4 @@ a b x y z DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef; DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9; SET @@global.sql_mode= @my_sql_mode; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result b/mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result index 711d0d063aa..eaee105a2d9 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result +++ b/mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS `t1`; ### TABLE with field_metadata_size == 290 CREATE TABLE `t1` ( @@ -159,15 +155,10 @@ LOCK TABLES `t1` WRITE; INSERT INTO `t1`(c2) VALUES ('1'); FLUSH LOGS; ### assertion: the slave replicated event successfully and tables match -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE `t1`; === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail. -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; +include/rpl_reset.inc ### action: generating several tables with different metadata ### sizes (resorting to perl) ### testing table with 249 field metadata size. @@ -182,25 +173,26 @@ start slave; ### testing table with 258 field metadata size. FLUSH LOGS; ### assertion: the slave replicated event successfully and tables match for t10 -Comparing tables master:test.t10 and slave:test.t10 +include/diff_tables.inc [master:t10, slave:t10] ### assertion: the slave replicated event successfully and tables match for t9 -Comparing tables master:test.t9 and slave:test.t9 +include/diff_tables.inc [master:t9, slave:t9] ### assertion: the slave replicated event successfully and tables match for t8 -Comparing tables master:test.t8 and slave:test.t8 +include/diff_tables.inc [master:t8, slave:t8] ### assertion: the slave replicated event successfully and tables match for t7 -Comparing tables master:test.t7 and slave:test.t7 +include/diff_tables.inc [master:t7, slave:t7] ### assertion: the slave replicated event successfully and tables match for t6 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t6, slave:t6] ### assertion: the slave replicated event successfully and tables match for t5 -Comparing tables master:test.t5 and slave:test.t5 +include/diff_tables.inc [master:t5, slave:t5] ### assertion: the slave replicated event successfully and tables match for t4 -Comparing tables master:test.t4 and slave:test.t4 +include/diff_tables.inc [master:t4, slave:t4] ### assertion: the slave replicated event successfully and tables match for t3 -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t3, slave:t3] ### assertion: the slave replicated event successfully and tables match for t2 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] ### assertion: the slave replicated event successfully and tables match for t1 -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ### assertion: check that binlog is not corrupt. Using mysqlbinlog to ### detect failure. Before the patch mysqlbinlog would find ### a corrupted event, thence would fail. +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trig001.result b/mysql-test/suite/rpl/r/rpl_row_trig001.result index ea0ef27fccd..d00da976d30 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trig001.result +++ b/mysql-test/suite/rpl/r/rpl_row_trig001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n)); CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n)); CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n)); @@ -29,3 +25,4 @@ DROP TRIGGER test.t3_bi_t2; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trig002.result b/mysql-test/suite/rpl/r/rpl_row_trig002.result index 794104db750..b0be0316bf2 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trig002.result +++ b/mysql-test/suite/rpl/r/rpl_row_trig002.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TRIGGER test.t2_ai; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -67,3 +63,4 @@ DROP TRIGGER test.t2_ai; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trig003.result b/mysql-test/suite/rpl/r/rpl_row_trig003.result index 43c2ecde2b4..68552ede1c0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trig003.result +++ b/mysql-test/suite/rpl/r/rpl_row_trig003.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TRIGGER test.t1_bi; DROP TRIGGER test.t2_ai; DROP TRIGGER test.t1_bu; @@ -81,3 +77,4 @@ DROP TRIGGER test.t2_ad; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trig004.result b/mysql-test/suite/rpl/r/rpl_row_trig004.result index d0d0657f875..50317b55e2e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trig004.result +++ b/mysql-test/suite/rpl/r/rpl_row_trig004.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TRIGGER test.t1_bi_t2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -28,3 +24,4 @@ n f DROP TRIGGER test.t1_bi_t2; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trunc_temp.result b/mysql-test/suite/rpl/r/rpl_row_trunc_temp.result index f9181be9bc0..d3b892326ac 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trunc_temp.result +++ b/mysql-test/suite/rpl/r/rpl_row_trunc_temp.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TEMPORARY TABLE t1(c1 INTEGER); CREATE TABLE t2(c1 INTEGER); CREATE TABLE t1(c1 INTEGER); @@ -27,3 +23,4 @@ SELECT * FROM t2; c1 DROP TABLE t1; DROP TABLE t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result b/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result index 800670b78ae..b9ae1893629 100644 --- a/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result +++ b/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT); CREATE TABLE t2 (a INT, b INT); INSERT INTO t1 SELECT 1; @@ -20,3 +16,4 @@ b 1 3 DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result index 81aeb0d645b..5629f5c8cdd 100644 --- a/mysql-test/suite/rpl/r/rpl_row_until.result +++ b/mysql-test/suite/rpl/r/rpl_row_until.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); INSERT INTO t1 VALUES (1),(2),(3),(4); DROP TABLE t1; @@ -14,27 +10,37 @@ DROP TABLE t2; include/stop_slave.inc RESET SLAVE; START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1 +include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; n 1 2 3 4 +include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; +include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; n 1 2 3 4 +include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2 +include/wait_for_slave_sql_to_stop.inc SELECT * FROM t2; n 1 2 +include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE; +include/wait_for_slave_to_start.inc include/stop_slave.inc START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2 +include/wait_for_slave_param.inc [Until_Log_Pos] +include/wait_for_slave_sql_to_stop.inc +include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=MASTER_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS, RELAY_LOG_POS=RELAY_LOG_POS; @@ -49,3 +55,6 @@ START SLAVE; START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; Warnings: Note 1254 Slave is already running +include/stop_slave.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_view01.result b/mysql-test/suite/rpl/r/rpl_row_view01.result index 4dfe5826f32..471de20ea6d 100644 --- a/mysql-test/suite/rpl/r/rpl_row_view01.result +++ b/mysql-test/suite/rpl/r/rpl_row_view01.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create database if not exists mysqltest1; DROP VIEW IF EXISTS mysqltest1.v1; DROP VIEW IF EXISTS mysqltest1.v2; @@ -102,3 +98,4 @@ DROP TABLE IF EXISTS mysqltest1.t2; DROP TABLE IF EXISTS mysqltest1.t4; DROP TABLE IF EXISTS mysqltest1.t10; DROP DATABASE mysqltest1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_wide_table.result b/mysql-test/suite/rpl/r/rpl_row_wide_table.result index da96e84d1d5..f469a13837c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_wide_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_wide_table.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t300; create table t300 ( f1 int, @@ -316,3 +312,4 @@ one 1 *** Cleanup *** DROP TABLE t300; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_server_id1.result b/mysql-test/suite/rpl/r/rpl_server_id1.result index 76f187e3b01..80e5bbae146 100644 --- a/mysql-test/suite/rpl/r/rpl_server_id1.result +++ b/mysql-test/suite/rpl/r/rpl_server_id1.result @@ -1,13 +1,7 @@ -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; -reset master; -include/stop_slave.inc -change master to master_port=SLAVE_PORT; -start slave; -*** must be having the replicate-same-server-id IO thread error *** -Slave_IO_Errno= 1593 -Slave_IO_Error= Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it). +include/rpl_init.inc [topology=2->2] +START SLAVE; +include/wait_for_slave_io_error.inc [errno=1593] +Last_IO_Error = 'Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).' +include/stop_slave_sql.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_server_id2.result b/mysql-test/suite/rpl/r/rpl_server_id2.result index bb5a175fbfe..dacb69bc7cb 100644 --- a/mysql-test/suite/rpl/r/rpl_server_id2.result +++ b/mysql-test/suite/rpl/r/rpl_server_id2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (n int); reset master; stop slave; @@ -21,6 +17,8 @@ create table t1(n int); create table t2(n int); change master to master_port=MASTER_PORT; start slave until master_log_file='master-bin.000001', master_log_pos=UNTIL_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc *** checking until postion execution: must be only t1 in the list *** show tables; Tables_in_test @@ -28,3 +26,4 @@ t1 start slave sql_thread; drop table t1; drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_session_var.result b/mysql-test/suite/rpl/r/rpl_session_var.result index 297a18a5931..030ae161b22 100644 --- a/mysql-test/suite/rpl/r/rpl_session_var.result +++ b/mysql-test/suite/rpl/r/rpl_session_var.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1; Warnings: Note 1051 Unknown table 't1' @@ -51,3 +47,4 @@ SELECT length(data) < 100 FROM t1; length(data) < 100 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_set_charset.result b/mysql-test/suite/rpl/r/rpl_set_charset.result index 480d926fbba..fa30a361d13 100644 --- a/mysql-test/suite/rpl/r/rpl_set_charset.result +++ b/mysql-test/suite/rpl/r/rpl_set_charset.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1 /*!40100 character set latin2 */; use mysqltest1; @@ -46,3 +42,4 @@ D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0 E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0 F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0 drop database mysqltest1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_set_null_innodb.result b/mysql-test/suite/rpl/r/rpl_set_null_innodb.result index 41600a5fe1b..f099b2b7691 100644 --- a/mysql-test/suite/rpl/r/rpl_set_null_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_set_null_innodb.result @@ -1,35 +1,22 @@ -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; -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; +include/master-slave.inc +[connection master] +include/rpl_reset.inc CREATE TABLE t1 (c1 BIT, c2 INT) Engine=InnoDB; INSERT INTO `t1` VALUES ( 1, 1 ); UPDATE t1 SET c1=NULL where c2=1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 WHERE c2=1 LIMIT 1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 CHAR) Engine=InnoDB; INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ; SELECT * FROM t1; c1 w UPDATE t1 SET c1=NULL WHERE c1='w'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 LIMIT 2; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_set_null_myisam.result b/mysql-test/suite/rpl/r/rpl_set_null_myisam.result index cbd7010664a..5698be4ff0c 100644 --- a/mysql-test/suite/rpl/r/rpl_set_null_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_set_null_myisam.result @@ -1,35 +1,22 @@ -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; -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; +include/master-slave.inc +[connection master] +include/rpl_reset.inc CREATE TABLE t1 (c1 BIT, c2 INT) Engine=MyISAM; INSERT INTO `t1` VALUES ( 1, 1 ); UPDATE t1 SET c1=NULL where c2=1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 WHERE c2=1 LIMIT 1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 CHAR) Engine=MyISAM; INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ; SELECT * FROM t1; c1 w UPDATE t1 SET c1=NULL WHERE c1='w'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 LIMIT 2; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_show_slave_running.result b/mysql-test/suite/rpl/r/rpl_show_slave_running.result index 598762d5188..66958c67428 100644 --- a/mysql-test/suite/rpl/r/rpl_show_slave_running.result +++ b/mysql-test/suite/rpl/r/rpl_show_slave_running.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET DEBUG_SYNC= 'RESET'; include/stop_slave.inc set global debug= 'd,dbug.before_get_running_status_yes'; @@ -21,6 +17,7 @@ Slave_running OFF Slave_IO_Running= No Slave_SQL_Running= No SET DEBUG_SYNC='now SIGNAL signal.io_thread_let_running'; +include/wait_for_slave_param.inc [Slave_IO_Running] Slave_running, Slave_IO_Running, Slave_SQL_Running must be OFF YES NO in three following queries SHOW STATUS LIKE 'Slave_running'; Variable_name Value @@ -28,6 +25,7 @@ Slave_running OFF Slave_IO_Running= Yes Slave_SQL_Running= No start slave sql_thread; +include/wait_for_slave_sql_to_start.inc Slave_running, Slave_IO_Running, Slave_SQL_Running must be ON, YES, YES in three following queries SHOW STATUS LIKE 'Slave_running'; Variable_name Value @@ -37,3 +35,4 @@ Slave_SQL_Running= Yes set global debug= ''; SET DEBUG_SYNC= 'RESET'; End of tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result index 0aa8069a38c..d46338fd5b0 100644 --- a/mysql-test/suite/rpl/r/rpl_skip_error.result +++ b/mysql-test/suite/rpl/r/rpl_skip_error.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Test Without sql_mode=strict_trans_tables ==== [on master] create table t1 (n int not null primary key); @@ -31,7 +27,7 @@ n 3 7 8 -Checking that both slave threads are running. +include/check_slave_is_running.inc ==== Clean Up ==== drop table t1; create table t1(a int primary key); @@ -46,7 +42,7 @@ select * from t1; a 1 2 -Checking that both slave threads are running. +include/check_slave_is_running.inc ==== Clean Up ==== drop table t1; ==== Using Innodb ==== @@ -112,3 +108,4 @@ UPDATE t2 SET id= id + 3, data = 2; ==== Clean Up ==== DROP TABLE t1; DROP TABLE t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result b/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result index eb3c4ef5978..25deb65fa0f 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result +++ b/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] *** Preparing data *** CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(10)) ENGINE=MyISAM; @@ -33,6 +29,7 @@ a b SELECT * FROM t3 ORDER BY a; a b 1 ZZ +include/wait_for_slave_sql_error.inc [errno=1146] SHOW TABLES LIKE 't%'; Tables_in_test (t%) t1 @@ -44,7 +41,7 @@ a b SELECT * FROM t2 ORDER BY a; a b 1 AA_for_row_or_YY_for_stmt_mixed -include/stop_slave.inc +include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; include/start_slave.inc TRUNCATE t1; @@ -60,6 +57,7 @@ INSERT INTO t3 VALUES(2, 'B'); INSERT INTO t2 VALUES(2, 'B'); INSERT INTO t1 VALUES(2, 'B'); UPDATE t1 SET b = 'X' WHERE a = 2; +include/wait_for_slave_sql_error.inc [errno=1146] SELECT * FROM t1 ORDER BY a; a b 2 X @@ -78,7 +76,7 @@ SELECT * FROM t1 ORDER BY a; a b SELECT * FROM t2 ORDER BY a; a b -include/stop_slave.inc +include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; include/start_slave.inc TRUNCATE t1; @@ -95,6 +93,7 @@ INSERT INTO t1 VALUES (3, 'C'), (4, 'D'); INSERT INTO t2 VALUES (3, 'C'), (4, 'D'); INSERT INTO t3 VALUES (3, 'C'), (4, 'D'); COMMIT; +include/wait_for_slave_sql_error.inc [errno=1146] SELECT * FROM t1 ORDER BY a; a b 3 C @@ -116,8 +115,9 @@ SELECT * FROM t1 ORDER BY a; a b SELECT * FROM t2 ORDER BY a; a b -include/stop_slave.inc +include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; include/start_slave.inc *** Clean up *** DROP TABLE t1,t2,t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_in.result b/mysql-test/suite/rpl/r/rpl_slave_load_in.result index 2cc83fd0a19..504f6f60d9e 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_in.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_in.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int not null auto_increment, b int, primary key(a)); create table t2(a int not null auto_increment, b int, primary key(a)) engine=innodb; load data infile '../../std_data/rpl_loaddata.dat' into table t1; @@ -13,7 +9,8 @@ insert into t2(b) values (2); load data infile '../../std_data/rpl_loaddata.dat' into table t2; load data infile '../../std_data/rpl_loaddata.dat' into table t2; commit; -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] drop table t1; drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index c3c4f7c015a..213ab06f0c1 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -1,15 +1,16 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb; start transaction; insert into t1(b) values (1); insert into t1(b) values (2); load data infile '../../std_data/rpl_loaddata.dat' into table t1; commit; +include/wait_for_slave_sql_error.inc [errno=9] drop table t1; +include/sync_slave_io_with_master.inc +include/stop_slave_io.inc +RESET SLAVE; drop table t1; call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3"); +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result index 3ed14a9cb6b..8cd6218dcdc 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result @@ -1,6 +1,7 @@ -CHANGE MASTER TO MASTER_USER='root', -MASTER_CONNECT_RETRY=1, -MASTER_HOST='127.0.0.1', -MASTER_PORT=MASTER_MYPORT; +include/master-slave.inc +[connection master] START SLAVE; -12 +include/wait_for_slave_sql_error.inc [errno=12] +include/stop_slave_io.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result index a4067fb7983..e5fe33aed19 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_skip.result +++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] **** On Slave **** STOP SLAVE; **** On Master **** @@ -43,6 +39,9 @@ c d 3 18 **** On Slave **** START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; +include/wait_for_slave_sql_to_stop.inc +include/check_slave_param.inc [Exec_Master_Log_Pos] +include/check_slave_no_error.inc SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; SELECT * FROM t1; @@ -66,6 +65,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # User var # # @`foo`=12 master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(@foo, 2*@foo) START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; +include/wait_for_slave_sql_to_stop.inc SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; **** On Master **** @@ -279,3 +279,4 @@ include/start_slave.inc SELECT * FROM t10 ORDER BY a; a b DROP TABLE t10; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result index a98a81dc74f..cbd71002c04 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_status.result +++ b/mysql-test/suite/rpl/r/rpl_slave_status.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Create new replication user ==== [on master] GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl'; @@ -27,9 +23,11 @@ FLUSH PRIVILEGES; ==== Restart slave without privileges ===== include/stop_slave.inc START SLAVE; -==== Verify that Slave_IO_Running = No ==== -Slave_IO_Running = No (should be No) +include/wait_for_slave_sql_to_start.inc +==== Verify that Slave IO thread stopped with error ==== +include/wait_for_slave_io_error.inc [errno=1045] ==== Cleanup (Note that slave IO thread is not running) ==== -DROP TABLE t1; +include/rpl_reset.inc [on master] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slow_query_log.result b/mysql-test/suite/rpl/r/rpl_slow_query_log.result index a4479f0c544..46da59a583d 100644 --- a/mysql-test/suite/rpl/r/rpl_slow_query_log.result +++ b/mysql-test/suite/rpl/r/rpl_slow_query_log.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); include/stop_slave.inc SET @old_log_output= @@log_output; @@ -46,12 +42,7 @@ include/stop_slave.inc SET GLOBAL long_query_time= @old_long_query_time; SET GLOBAL log_output= @old_log_output; include/start_slave.inc -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; +include/rpl_reset.inc SET @old_log_output= @@log_output; SET GLOBAL log_output= 'TABLE'; SET GLOBAL long_query_time= 2; @@ -89,3 +80,4 @@ SET @@global.long_query_time= @old_long_query_time; DROP TABLE t1; SET @@global.log_output= @old_log_output; SET @@global.long_query_time= @old_long_query_time; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 8f06653f8ab..fc9c05ebc81 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; @@ -989,3 +985,4 @@ drop procedure ` mysqltestbug36570_p2`; drop function mysqltestbug36570_f1; End of 5.0 tests End of 5.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_sp004.result b/mysql-test/suite/rpl/r/rpl_sp004.result index 1c0ed3cc50a..5b67d225490 100644 --- a/mysql-test/suite/rpl/r/rpl_sp004.result +++ b/mysql-test/suite/rpl/r/rpl_sp004.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t2; @@ -91,3 +87,4 @@ DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_sp_effects.result b/mysql-test/suite/rpl/r/rpl_sp_effects.result index d9cdfd81167..a6e3ae03963 100644 --- a/mysql-test/suite/rpl/r/rpl_sp_effects.result +++ b/mysql-test/suite/rpl/r/rpl_sp_effects.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; drop procedure if exists p1; drop procedure if exists p2; @@ -278,3 +274,4 @@ drop procedure sp_bug26199; drop function sf_bug26199; SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; end of the tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_sporadic_master.result b/mysql-test/suite/rpl/r/rpl_sporadic_master.result index 14fb673a081..e8278bf3744 100644 --- a/mysql-test/suite/rpl/r/rpl_sporadic_master.result +++ b/mysql-test/suite/rpl/r/rpl_sporadic_master.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t2(n int); create table t1(n int not null auto_increment primary key); insert into t1 values (NULL),(NULL); @@ -24,3 +20,4 @@ n 14 15 drop table t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result index 1af4c5e227c..35aaabc8c56 100644 --- a/mysql-test/suite/rpl/r/rpl_ssl.result +++ b/mysql-test/suite/rpl/r/rpl_ssl.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] grant replication slave on *.* to replssl@localhost require ssl; create table t1 (t int auto_increment, KEY(t)); stop slave; @@ -19,23 +15,32 @@ insert into t1 values(1); select * from t1; t 1 -Master_SSL_Allowed Yes -Master_SSL_CA_Path -Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem -Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem -Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem -Checking that both slave threads are running. +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem' +Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem' +Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem' +include/check_slave_is_running.inc STOP SLAVE; select * from t1; t 1 insert into t1 values (NULL); -Master_SSL_Allowed Yes -Master_SSL_CA_Path -Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem -Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem -Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem -Checking that both slave threads are running. +include/wait_for_slave_to_start.inc +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem' +Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem' +Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem' +include/check_slave_is_running.inc drop user replssl@localhost; drop table t1; +include/stop_slave.inc +CHANGE MASTER TO +master_user = 'root', +master_ssl = 0, +master_ssl_ca = '', +master_ssl_cert = '', +master_ssl_key = ''; End of 5.0 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ssl1.result b/mysql-test/suite/rpl/r/rpl_ssl1.result index 5b4aa126c77..5e1614f5aac 100644 --- a/mysql-test/suite/rpl/r/rpl_ssl1.result +++ b/mysql-test/suite/rpl/r/rpl_ssl1.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] grant replication slave on *.* to replssl@localhost require ssl; create table t1 (t int); stop slave; @@ -18,23 +14,23 @@ start slave; select * from t1; t 1 -Master_SSL_Allowed Yes -Master_SSL_CA_Path -Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem -Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem -Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem -Checking that both slave threads are running. +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem' +Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem' +Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem' +include/check_slave_is_running.inc stop slave; change master to master_user='root',master_password='', master_ssl=0; start slave; drop user replssl@localhost; drop table t1; -Master_SSL_Allowed No -Master_SSL_CA_Path -Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem -Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem -Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem -Checking that both slave threads are running. +Master_SSL_Allowed = 'No' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem' +Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem' +Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem' +include/check_slave_is_running.inc stop slave; change master to master_host="localhost", @@ -50,10 +46,19 @@ on slave select * from t1; t 1 -Master_SSL_Allowed Yes -Master_SSL_CA_Path -Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem -Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem -Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem -Checking that both slave threads are running. +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem' +Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem' +Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem' +include/check_slave_is_running.inc drop table t1; +include/stop_slave.inc +CHANGE MASTER TO +master_host="127.0.0.1", +master_ssl_ca ='', +master_ssl_cert='', +master_ssl_key='', +master_ssl_verify_server_cert=0, +master_ssl=0; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_stop_slave.result b/mysql-test/suite/rpl/r/rpl_start_stop_slave.result index e2b1935c268..ee667771ef0 100644 --- a/mysql-test/suite/rpl/r/rpl_start_stop_slave.result +++ b/mysql-test/suite/rpl/r/rpl_start_stop_slave.result @@ -1,14 +1,11 @@ -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; +include/master-slave.inc +[connection master] create table t1(n int); stop slave; start slave; stop slave io_thread; start slave io_thread; +include/wait_for_slave_to_start.inc drop table t1; create table t1i(n int primary key) engine=innodb; create table t2m(n int primary key) engine=myisam; @@ -28,6 +25,7 @@ zero 0 stop slave; rollback; +include/wait_for_slave_to_stop.inc *** sql thread is *not* running: No *** *** the prove: the stopped slave has finished the current transaction *** five @@ -38,3 +36,4 @@ one 1 include/start_slave.inc drop table t1i, t2m; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_000001.result b/mysql-test/suite/rpl/r/rpl_stm_000001.result index 2a5e4bdc99f..3a67772d11a 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_000001.result +++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Statement may not be safe to log in statement format."); create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; @@ -52,8 +48,7 @@ select (@id := id) - id from t2; kill @id; drop table t2; Got one of the listed errors -set global sql_slave_skip_counter=1; -start slave; +include/wait_for_slave_sql_error_and_skip.inc [errno=1053] select count(*) from t1; count(*) 5000 @@ -82,3 +77,4 @@ select_priv user Y blafasel2 drop table t1; delete from mysql.user where user="blafasel2"; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result index e69952787fb..0e83f1dfb67 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result +++ b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int, unique(a)) engine=myisam; set sql_log_bin=0; insert into t1 values(2); @@ -11,6 +7,10 @@ set sql_log_bin=1; insert into t1 values(1),(2); ERROR 23000: Duplicate entry '2' for key 'a' drop table t1; -Error: "Query caused different errors on master and slave. Error on master: 'Duplicate entry '%-.192s' for key %d' (1062), Error on slave: 'no error' (0). Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave) +include/wait_for_slave_sql_to_stop.inc +Error: "Query caused different errors on master and slave. Error on master: message (format)='Duplicate entry '%-.192s' for key %d' error code=1062 ; Error on slave: actual message='no error', error code=0. Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave) Errno: "0" (expected 0) drop table t1; +include/stop_slave.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result index 2f6e98d5eec..2b974d0d98c 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result +++ b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1, t2; DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p2; @@ -167,3 +163,4 @@ DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p2; DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result b/mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result index 818e383e2f1..8fdac1a5c97 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result +++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set @@session.binlog_direct_non_transactional_updates= TRUE; ######################################################################### # CONFIGURATION @@ -1358,3 +1354,4 @@ master-bin.000001 # Query # # ROLLBACK ################################################################################### # CLEAN ################################################################################### +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result index b0df9516b7c..b56297a5487 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialize ==== [on master] CREATE TABLE t1(a INT PRIMARY KEY); @@ -19,6 +15,7 @@ a 1 [on slave] ---- Wait until slave stops with an error ---- +include/wait_for_slave_sql_error.inc [errno=1062] Last_SQL_Error = Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)' (expected "duplicate key" error) SELECT * FROM t1; a @@ -26,6 +23,7 @@ a ---- Resolve the conflict on the slave and restart SQL thread ---- DELETE FROM t1 WHERE a = 1; START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc ---- Sync slave and verify that there is no error ---- Last_SQL_Error = '' (expected no error) SELECT * FROM t1; @@ -52,3 +50,4 @@ a [on master] DROP TABLE t1; [on slave] +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_create_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_stm_create_if_not_exists.result index 9ae1ef315b6..d833852e193 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_create_if_not_exists.result +++ b/mysql-test/suite/rpl/r/rpl_stm_create_if_not_exists.result @@ -1,12 +1,8 @@ # WL#5370 Keep forward-compatibility when changing 'CREATE TABLE IF NOT # EXISTS ... SELECT' behaviour # -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; +include/master-slave.inc +[connection master] CREATE TABLE t2(c1 INT, c2 char(10)); @@ -21,7 +17,7 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS t1 (c1 INT , c2 INT, c3 char(10), c4 INT KEY) SELECT 'abc' AS c3, 1 AS c4 -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # The statement should be binlogged as two events. one is # 'CREATE TABLE IF NOT EXISTS ..', another one is @@ -44,7 +40,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT 'abc', 2 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Verify if it can be binlogged with right database name when the table # is not in the default database @@ -68,7 +64,7 @@ master-bin.000001 # Query # # use `db1`; CREATE TABLE IF NOT EXISTS `test`.`t1` ) master-bin.000001 # Query # # use `db1`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT 'abc', 20 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:test.t1,slave:test.t1] USE test; DROP DATABASE db1; @@ -91,7 +87,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; REPLACE INTO `test`.`t1` (`c3`,`c4`) SELECT '123', 2 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # It should be binlogged as 'INSERT IGNORE... SELECT' # if the original statement has option IGNORE @@ -112,7 +108,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT IGNORE INTO `test`.`t1` (`c3`,`c4`) SELECT '123', 2 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Nothing should be binlogged if error happens and no any row is inserted @@ -121,7 +117,7 @@ SELECT '123', 2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Verify it can binlog well when there are some braces('(') @@ -169,7 +165,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT IGNORE INTO `test`.`t1` (`c3`,`c4`) (SELECT '123', 3) UNION (SELECT '123', 4) master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Throw a warning that table already exists and don't insert anything @@ -215,7 +211,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT '123', NAME_CONST('a',600) master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] DROP PROCEDURE p1; # The statement can be binlogged correctly when it is in a prepared statement @@ -251,7 +247,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT '123', 800 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # The statement can be binlogged correctly when it is in a conditional comment @@ -362,7 +358,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT 'abc', 905 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] DROP TABLE t2; DROP TABLE t1; @@ -702,3 +698,4 @@ master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SE master-bin.000001 # Query # # COMMIT DROP TABLE t2; DROP TEMPORARY TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result index fe2fb1d9da2..96d2a337e7c 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int) ENGINE=MyISAM; insert into t1 values (10); create table t2 (a int) ENGINE=MyISAM; @@ -21,10 +17,13 @@ flush tables; select * from t3; a stop slave; +include/wait_for_slave_to_stop.inc drop table t1; flush tables with read lock; start slave; +include/wait_for_slave_to_start.inc stop slave; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction unlock tables; drop table t3, t4, t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result index 1c24b2ca15b..11767db5804 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result +++ b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set @old_global_binlog_format = @@global.binlog_format; set @@global.binlog_format = statement; CREATE SCHEMA IF NOT EXISTS mysqlslap; @@ -128,3 +124,4 @@ FLUSH LOGS; FLUSH LOGS; End of 5.0 tests set @@global.binlog_format = @old_global_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_loadfile.result b/mysql-test/suite/rpl/r/rpl_stm_loadfile.result index ca76695f4d4..b49f44273ff 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_loadfile.result +++ b/mysql-test/suite/rpl/r/rpl_stm_loadfile.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); @@ -229,3 +225,4 @@ aberration DROP PROCEDURE IF EXISTS test.p1; DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result index d73a689969f..4eeec6584fd 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_log.result +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] include/stop_slave.inc reset master; reset slave; @@ -222,18 +218,13 @@ show binlog events in 'slave-bin.000002' from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM slave-bin.000002 # Query # # use `test`; insert into t2 values (1) -Checking that both slave threads are running. +include/check_slave_is_running.inc show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; -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; +include/rpl_reset.inc create table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); set insert_id=5; @@ -252,3 +243,4 @@ a b 5 1 6 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_maria.result b/mysql-test/suite/rpl/r/rpl_stm_maria.result index 1fe1fd87349..8c6ce997f2d 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_maria.result +++ b/mysql-test/suite/rpl/r/rpl_stm_maria.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; @@ -50,3 +46,4 @@ a name old_a old_b truncate(rand_value,4) 106 t2 5 0 0.6699 107 t2 500 0 0.3593 drop table t1,t2,t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result index db06cb6d3de..871d3218b70 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result +++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] stop slave; # # Generate a big enough master's binlog to cause relay log rotations @@ -21,7 +17,7 @@ select @@global.max_relay_log_size; @@global.max_relay_log_size 4096 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 2 # @@ -31,7 +27,7 @@ set global max_relay_log_size=(5*4096); select @@global.max_relay_log_size; @@global.max_relay_log_size 20480 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 3: max_relay_log_size = 0 # @@ -41,7 +37,7 @@ set global max_relay_log_size=0; select @@global.max_relay_log_size; @@global.max_relay_log_size 0 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions # @@ -55,13 +51,13 @@ reset slave; start slave; flush logs; create table t1 (a int); -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated # flush logs; drop table t1; -Checking that both slave threads are running. +include/check_slave_is_running.inc flush logs; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB @@ -70,3 +66,4 @@ set global max_binlog_size= @my_max_binlog_size; # # End of 4.1 tests # +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result index 2ecaf2c90ae..ee4c710ecd2 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ################################################################################### # CONFIGURATION ################################################################################### @@ -868,12 +864,7 @@ DROP TABLE nt_4; DROP PROCEDURE pc_i_tt_3; DROP FUNCTION f1; DROP FUNCTION f2; -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; +include/rpl_reset.inc CREATE TABLE `t1` ( `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, `c2` tinyint(1) unsigned DEFAULT NULL, @@ -887,5 +878,6 @@ INSERT INTO t1 (c1,c2,c3,c4,c5) VALUES (1, 1, 'X', 1, NULL); COMMIT; ROLLBACK; SET AUTOCOMMIT=1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE `t1`; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_multi_query.result b/mysql-test/suite/rpl/r/rpl_stm_multi_query.result index 625c686f383..0b4d179f385 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_multi_query.result +++ b/mysql-test/suite/rpl/r/rpl_stm_multi_query.result @@ -1,10 +1,5 @@ -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; -drop database if exists mysqltest; +include/master-slave.inc +[connection master] create database mysqltest; create table mysqltest.t1 ( n int); insert into mysqltest.t1 values(1)/ @@ -21,7 +16,6 @@ n 5 show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # drop database if exists mysqltest master-bin.000001 # Query # # create database mysqltest master-bin.000001 # Query # # use `test`; create table mysqltest.t1 ( n int) master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(1) @@ -30,3 +24,4 @@ master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(3) master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(4) master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(5) drop database mysqltest; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_no_op.result b/mysql-test/suite/rpl/r/rpl_stm_no_op.result index 5a253d61fcb..cf5b03cdfa6 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_no_op.result +++ b/mysql-test/suite/rpl/r/rpl_stm_no_op.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create database mysqltest; drop database if exists mysqltest; Warnings: @@ -50,3 +46,4 @@ a b select * from t2; a b drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result index 1fc189975ef..c263e27a11f 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result @@ -1,21 +1,17 @@ -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; -Master_User root -Master_Host 127.0.0.1 +include/master-slave.inc +[connection master] +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc change master to master_user='test'; -Master_User test -Master_Host 127.0.0.1 +Master_User = 'test' +Master_Host = '127.0.0.1' reset slave; -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/start_slave.inc -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc reset slave; include/start_slave.inc @@ -28,13 +24,19 @@ Variable_name Value Slave_open_temp_tables 1 include/stop_slave.inc reset slave; +include/check_slave_no_error.inc change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc change master to master_user='root'; include/start_slave.inc +include/check_slave_no_error.inc include/stop_slave.inc change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc reset slave; +include/check_slave_no_error.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_sql_mode.result b/mysql-test/suite/rpl/r/rpl_stm_sql_mode.result index fd143fc8a50..fa5ac2a0c85 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_sql_mode.result +++ b/mysql-test/suite/rpl/r/rpl_stm_sql_mode.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (pk integer auto_increment , primary key (pk)); SET SESSION SQL_MODE='traditional'; # **** [MASTER] ***** @@ -16,3 +12,4 @@ DROP TABLE t1; # assertion: sync slave with master makes slave not to stop with # duplicate key error (because it has received event # with expected error code). +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result index 0094c143e38..72495831f6e 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_until.result +++ b/mysql-test/suite/rpl/r/rpl_stm_until.result @@ -1,9 +1,6 @@ -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; +include/master-slave.inc +[connection master] +include/rpl_reset.inc [on slave] include/stop_slave.inc ==== Create some events on master ==== @@ -18,29 +15,41 @@ drop table t2; ==== Replicate one event at a time on slave ==== [on slave] start slave until master_log_file='MASTER_LOG_FILE', master_log_pos=MASTER_LOG_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc select * from t1; n 1 2 3 4 +include/check_slave_param.inc [Exec_Master_Log_Pos] start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc select * from t1; n 1 2 3 4 +include/check_slave_param.inc [Exec_Master_Log_Pos] start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc select * from t2; n 1 2 +include/check_slave_param.inc [Exec_Master_Log_Pos] start slave; [on master] [on slave] include/stop_slave.inc start slave until master_log_file='MASTER_LOG_FILE', master_log_pos=MASTER_LOG_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc +include/check_slave_param.inc [Exec_Master_Log_Pos] ==== Test various error conditions ==== start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL @@ -75,6 +84,7 @@ select count(*) as two from t1; two 2 start slave until master_log_file='MASTER_LOG_FILE', master_log_pos= UNTIL_POS;; +include/wait_for_slave_sql_to_stop.inc slave stopped at the prescribed position select 0 as zero; zero @@ -84,24 +94,17 @@ one 1 drop table t1; start slave; -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; +include/rpl_reset.inc drop table if exists t1; -Warnings: -Note 1051 Unknown table 't1' stop slave; flush logs; flush logs; reset slave; start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */; +include/wait_for_slave_sql_to_stop.inc show tables /* t1 must exist */; Tables_in_test t1 drop table t1; stop slave; -reset slave; -reset master; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result index 49146417ab7..38b85f0d30d 100644 --- a/mysql-test/suite/rpl/r/rpl_stop_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] # BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends # @@ -38,13 +34,16 @@ STOP SLAVE SQL_THREAD; [ On Slave1 ] # To resume slave SQL thread SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] +include/wait_for_slave_sql_to_stop.inc # Slave should stop after the transaction has committed. # So t1 on master is same to t1 on slave. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc # CREATE TEMPORARY TABLE with MyISAM engine # ----------------------------------------- @@ -63,13 +62,16 @@ STOP SLAVE SQL_THREAD; [ On Slave1 ] # To resume slave SQL thread SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] +include/wait_for_slave_sql_to_stop.inc # Slave should stop after the transaction has committed. # So t1 on master is same to t1 on slave. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc # CREATE TEMPORARY TABLE ... SELECT with InnoDB engine # ---------------------------------------------------- @@ -89,13 +91,16 @@ STOP SLAVE SQL_THREAD; [ On Slave1 ] # To resume slave SQL thread SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] +include/wait_for_slave_sql_to_stop.inc # Slave should stop after the transaction has committed. # So t1 on master is same to t1 on slave. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc # CREATE TEMPORARY TABLE ... SELECT with MyISAM engine # ---------------------------------------------------- @@ -115,13 +120,17 @@ STOP SLAVE SQL_THREAD; [ On Slave1 ] # To resume slave SQL thread SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] +include/wait_for_slave_sql_to_stop.inc # Slave should stop after the transaction has committed. # So t1 on master is same to t1 on slave. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc # Test end SET GLOBAL debug= '$debug_save'; DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result index 1f9f940df01..bd3d170c9f0 100644 --- a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; @@ -427,3 +423,4 @@ INSERT INTO t13 VALUES (CURRENT_USER()); INSERT INTO t13 VALUES (my_current_user()); drop database mysqltest1; set global binlog_format =@my_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_table_options.result b/mysql-test/suite/rpl/r/rpl_table_options.result index 9b0511f6494..423a2b65583 100644 --- a/mysql-test/suite/rpl/r/rpl_table_options.result +++ b/mysql-test/suite/rpl/r/rpl_table_options.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] install plugin example soname 'ha_example.so'; set storage_engine=example; create table t1 (a int not null) ull=12340; @@ -23,3 +19,4 @@ select 1; 1 1 uninstall plugin example; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_temp_table.result b/mysql-test/suite/rpl/r/rpl_temp_table.result index e4ca31d8908..e7df070874a 100644 --- a/mysql-test/suite/rpl/r/rpl_temp_table.result +++ b/mysql-test/suite/rpl/r/rpl_temp_table.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t2 (n int, PRIMARY KEY(n)); create temporary table t1 (n int); create temporary table t3 (n int not null); @@ -46,3 +42,4 @@ Slave_open_temp_tables 0 drop table if exists t1,t2; Warnings: Note 1051 Unknown table 't1' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result index 32c6748f5cb..9cd7a50273a 100644 --- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result +++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialize ==== [on master] CREATE TABLE t1 (a CHAR(48)); @@ -15,6 +11,7 @@ SHOW STATUS LIKE "Slave_open_temp_tables"; Variable_name Value Slave_open_temp_tables 1 [on master] +[on master1] [on slave] ==== Verify results on slave ==== SHOW STATUS LIKE "Slave_open_temp_tables"; @@ -22,14 +19,10 @@ Variable_name Value Slave_open_temp_tables 0 ==== Clean up ==== [on master] +include/rpl_connect.inc [creating master] DROP TABLE t1; [on slave] -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; +include/rpl_reset.inc CREATE TABLE t1 (a int); CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ); CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ); @@ -110,6 +103,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT # Compare the base table. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result index 6319f92c925..d27ea93a824 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temporary.result @@ -1,11 +1,7 @@ -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 sql_log_bin = 0; SET sql_log_bin = 1; +include/master-slave.inc +[connection master] reset master; DROP TABLE IF EXISTS t1; CREATE TEMPORARY TABLE t1 (a char(1)); @@ -130,8 +126,8 @@ select * from t1; a 1 drop table t1; -SET sql_log_bin = 0; -SET sql_log_bin = 1; +include/stop_slave.inc +include/rpl_reset.inc -- Bug#43748 -- make a user on the slave that can list but not kill system threads. FLUSH PRIVILEGES; @@ -143,5 +139,5 @@ KILL @id; Got one of the listed errors -- throw out test-user on slave. DROP USER user43748@127.0.0.1; --- done. back to master. End of 5.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result index 023f9a850ab..b7bbed328dd 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result +++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Deadlock found"); +call mtr.add_suppression("Can't find record in 't.'"); **** On Master **** SET SESSION BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT PRIMARY KEY, b INT); @@ -40,12 +37,9 @@ a b 2 2 3 3 4 4 -Checking that both slave threads are running. -DROP TABLE t1; +include/check_slave_is_running.inc **** On Master **** -SET SQL_LOG_BIN= 0; DROP TABLE t1; -SET SQL_LOG_BIN= 1; SET SESSION BINLOG_FORMAT=MIXED; CREATE TABLE t_myisam (id INT, PRIMARY KEY (id)) engine= MyIsam; INSERT INTO t_myisam (id) VALUES(1); @@ -101,4 +95,4 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(1) master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(1) master-bin.000001 # Query # # ROLLBACK DROP TABLE t_myisam, t_innodb; -STOP SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_test_framework.result b/mysql-test/suite/rpl/r/rpl_test_framework.result new file mode 100644 index 00000000000..e45c12ba0ec --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_test_framework.result @@ -0,0 +1,170 @@ +==== Create t1 on all servers. ==== +include/rpl_init.inc [topology=1->2->3->4->5->6->7->8->9] +CREATE TABLE t1 (a INT); +include/rpl_end.inc +==== Test 3-server topologies ==== +include/rpl_init.inc [topology=1 -> 2] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 12' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (1); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (1); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=2 -> 3] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 23' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (2); +[connection server_2] +DELETE FROM t1; +INSERT INTO t1 VALUES (2); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=none] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= '' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (3); +[connection server_2] +DELETE FROM t1; +INSERT INTO t1 VALUES (3); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (3); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2, 2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 212' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (4); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (4); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 212' +[connection server_2] +DELETE FROM t1; +INSERT INTO t1 VALUES (5); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (5); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=2->1->2] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 212' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (6); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (6); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2->3] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 123' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (7); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=2->3->2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 323 21' +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (8); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2,2->3,3->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 23123' +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (9); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->3->2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 13213' +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (10); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +==== Test 6-server topologies ==== +include/rpl_init.inc [topology=1->2->3->4->1->5->6] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 341234156' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (11); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=3->4->5->6->3->1->2] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 4563456 312' +[connection server_4] +DELETE FROM t1; +INSERT INTO t1 VALUES (12); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=6->5->4->3->2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 65 54 43 32 21' +[connection server_6] +DELETE FROM t1; +INSERT INTO t1 VALUES (13); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2->3->1,4->5->6] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 456 23123' +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (14); +[connection server_4] +DELETE FROM t1; +INSERT INTO t1 VALUES (14); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1] +include/rpl_end.inc +==== Test 9-server topology ==== +include/rpl_init.inc [topology=1->2, 2->3, 3->4, 4->5, 5->1, 1->6, 6->7, 6->8, 8->9] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 345123451689 67' +[connection server_2] +DELETE FROM t1; +INSERT INTO t1 VALUES (15); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1,server_7:t1,server_8:t1,server_9:t1] +include/rpl_end.inc +==== Clean up ==== +include/rpl_init.inc [topology=1->2->3->4->5->6->7->8->9] +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_timezone.result b/mysql-test/suite/rpl/r/rpl_timezone.result index 0b5c03b5300..ce93c3030c0 100644 --- a/mysql-test/suite/rpl/r/rpl_timezone.result +++ b/mysql-test/suite/rpl/r/rpl_timezone.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set @my_time_zone= @@global.time_zone; set timestamp=100000000; create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n)); @@ -122,6 +118,7 @@ a b SET @@session.time_zone = default; DROP TABLE t1; SET @@session.time_zone = default; +include/stop_slave.inc reset master; CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL); SET @@session.time_zone='+01:00'; @@ -141,4 +138,5 @@ date a 2008-12-23 19:39:39 2 DROP TABLE t1; SET @@session.time_zone = default; +include/rpl_end.inc End of 5.0 tests diff --git a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result index 5729faa9659..682aa71d64c 100644 --- a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result +++ b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TEMPORARY TABLE t1 (a INT); CREATE TABLE t2 (a INT, b INT) ENGINE= MyISAM; INSERT INTO t1 VALUES (1); @@ -94,3 +90,4 @@ INSERT INTO t1 VALUES (1); DROP TABLE t2; INSERT INTO t1 VALUES (1); DROP TEMPORARY TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_trigger.result b/mysql-test/suite/rpl/r/rpl_trigger.result index 86534fa8f7d..24795378177 100644 --- a/mysql-test/suite/rpl/r/rpl_trigger.result +++ b/mysql-test/suite/rpl/r/rpl_trigger.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Statement may not be safe to log in statement format."); DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; @@ -863,8 +859,8 @@ drop table t21,t31; drop table t11; STOP SLAVE; FLUSH LOGS; ---> Stop master server ---> Start master server +include/rpl_stop_server.inc [server_number=1] +include/rpl_start_server.inc [server_number=1] --> Master binlog: Server ver: 5.0.16-debug-log, Binlog ver: 4 RESET SLAVE; START SLAVE; @@ -979,12 +975,7 @@ a b 2 b 3 c drop table t1; -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; +include/rpl_reset.inc create table t1 ( f int ) engine = innodb; create table log ( r int ) engine = myisam; create trigger tr @@ -995,6 +986,7 @@ insert into t1 values ( 1 ); rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.log and slave:test.log +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:log, slave:log] drop table t1, log; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_trunc_temp.result b/mysql-test/suite/rpl/r/rpl_trunc_temp.result index 44624a38875..ae2c9973c9f 100644 --- a/mysql-test/suite/rpl/r/rpl_trunc_temp.result +++ b/mysql-test/suite/rpl/r/rpl_trunc_temp.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create temporary table t1 (n int); insert into t1 values(1); show status like 'Slave_open_temp_tables'; @@ -20,3 +16,4 @@ Slave_open_temp_tables 1 show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result index 38fb9e27764..da8db64cef4 100644 --- a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result @@ -1,20 +1,12 @@ -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; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/master-slave.inc +[connection master] +include/rpl_reset.inc **** On Master **** CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1), (2,2); **** On Master **** TRUNCATE TABLE t1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ==== Test using a table with delete triggers ==== **** On Master **** SET @count := 1; @@ -22,19 +14,15 @@ CREATE TABLE t2 (a INT, b LONG) ENGINE=MyISAM; CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1; **** On Master **** TRUNCATE TABLE t1; -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1,t2; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc **** On Master **** CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1), (2,2); **** On Master **** DELETE FROM t1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ==== Test using a table with delete triggers ==== **** On Master **** SET @count := 1; @@ -42,5 +30,6 @@ CREATE TABLE t2 (a INT, b LONG) ENGINE=MyISAM; CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1; **** On Master **** DELETE FROM t1; -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result index b5e5936834d..d8a4443022d 100644 --- a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result @@ -1,20 +1,12 @@ -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; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/master-slave.inc +[connection master] +include/rpl_reset.inc **** On Master **** CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,1), (2,2); **** On Master **** TRUNCATE TABLE t1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ==== Test using a table with delete triggers ==== **** On Master **** SET @count := 1; @@ -22,19 +14,15 @@ CREATE TABLE t2 (a INT, b LONG) ENGINE=InnoDB; CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1; **** On Master **** TRUNCATE TABLE t1; -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1,t2; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc **** On Master **** CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,1), (2,2); **** On Master **** DELETE FROM t1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ==== Test using a table with delete triggers ==== **** On Master **** SET @count := 1; @@ -42,5 +30,6 @@ CREATE TABLE t2 (a INT, b LONG) ENGINE=InnoDB; CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1; **** On Master **** DELETE FROM t1; -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result b/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result index e3b8d6de12e..a5c55e43617 100644 --- a/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result @@ -1,15 +1,7 @@ -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; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/master-slave.inc +[connection master] CREATE TABLE t1(b1 BIT(1), b2 BIT(2), b3 BIT(3)) ENGINE=InnoDB; INSERT INTO t1 VALUES (b'0', b'01', b'101'); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_udf.result b/mysql-test/suite/rpl/r/rpl_udf.result index ccf16271d01..9f4c2b199ca 100644 --- a/mysql-test/suite/rpl/r/rpl_udf.result +++ b/mysql-test/suite/rpl/r/rpl_udf.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set binlog_format=row; drop table if exists t1; "*** Test 1) Test UDFs via loadable libraries *** @@ -316,3 +312,4 @@ affected rows: 0 "Running on the master" DROP TABLE t1; affected rows: 0 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_user.result b/mysql-test/suite/rpl/r/rpl_user.result index a98e7e9ca55..4ad87eb1ae7 100644 --- a/mysql-test/suite/rpl/r/rpl_user.result +++ b/mysql-test/suite/rpl/r/rpl_user.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set session sql_log_bin=0; delete from mysql.user where Host='fakehost'; set session sql_log_bin=1; @@ -43,3 +39,4 @@ master-bin.000001 # Query # # use `test`; rename user 'foo'@'fakehost' to 'foofo master-bin.000001 # Query # # use `test`; rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'bar'@'fakehost' to 'barbar'@'fakehost' master-bin.000001 # Query # # use `test`; drop user 'foofoo'@'fakehost' master-bin.000001 # Query # # use `test`; drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_user_variables.result b/mysql-test/suite/rpl/r/rpl_user_variables.result index 1f76eae3fce..e302ec0aceb 100644 --- a/mysql-test/suite/rpl/r/rpl_user_variables.result +++ b/mysql-test/suite/rpl/r/rpl_user_variables.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] reset master; create table t1(n char(30)); set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1; @@ -279,4 +275,4 @@ i DROP FUNCTION f1; DROP FUNCTION f2; DROP TABLE t1; -stop slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_variables.result b/mysql-test/suite/rpl/r/rpl_variables.result index b3108c75a6e..3724ff571b2 100644 --- a/mysql-test/suite/rpl/r/rpl_variables.result +++ b/mysql-test/suite/rpl/r/rpl_variables.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialization ==== [on master] SET @m_default_week_format= @@global.default_week_format; @@ -38,12 +34,7 @@ SET @@global.sql_mode = 'ALLOW_INVALID_DATES'; SET @@local.sql_mode = 'ANSI_QUOTES,ERROR_FOR_DIVISION_BY_ZERO,HIGH_NOT_PRECEDENCE'; SET @user_num = 10; SET @user_text = 'Alunda'; -[on master] -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc [on slave] SET @@global.init_slave = 'SELECT 1'; [on master] @@ -550,15 +541,7 @@ id truth num text 30 NULL 30 NULL 31 NULL NULL Bergsbrunna 32 NULL NULL Centrum -Comparing tables master:test.tstmt and master:test.tproc -Comparing tables master:test.tstmt and master:test.tfunc -Comparing tables master:test.tstmt and master:test.ttrig -Comparing tables master:test.tstmt and master:test.tprep -Comparing tables master:test.tstmt and slave:test.tstmt -Comparing tables master:test.tstmt and slave:test.tproc -Comparing tables master:test.tstmt and slave:test.tfunc -Comparing tables master:test.tstmt and slave:test.ttrig -Comparing tables master:test.tstmt and slave:test.tprep +include/diff_tables.inc [master:tstmt,tproc,tfunc,ttrig,tprep, slave:tstmt,tproc,tfunc,ttrig,tprep] ==== Clean up ==== [on master] DROP PROCEDURE proc; @@ -582,3 +565,4 @@ SET @@global.relay_log_purge= @s_relay_log_purge; SET @@global.slave_exec_mode= @s_slave_exec_mode; SET @@global.sql_mode= @s_sql_mode; SET @@global.sync_binlog= @s_sync_binlog; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_variables_stm.result b/mysql-test/suite/rpl/r/rpl_variables_stm.result index 51484187215..553a1710d77 100644 --- a/mysql-test/suite/rpl/r/rpl_variables_stm.result +++ b/mysql-test/suite/rpl/r/rpl_variables_stm.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialization ==== [on master] SET @m_pseudo_thread_id= @@global.pseudo_thread_id; @@ -490,15 +486,7 @@ id num text 56 NULL 47124712 57 NULL 1616 58 NULL 1717 -Comparing tables master:test.tstmt and master:test.tproc -Comparing tables master:test.tstmt and master:test.tfunc -Comparing tables master:test.tstmt and master:test.ttrig -Comparing tables master:test.tstmt and master:test.tprep -Comparing tables master:test.tstmt and slave:test.tstmt -Comparing tables master:test.tstmt and slave:test.tproc -Comparing tables master:test.tstmt and slave:test.tfunc -Comparing tables master:test.tstmt and slave:test.ttrig -Comparing tables master:test.tstmt and slave:test.tprep +include/diff_tables.inc [master:tstmt,tproc,tfunc,ttrig,tprep, slave:tstmt,tproc,tfunc,ttrig,tprep] ==== Clean up ==== [on master] DROP PROCEDURE proc; @@ -524,3 +512,4 @@ SET @@global.collation_server= @s_collation_server; SET @@global.time_zone= @s_time_zone; SET @@global.lc_time_names= @s_lc_time_names; SET @@global.collation_database= @s_collation_database; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_view.result b/mysql-test/suite/rpl/r/rpl_view.result index b129223b6d2..307b88ff6f9 100644 --- a/mysql-test/suite/rpl/r/rpl_view.result +++ b/mysql-test/suite/rpl/r/rpl_view.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1,v1; drop view if exists t1,v1; reset master; @@ -116,3 +112,4 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI DROP VIEW v1; DROP TABLE t1; End of 5.0 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/rpl_1slave_base.cnf b/mysql-test/suite/rpl/rpl_1slave_base.cnf index 8cdc3a1f6b0..2e2ae79888e 100644 --- a/mysql-test/suite/rpl/rpl_1slave_base.cnf +++ b/mysql-test/suite/rpl/rpl_1slave_base.cnf @@ -7,6 +7,7 @@ #!run-master-sh log-bin= master-bin +relay-log= master-relay-bin [mysqld.2] # Run the slave.sh script before starting this process diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index ef77c54e067..93d21fd6653 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,3 +11,5 @@ ############################################################################## rpl_row_create_table : Bug#51574 Feb 27 2010 andrei failed different way than earlier with bug#45576 +#rpl_log_pos : BUG#55675 Sep 10 2010 27 2010 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle +rpl_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.sh b/mysql-test/suite/rpl/t/rpl000017-slave.sh deleted file mode 100755 index 1d95798260a..00000000000 --- a/mysql-test/suite/rpl/t/rpl000017-slave.sh +++ /dev/null @@ -1,12 +0,0 @@ -rm -f $MYSQLTEST_VARDIR/log/*relay* -rm -f $MYSQLTEST_VARDIR/mysqld.2/data/relay-log.info -cat > $MYSQLTEST_VARDIR/mysqld.2/data/master.info <<EOF -master-bin.000001 -4 -127.0.0.1 -replicate -aaaaaaaaaaaaaaab -$MASTER_MYPORT -1 -0 -EOF diff --git a/mysql-test/suite/rpl/t/rpl000017.test b/mysql-test/suite/rpl/t/rpl000017.test deleted file mode 100644 index 2ba321cd8c3..00000000000 --- a/mysql-test/suite/rpl/t/rpl000017.test +++ /dev/null @@ -1,22 +0,0 @@ -source include/master-slave.inc; -connection slave; -stop slave; -connection master; -grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; -grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; -connection slave; -start slave; -connection master; ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1(n int); -insert into t1 values(24); -sync_slave_with_master; -select * from t1; -connection master; -drop table t1; -delete from mysql.user where user="replicate"; -sync_slave_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl000010-slave.opt b/mysql-test/suite/rpl/t/rpl_000010-slave.opt index 0dbfb311e33..0dbfb311e33 100644 --- a/mysql-test/suite/rpl/t/rpl000010-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_000010-slave.opt diff --git a/mysql-test/suite/rpl/t/rpl000010.test b/mysql-test/suite/rpl/t/rpl_000010.test index 261b9148774..7e7ca103d2c 100644 --- a/mysql-test/suite/rpl/t/rpl000010.test +++ b/mysql-test/suite/rpl/t/rpl_000010.test @@ -17,3 +17,4 @@ connection slave; sync_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl000011.test b/mysql-test/suite/rpl/t/rpl_000011.test index 32f6227f7c5..357a291ddb2 100644 --- a/mysql-test/suite/rpl/t/rpl000011.test +++ b/mysql-test/suite/rpl/t/rpl_000011.test @@ -15,3 +15,4 @@ drop table t1; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl000013.test b/mysql-test/suite/rpl/t/rpl_000013.test index 69a102e84ce..f64c484b003 100644 --- a/mysql-test/suite/rpl/t/rpl000013.test +++ b/mysql-test/suite/rpl/t/rpl_000013.test @@ -9,9 +9,7 @@ --source include/have_binlog_format_mixed_or_statement.inc source include/master-slave.inc; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master connection master; create table t2(n int); @@ -46,8 +44,8 @@ connection master2; # exist in this connection. drop table if exists t1,t2; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master + +--source include/rpl_end.inc # End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.opt b/mysql-test/suite/rpl/t/rpl_000017-slave.opt index 58a964c90d0..58a964c90d0 100644 --- a/mysql-test/suite/rpl/t/rpl000017-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_000017-slave.opt diff --git a/mysql-test/suite/rpl/t/rpl_000017.test b/mysql-test/suite/rpl/t/rpl_000017.test new file mode 100644 index 00000000000..a34419c37c8 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_000017.test @@ -0,0 +1,48 @@ +# ==== Purpose ==== +# +# Unknown. +# +# ==== Notes ==== +# +# This test uses the -slave.opt file to start the slave with +# --skip-slave-start. + +--source include/not_windows.inc + +--let $rpl_skip_start_slave= 1 +--source include/master-slave.inc + +--connection slave +--let $slave_datadir= `SELECT @@datadir` + +--remove_file $slave_datadir/master.info +--write_file $slave_datadir/master.info +master-bin.000001 +4 +127.0.0.1 +replicate +aaaaaaaaaaaaaaab +$MASTER_MYPORT +1 +0 +EOF + +connection master; +grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; +grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; +connection slave; +--source include/start_slave.inc + +connection master; +create table t1(n int); +insert into t1 values(24); +sync_slave_with_master; +select * from t1; +connection master; +drop table t1; +delete from mysql.user where user="replicate"; + +# End of 4.1 tests +--source include/rpl_end.inc + +--source include/force_restart.inc diff --git a/mysql-test/suite/rpl/t/rpl_EE_err.test b/mysql-test/suite/rpl/t/rpl_EE_err.test index 6d064ae3197..5272b11f342 100644 --- a/mysql-test/suite/rpl/t/rpl_EE_err.test +++ b/mysql-test/suite/rpl/t/rpl_EE_err.test @@ -1,7 +1,3 @@ -######################################################## -# By JBM 2006-02-14 Wrapped to share test code between # -# engines. Added to skip test when NDB is default # -######################################################## -- source include/not_ndb_default.inc let $engine_type=myisam; -- source extra/rpl_tests/rpl_EE_err.test diff --git a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test index ae647ed6648..0f02bdccb60 100644 --- a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test +++ b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test @@ -36,3 +36,4 @@ sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_alter.test b/mysql-test/suite/rpl/t/rpl_alter.test index bc42476244a..e34f670ea18 100644 --- a/mysql-test/suite/rpl/t/rpl_alter.test +++ b/mysql-test/suite/rpl/t/rpl_alter.test @@ -1,7 +1,4 @@ source include/master-slave.inc; ---disable_warnings -drop database if exists mysqltest; ---enable_warnings create database mysqltest; create table mysqltest.t1 ( n int); @@ -58,14 +55,16 @@ if (`SELECT 'table_id: 0 (test.t2)' = '$_info'`) --die test.t2's table map id is 0; } -let diff_table= test.t1; -source include/rpl_diff_tables.inc; -let diff_table= test.t2; -source include/rpl_diff_tables.inc; +--sync_slave_with_master + +--let $diff_tables= master:t1, slave:t1 +--source include/diff_tables.inc +--let $diff_tables= master:t2, slave:t2 +--source include/diff_tables.inc --echo connection master; DROP TABLE t1, t2; -source include/master-slave-end.inc; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_alter_db.test b/mysql-test/suite/rpl/t/rpl_alter_db.test index 341496350d7..f6f0782580f 100644 --- a/mysql-test/suite/rpl/t/rpl_alter_db.test +++ b/mysql-test/suite/rpl/t/rpl_alter_db.test @@ -12,3 +12,4 @@ sync_slave_with_master; connection master; drop database temp_db; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment.test b/mysql-test/suite/rpl/t/rpl_auto_increment.test index 19770ffbdc0..8869e3745db 100644 --- a/mysql-test/suite/rpl/t/rpl_auto_increment.test +++ b/mysql-test/suite/rpl/t/rpl_auto_increment.test @@ -1,10 +1,6 @@ ##################################### # Wrapper for rpl_auto_increment.test# ##################################### -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=innodb; diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test index d4b7872fb2b..6b7c97298f4 100644 --- a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test +++ b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test @@ -58,6 +58,6 @@ sync_with_master; use test1; select * from t1; -drop database test1; connection master; drop database test1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/rpl/t/rpl_auto_increment_bug33029.test index 5297767675c..0163550a3c5 100644 --- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test +++ b/mysql-test/suite/rpl/t/rpl_auto_increment_bug33029.test @@ -15,47 +15,42 @@ # rpl_auto_increment_bug33029.test with clean up statements at the end # of the test case removed on a buggy 5.0 server -source include/have_log_bin.inc; +--let $rpl_skip_start_slave= 1 +--let $rpl_skip_change_master= 1 +source include/master-slave.inc; + +--echo ==== Initialize ==== +--connection slave # Need to restore this at the end; CHANGE MASTER modifies it (see the # manual for CHANGE MASTER). SET @old_relay_log_purge= @@global.relay_log_purge; -let $MYSQLD_DATADIR= `select @@datadir`; - -copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001; - -write_file $MYSQLD_DATADIR/slave-relay-bin.index; -slave-relay-bin.000001 -EOF - -change master to - MASTER_HOST='dummy.localdomain', - RELAY_LOG_FILE='slave-relay-bin.000001', - RELAY_LOG_POS=4; +# the relay log contains create t1, t2 tables and load data infile +--let $fake_relay_log = $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 +--source include/setup_fake_relay_log.inc +--echo ==== Test ==== start slave sql_thread; -disable_result_log; -select MASTER_POS_WAIT('master-bin.000001', 3776); -enable_result_log; +--let $slave_param= Exec_Master_Log_Pos +--let $slave_param_value= 3776 +--source include/wait_for_slave_param.inc + echo # Result on slave; SELECT * FROM t1; SELECT * FROM t2; -# clean up -disable_warnings; -DROP TABLE IF EXISTS t1, t2; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP FUNCTION IF EXISTS f1; -DROP TRIGGER IF EXISTS tr1; -enable_warnings; +--echo ==== Clean up ==== stop slave sql_thread; -reset slave; -source include/wait_for_slave_sql_to_stop.inc; -remove_file $MYSQLD_DATADIR/slave-relay-bin.000001; -remove_file $MYSQLD_DATADIR/slave-relay-bin.index; +--source include/cleanup_fake_relay_log.inc + +DROP TABLE t1, t2; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP FUNCTION f1; SET @@global.relay_log_purge= @old_relay_log_purge; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test b/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test index f38d2151ab3..b5eb3c5408a 100644 --- a/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test +++ b/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test @@ -159,11 +159,9 @@ source include/show_binlog_events.inc; sync_slave_with_master; --echo #Test if the results are consistent on master and slave --echo #for 'UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT' -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; connection master; @@ -199,11 +197,9 @@ source include/show_binlog_events.inc; sync_slave_with_master; --echo #Test if the results are consistent on master and slave --echo #for 'INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES' -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; connection master; @@ -212,3 +208,4 @@ drop table t2; drop view v15; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test index 28164686c39..8cddc43b84e 100644 --- a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test +++ b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test @@ -169,4 +169,4 @@ SELECT * FROM db1.t1 WHERE a IN (30, 40); connection master; DROP DATABASE db1; DROP DATABASE db2; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt deleted file mode 100644 index 815a8f81d32..00000000000 --- a/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt +++ /dev/null @@ -1 +0,0 @@ ---replicate-same-server-id --relay-log=slave-relay-bin diff --git a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test index 401597b5c64..d613a72e48c 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test @@ -15,13 +15,12 @@ # BUG#31793: log event corruption causes crash # BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event -# Temporarily disabled on Windows due to bug #47639 ---source include/not_windows.inc - -source include/have_log_bin.inc; +-- source include/have_log_bin.inc # BUG#40482 only manifested itself in debug-compiled binaries. -source include/have_debug.inc; +-- source include/have_debug.inc +-- source include/master-slave.inc +--connection slave call mtr.add_suppression('Found invalid event in binary log'); @@ -32,6 +31,9 @@ call mtr.add_suppression('Found invalid event in binary log'); # incident number. --echo ==== Initialize ==== +--source include/stop_slave.inc +RESET SLAVE; + let $fake_relay_log= $MYSQL_TEST_DIR/std_data/bug40482-bin.000001; source include/setup_fake_relay_log.inc; @@ -44,3 +46,5 @@ let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); --echo ==== Clean up ==== source include/cleanup_fake_relay_log.inc; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt new file mode 100644 index 00000000000..f8e46a44854 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt @@ -0,0 +1 @@ +--max_binlog_size=4096 diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test new file mode 100644 index 00000000000..7c09dab704e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test @@ -0,0 +1,413 @@ +# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error +# when generating new name. +# +# WHY +# === +# +# We want to check whether error is reported or not when +# new_file_impl fails (this may happen when rotation is not +# possible because there is some problem finding an +# unique filename). +# +# HOW +# === +# +# Test cases are documented inline. + +-- source include/have_innodb.inc +-- source include/have_debug.inc +-- source include/master-slave.inc + +-- echo ####################################################################### +-- echo ####################### PART 1: MASTER TESTS ########################## +-- echo ####################################################################### + + +### ACTION: stopping slave as it is not needed for the first part of +### the test + +-- connection slave +-- source include/stop_slave.inc +-- connection master + +call mtr.add_suppression("Can't generate a unique log-filename"); +call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); +call mtr.add_suppression("Error writing file .*"); + +SET @old_debug= @@global.debug; + +### ACTION: create a large file (> 4096 bytes) that will be later used +### in LOAD DATA INFILE to check binlog errors in its vacinity +-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' + +### ACTION: create a small file (< 4096 bytes) that will be later used +### in LOAD DATA INFILE to check for absence of binlog errors +### when file loading this file does not force flushing and +### rotating the binary log +-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' + +RESET MASTER; + +-- echo ###################### TEST #1 + +### ASSERTION: no problem flushing logs (should show two binlogs) +FLUSH LOGS; +-- echo # assert: must show two binlogs +-- source include/show_binary_logs.inc + +-- echo ###################### TEST #2 + +### ASSERTION: check that FLUSH LOGS actually fails and reports +### failure back to the user if find_uniq_filename fails +### (should show just one binlog) + +RESET MASTER; +SET GLOBAL debug="+d,error_unique_log_filename"; +-- error ER_NO_UNIQUE_LOGFILE +FLUSH LOGS; +-- echo # assert: must show one binlog +-- source include/show_binary_logs.inc + +### ACTION: clean up and move to next test +SET GLOBAL debug=""; +RESET MASTER; + +-- echo ###################### TEST #3 + +### ACTION: create some tables (t1, t2, t4) and insert some values in +### table t1 +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB; +CREATE TABLE t4 (a VARCHAR(16384)); +INSERT INTO t1 VALUES (1); +RESET MASTER; + +### ASSERTION: we force rotation of the binary log because it exceeds +### the max_binlog_size option (should show two binary +### logs) + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# shows two binary logs +-- echo # assert: must show two binlog +-- source include/show_binary_logs.inc + +# clean up the table and the binlog to be used in next part of test +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #4 + +### ASSERTION: load the big file into a transactional table and check +### that it reports error. The table will contain the +### changes performed despite the fact that it reported an +### error. + +SET GLOBAL debug="+d,error_unique_log_filename"; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# show table +-- echo # assert: must show one entry +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #5 + +### ASSERTION: load the small file into a transactional table and +### check that it succeeds + +SET GLOBAL debug="+d,error_unique_log_filename"; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 + +# show table +-- echo # assert: must show one entry +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #6 + +### ASSERTION: check that even if one is using a transactional table +### and explicit transactions (no autocommit) if rotation +### fails we get the error. Transaction is not rolledback +### because rotation happens after the commit. + +SET GLOBAL debug="+d,error_unique_log_filename"; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES ('muse'); +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +INSERT INTO t2 VALUES ('muse'); +-- error ER_NO_UNIQUE_LOGFILE +COMMIT; + +### ACTION: Show the contents of the table after the test +-- echo # assert: must show three entries +SELECT count(*) FROM t2; + +### ACTION: clean up and move to the next test +SET AUTOCOMMIT= 1; +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #7 + +### ASSERTION: check that on a non-transactional table, if rotation +### fails then an error is reported and an incident event +### is written to the current binary log. + +SET GLOBAL debug="+d,error_unique_log_filename"; +SELECT count(*) FROM t4; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 + +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; + +-- echo ### check that the incident event is written to the current log +SET GLOBAL debug="-d,error_unique_log_filename"; +-- let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1) +-- let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) + +# 53 is the size of the incident event, so we start from 22 bytes before the +# current position +-- let $binlog_start = `SELECT $binlog_start - 53` +FLUSH LOGS; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> $binlog_file BINLOG_FILE +-- replace_column 2 # 4 # 5 # +-- eval SHOW BINLOG EVENTS IN '$binlog_file' FROM $binlog_start LIMIT 1 + +# clean up and move to next test +DELETE FROM t4; +RESET MASTER; + +-- echo ###################### TEST #8 + +### ASSERTION: check that statements end up in error but they succeed +### on changing the data. + +SET GLOBAL debug="+d,error_unique_log_filename"; +-- echo # must show 0 entries +SELECT count(*) FROM t4; +SELECT count(*) FROM t2; + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +-- error ER_NO_UNIQUE_LOGFILE +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); + +-- echo # INFO: Count(*) Before Offending DELETEs +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; +-- echo # assert: must show 4 entries +SELECT count(*) FROM t2; + +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t4; +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t2; + +-- echo # INFO: Count(*) After Offending DELETEs +-- echo # assert: must show zero entries +SELECT count(*) FROM t4; +SELECT count(*) FROM t2; + +# remove fault injection +SET GLOBAL debug="-d,error_unique_log_filename"; + +-- echo ###################### TEST #9 + +### ASSERTION: check that if we disable binlogging, then statements +### succeed. +SET GLOBAL debug="+d,error_unique_log_filename"; +SET SQL_LOG_BIN=0; +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); +INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); +-- echo # assert: must show four entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +DELETE FROM t2; +DELETE FROM t4; +-- echo # assert: must show zero entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +SET SQL_LOG_BIN=1; +SET GLOBAL debug="-d,error_unique_log_filename"; + +-- echo ###################### TEST #10 + +### ASSERTION: check that error is reported if there is a failure +### while registering the index file and the binary log +### file or failure to write the rotate event. + +call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Could not open .*"); + +RESET MASTER; +SHOW WARNINGS; + +# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open +SET GLOBAL debug="+d,fault_injection_registering_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +SET GLOBAL debug="-d,fault_injection_registering_index"; + +-- error ER_NO_BINARY_LOGGING +SHOW BINARY LOGS; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +-- echo ###################### TEST #11 + +### ASSERTION: check that error is reported if there is a failure +### while opening the index file and the binary log file or +### failure to write the rotate event. + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file +SET GLOBAL debug="+d,fault_injection_openning_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +SET GLOBAL debug="-d,fault_injection_openning_index"; + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +-- echo ###################### TEST #12 + +### ASSERTION: check that error is reported if there is a failure +### while writing the rotate event when creating a new log +### file. + +# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl +SET GLOBAL debug="+d,fault_injection_new_file_rotate_event"; +-- error ER_ERROR_ON_WRITE +FLUSH LOGS; +SET GLOBAL debug="-d,fault_injection_new_file_rotate_event"; + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +## clean up +SET GLOBAL debug= @old_debug; +DROP TABLE t1, t2, t4; +RESET MASTER; + +# restart slave again +-- connection slave +-- source include/start_slave.inc +-- connection master + +-- echo ####################################################################### +-- echo ####################### PART 2: SLAVE TESTS ########################### +-- echo ####################################################################### + +### setup +--source include/rpl_reset.inc +-- connection slave + +# slave suppressions + +call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); +call mtr.add_suppression("Error writing file .*"); +call mtr.add_suppression("Could not open .*"); +call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Can't generate a unique log-filename .*"); +-- echo ###################### TEST #13 + +#### ASSERTION: check against unique log filename error +-- let $io_thd_injection_fault_flag= error_unique_log_filename +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #14 + +#### ASSERTION: check against rotate failing +-- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #15 + +#### ASSERTION: check against relay log open failure +-- let $io_thd_injection_fault_flag= fault_injection_registering_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #16 + +#### ASSERTION: check against relay log index open failure +-- let $io_thd_injection_fault_flag= fault_injection_openning_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +### clean up +-- source include/stop_slave_sql.inc +SET GLOBAL debug=@old_debug; +RESET SLAVE; +RESET MASTER; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_grant.test b/mysql-test/suite/rpl/t/rpl_binlog_grant.test index 4c6402359fe..a20853e35a9 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test @@ -41,3 +41,4 @@ show grants for x@y; drop user x@y; drop database d1; --sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test b/mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test index 9dca61d8f75..265bde2ccf6 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test @@ -69,16 +69,17 @@ if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) CONCAT($data, $data, $data, $data, $data, $data)); # Below code fakes the result of 'ROW' mode. --echo Got one of the listed errors - --echo --source include/wait_for_slave_sql_error_and_skip.inc - --echo include/start_slave.inc + # Ensure same message as in the case binlog_format=row below + --echo include/wait_for_slave_sql_error_and_skip.inc [errno=1590] } if (`SELECT @@binlog_format = 'ROW'`) { --error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE eval INSERT INTO t2 (a, data) VALUES (2, CONCAT($data, $data, $data, $data, $data, $data)); - # Incident event - --let $slave_sql_errno=1590 + + # 1590=ER_SLAVE_INCIDENT + --let $slave_sql_errno= 1590 --source include/wait_for_slave_sql_error_and_skip.inc } --enable_warnings @@ -101,8 +102,8 @@ eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data), t1.data = CONCAT($data, $data, $data, $data); --enable_query_log -# Incident event ---let $slave_sql_errno=1590 +# 1590=ER_SLAVE_INCIDENT +--let $slave_sql_errno= 1590 --source include/wait_for_slave_sql_error_and_skip.inc #--echo ######################################################################################## @@ -192,8 +193,9 @@ BEGIN; CREATE TABLE t5 (a int); --enable_query_log -let $diff_statement= SELECT * FROM t1; ---source include/diff_master_slave.inc +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc --echo ######################################################################################## --echo # 3 - BEGIN - COMMIT @@ -221,8 +223,9 @@ BEGIN; --enable_query_log COMMIT; -let $diff_statement= SELECT * FROM t1; ---source include/diff_master_slave.inc +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc --echo ######################################################################################## --echo # 4 - BEGIN - ROLLBACK @@ -250,8 +253,9 @@ BEGIN; --enable_query_log ROLLBACK; -let $diff_statement= SELECT * FROM t1; ---source include/diff_master_slave.inc +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc --echo ######################################################################################## --echo # 5 - PROCEDURE @@ -299,8 +303,9 @@ eval CALL p1($data); --enable_query_log ROLLBACK; -let $diff_statement= SELECT * FROM t1; ---source include/diff_master_slave.inc +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc --echo ######################################################################################## --echo # 6 - XID @@ -330,8 +335,9 @@ SAVEPOINT sv; ROLLBACK TO sv; COMMIT; -let $diff_statement= SELECT * FROM t1; ---source include/diff_master_slave.inc +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc --echo ######################################################################################## --echo # 7 - NON-TRANS TABLE @@ -374,8 +380,8 @@ BEGIN; --enable_query_log COMMIT; -# Incident event ---let $slave_sql_errno=1590 +# 1590=ER_SLAVE_INCIDENT +--let $slave_sql_errno= 1590 --source include/wait_for_slave_sql_error_and_skip.inc sync_slave_with_master; @@ -420,7 +426,7 @@ while ($n) --enable_query_log COMMIT; -connection slave; +--connection slave --let $slave_sql_errno= 1197 source include/wait_for_slave_sql_error.inc; @@ -443,14 +449,16 @@ SELECT count(*) FROM t1; --echo # CLEAN --echo ######################################################################################## ---disable_warnings connection master; DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +# t4 exists only if binlog_format!=row, so so a warning is generated +# if binog_format=row +--disable_warnings DROP TABLE IF EXISTS t4; -DROP TABLE IF EXISTS t5; -DROP TABLE IF EXISTS t6; -DROP PROCEDURE p1; --enable_warnings -source include/master-slave-end.inc; +DROP TABLE t5; +DROP PROCEDURE p1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bit.test b/mysql-test/suite/rpl/t/rpl_bit.test index 07b0778296c..2ee4074c4e3 100644 --- a/mysql-test/suite/rpl/t/rpl_bit.test +++ b/mysql-test/suite/rpl/t/rpl_bit.test @@ -92,3 +92,4 @@ DROP TABLE IF EXISTS test.t1; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bit_npk.test b/mysql-test/suite/rpl/t/rpl_bit_npk.test index 12b587919f9..40f375b92f3 100644 --- a/mysql-test/suite/rpl/t/rpl_bit_npk.test +++ b/mysql-test/suite/rpl/t/rpl_bit_npk.test @@ -114,3 +114,4 @@ DROP TABLE IF EXISTS test.t3; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_blackhole.test b/mysql-test/suite/rpl/t/rpl_blackhole.test index f0c698cb9e2..098cf48c38c 100644 --- a/mysql-test/suite/rpl/t/rpl_blackhole.test +++ b/mysql-test/suite/rpl/t/rpl_blackhole.test @@ -80,4 +80,5 @@ let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 3; source extra/rpl_tests/rpl_blackhole.test; connection master; -drop table t1,t2; +DROP TABLE t1,t2; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug26395.test b/mysql-test/suite/rpl/t/rpl_bug26395.test index 97c152d52e9..aeb0da9511d 100644 --- a/mysql-test/suite/rpl/t/rpl_bug26395.test +++ b/mysql-test/suite/rpl/t/rpl_bug26395.test @@ -95,3 +95,5 @@ connection slave; DROP TABLE tinnodb; # Warning: do not add more tests here. The binlog is in a bad state. +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test index 9176bafe022..d81d646ebe3 100644 --- a/mysql-test/suite/rpl/t/rpl_bug31076.test +++ b/mysql-test/suite/rpl/t/rpl_bug31076.test @@ -134,3 +134,4 @@ SELECT * FROM visits_events; DROP DATABASE track; sync_slave_with_master; --echo End of 5.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test index 3327a36622c..c2cf5811938 100644 --- a/mysql-test/suite/rpl/t/rpl_bug33931.test +++ b/mysql-test/suite/rpl/t/rpl_bug33931.test @@ -3,23 +3,14 @@ # Bug #33932 assertion at handle_slave_sql if init_slave_thread() fails source include/have_debug.inc; -source include/have_log_bin.inc; - -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); - - -connection master; -reset master; +source include/master-slave.inc; connection slave; # Add suppression for expected warnings in slaves error log call mtr.add_suppression("Failed during slave I/O thread initialization"); ---disable_warnings -stop slave; ---enable_warnings +--source include/stop_slave.inc reset slave; # Set debug flags on slave to force errors to occur @@ -27,18 +18,13 @@ SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_ start slave; -connection master; -save_master_pos; -connection slave; - # # slave is going to stop because of emulated failures # but there won't be any crashes nor asserts hit. # -source include/wait_for_slave_to_stop.inc; # 1593 = ER_SLAVE_FATAL_ERROR ---let $slave_sql_errno= 1593 +--let $slave_sql_errno= 1593 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc @@ -47,3 +33,8 @@ source include/wait_for_slave_to_stop.inc; # SET GLOBAL debug=""; +# Clear Last_SQL_Error +RESET SLAVE; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug38694.test b/mysql-test/suite/rpl/t/rpl_bug38694.test index 41b11d271b9..57d7dde0338 100644 --- a/mysql-test/suite/rpl/t/rpl_bug38694.test +++ b/mysql-test/suite/rpl/t/rpl_bug38694.test @@ -7,4 +7,7 @@ source include/master-slave.inc; +call mtr.add_suppression("Aborted connection"); + # End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test index 33bd9d51b11..65af5e72865 100644 --- a/mysql-test/suite/rpl/t/rpl_change_master.test +++ b/mysql-test/suite/rpl/t/rpl_change_master.test @@ -49,3 +49,4 @@ connection slave; sync_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_charset.test b/mysql-test/suite/rpl/t/rpl_charset.test index ed0d835f22d..3ed9147508e 100644 --- a/mysql-test/suite/rpl/t/rpl_charset.test +++ b/mysql-test/suite/rpl/t/rpl_charset.test @@ -1,3 +1,2 @@ let $engine_type=myisam; source extra/rpl_tests/rpl_charset.test; - diff --git a/mysql-test/suite/rpl/t/rpl_charset_sjis.test b/mysql-test/suite/rpl/t/rpl_charset_sjis.test index 2469b0db8a2..a3a3de8c1d0 100644 --- a/mysql-test/suite/rpl/t/rpl_charset_sjis.test +++ b/mysql-test/suite/rpl/t/rpl_charset_sjis.test @@ -23,3 +23,4 @@ sync_slave_with_master; connection master; # End of 5.0 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf index 536551ec3dc..3ff94e458ce 100644 --- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf +++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf @@ -17,11 +17,8 @@ log-slave-updates loose-innodb [ENV] -SLAVE_MYPORT1= @mysqld.3.port -SLAVE_MYSOCK1= @mysqld.3.socket - -SLAVE_MYPORT2= @mysqld.4.port -SLAVE_MYSOCK2= @mysqld.4.socket - - +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket +SERVER_MYPORT_4= @mysqld.4.port +SERVER_MYSOCK_4= @mysqld.4.socket diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test index 3633462d68e..6099637e3e9 100644 --- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test +++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test @@ -1,24 +1,32 @@ -############################################################# -# Author: Serge Kozlov <skozlov@mysql.com> -# Date: 03/12/2008 -# Purpose: Testing circular replication based on schema -# A->B->C->D->A with using AUTO_INCREMENT_INCREMENT, -# AUTO_INCREMENT_OFFSET variables and failover -############################################################# +# ==== Purpose ==== +# +# Setup: circular replication on four hosts, i.e., topology +# server_1 -> server_2 -> server_3 -> server_4 -> server_1 +# +# Tested properties: +# - Correctly configured autoinc works. +# - Manual failover works. +# +# ==== Related bugs and worklogs ==== +# +# WL#3754 +# BUG#49978 + --source include/have_innodb.inc # Set up circular ring and new names for servers ---echo *** Set up circular ring by schema A->B->C->D->A *** ---source include/circular_rpl_for_4_hosts_init.inc +--echo *** Set up circular replication on four servers *** +--let $rpl_topology= 1->2->3->4->1 +--source include/rpl_init.inc --echo # Preparing data. --echo *** Preparing data *** ---connection master_a +--connection server_1 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM; CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB; ---source include/circular_rpl_for_4_hosts_sync.inc ---connection master_d +--source include/rpl_sync.inc +--connection server_4 --echo # @@ -28,121 +36,134 @@ CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, --echo *** Testing schema A->B->C->D->A *** --echo # insert data via all hosts ---connection master_a +--connection server_1 INSERT INTO t1(b,c) VALUES('A',1); ---sync_slave_with_master master_b +--sync_slave_with_master server_2 INSERT INTO t1(b,c) VALUES('B',1); ---sync_slave_with_master master_c +--sync_slave_with_master server_3 INSERT INTO t1(b,c) VALUES('C',1); ---sync_slave_with_master master_d +--sync_slave_with_master server_4 INSERT INTO t1(b,c) VALUES('D',1); ---source include/circular_rpl_for_4_hosts_sync.inc +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 1 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 1 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b; --echo --echo *** Testing schema A->B->D->A if C has failure *** --echo --echo * Do failure for C and then make new connection B->D * + +# Note: server_N has auto_increment_offset=N. Below, we insert value 6 +# in the autoinc column on server_3 (and prevent it from replicating +# further using SQL_SLAVE_SKIP_COUNTER on server_4). Due to the +# auto_increment_offset setting, the autoinc value 6 is normally +# generated on server_2. When we later insert a row on server_2, we +# thus cause a duplicate key error on server_3. + # Do not replicate next event from C ---connection master_d -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2); +--connection server_4 STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; source include/start_slave.inc; -disconnect slave; ---connection master_c +--connection server_3 INSERT INTO t1 VALUES(6,'C',2); ---save_master_pos ---connection master_b +--sync_slave_with_master server_4 + +--connection server_2 INSERT INTO t1(b,c) VALUES('B',2); # Wait while C will stop. ---connection master_c -source include/wait_for_slave_sql_to_stop.inc; ---connection master_a +--connection server_3 +# 1062 = ER_DUP_ENTRY +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc +--connection server_1 INSERT INTO t1(b,c) VALUES('A',2); ---connection master_d +--connection server_4 INSERT INTO t1(b,c) VALUES('D',2); # Sync all servers except C ---connection master_b +--connection server_2 let $wait_condition= SELECT COUNT(*)=3 FROM t1 WHERE a > 4; +--let $server_connection= server_1 --source include/wait_condition.inc --echo --echo * Data on servers (C failed) * # Masters C,D shouldn't have correct data ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b; --echo --echo * Reconfigure replication to schema A->B->D->A * # Exclude Master C ---connection master_c -STOP SLAVE; +--connection server_3 +--source include/stop_slave_io.inc --let $pos_c= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) --let $file_c= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1) ---connection master_d -STOP SLAVE; ---replace_result $SLAVE_MYPORT MASTER_B_PORT $file_c LOG_FILE $pos_c LOG_POS ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',master_log_file='$file_c',master_log_pos=$pos_c -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2); + +--connection server_4 +--source include/stop_slave.inc + +--let $rpl_topology= 1->2->4->1,2->3 +--let $rpl_master_log_file= 4:$file_c +--let $rpl_master_log_pos= 4:$pos_c +--source include/rpl_change_topology.inc + +#--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 $file_c LOG_FILE $pos_c LOG_POS +#--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SERVER_MYPORT_2,master_user='root',master_log_file='$file_c',master_log_pos=$pos_c source include/start_slave.inc; -disconnect slave; ---connection master_b ---sync_slave_with_master master_d ---sync_slave_with_master master_a +--connection server_2 +--sync_slave_with_master server_4 +--sync_slave_with_master server_1 --echo --echo * Check data inserted before failure * ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b; --echo --echo * Check data inserted after failure * ---connection master_a +--connection server_1 INSERT INTO t1(b,c) VALUES('A',3); ---connection master_b +--connection server_2 INSERT INTO t1(b,c) VALUES('B',3); ---connection master_d +--connection server_4 INSERT INTO t1(b,c) VALUES('D',3); -connection master_a; +connection server_1; ---sync_slave_with_master master_b ---sync_slave_with_master master_d ---sync_slave_with_master master_a ---sync_slave_with_master master_b +--let $rpl_only_running_threads= 1 +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 3 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 3 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b; ---connection master_a +--connection server_1 --echo --echo *** Testing restoring scheme A->B->C->D->A after failure *** @@ -150,158 +171,150 @@ SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b; # Master D will ignore a next event from C so that event will not be # distributed to other servers --echo * Remove wrong event from C and restore B->C->D * ---connection master_d +--connection server_4 source include/stop_slave.inc; ---connection master_c +--connection server_3 DELETE FROM t1 WHERE a = 6; START SLAVE; ---connection master_b ---sync_slave_with_master master_c +--connection server_2 +--sync_slave_with_master server_3 RESET MASTER; --let $file_d= query_get_value(SHOW MASTER STATUS, File, 1) --let $pos_d= query_get_value(SHOW MASTER STATUS, Position, 1) ---connection master_d +--connection server_4 RESET SLAVE; ---replace_result $SLAVE_MYPORT1 MASTER_C_PORT $file_d LOG_FILE $pos_d LOG_POS ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',master_log_file='$file_d',master_log_pos=$pos_d +--let $rpl_topology= 1->2->3->4->1 +--let $rpl_master_log_file= 4:$file_d +--let $rpl_master_log_pos= 4:$pos_d +--source include/rpl_change_topology.inc +#--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 $file_d LOG_FILE $pos_d LOG_POS +#--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SERVER_MYPORT_3,master_user='root',master_log_file='$file_d',master_log_pos=$pos_d START SLAVE; ---connection master_c ---sync_slave_with_master master_d ---source include/circular_rpl_for_4_hosts_sync.inc +--connection server_3 +--sync_slave_with_master server_4 +--source include/rpl_sync.inc --echo --echo * Check data inserted before restoring schema A->B->C->D->A * ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; ---sync_slave_with_master master_b +--sync_slave_with_master server_2 SELECT 'Master B',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; ---sync_slave_with_master master_c +--sync_slave_with_master server_3 SELECT 'Master C',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; ---sync_slave_with_master master_d +--sync_slave_with_master server_4 SELECT 'Master D',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; ---sync_slave_with_master master_a +--sync_slave_with_master server_1 --echo --echo * Check data inserted after restoring schema A->B->C->D->A * ---connection master_a +--connection server_1 INSERT INTO t1(b,c) VALUES('A',4); ---connection master_b +--connection server_2 INSERT INTO t1(b,c) VALUES('B',4); ---connection master_c +--connection server_3 INSERT INTO t1(b,c) VALUES('C',4); ---connection master_d +--connection server_4 INSERT INTO t1(b,c) VALUES('D',4); ---connection master_a +--connection server_1 ---source include/circular_rpl_for_4_hosts_sync.inc +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 4 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 4 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 4 ORDER BY a,b; ---connection master_a +--connection server_1 --echo --echo * Transactions with commits * # Testing mixing of transactions and regular inserts ---connection master_a +--connection server_1 BEGIN; ---connection master_c +--connection server_3 BEGIN; let $counter= 100; ---connection master_a +--connection server_1 --disable_query_log while ($counter) { - --connection master_a + --connection server_1 INSERT INTO t2(b,c) VALUES('A',1); - --connection master_b + --connection server_2 INSERT INTO t2(b,c) VALUES('B',1); - --connection master_c + --connection server_3 INSERT INTO t2(b,c) VALUES('C',1); - --connection master_d + --connection server_4 INSERT INTO t2(b,c) VALUES('D',1); dec $counter; } ---connection master_a +--connection server_1 COMMIT; ---connection master_c +--connection server_3 COMMIT; ---connection master_a +--connection server_1 --enable_query_log ---source include/circular_rpl_for_4_hosts_sync.inc +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; ---connection master_b +--connection server_2 SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; ---connection master_c +--connection server_3 SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; ---connection master_d +--connection server_4 SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; ---connection master_a +--connection server_1 --echo --echo * Transactions with rollbacks * # Testing mixing of transactions with rollback and regular inserts ---connection master_a +--connection server_1 BEGIN; ---connection master_c +--connection server_3 BEGIN; let $counter= 100; ---connection master_a +--connection server_1 --disable_query_log while ($counter) { - --connection master_a + --connection server_1 INSERT INTO t2(b,c) VALUES('A',2); - --connection master_b + --connection server_2 INSERT INTO t2(b,c) VALUES('B',2); - --connection master_c + --connection server_3 INSERT INTO t2(b,c) VALUES('C',2); - --connection master_d + --connection server_4 INSERT INTO t2(b,c) VALUES('D',2); dec $counter; } ---connection master_a +--connection server_1 ROLLBACK; ---connection master_c +--connection server_3 ROLLBACK; ---connection master_a +--connection server_1 --enable_query_log ---source include/circular_rpl_for_4_hosts_sync.inc +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; ---connection master_b +--connection server_2 SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; ---connection master_c +--connection server_3 SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; ---connection master_d +--connection server_4 SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; ---connection master_a +--connection server_1 --echo # Clean up --echo *** Clean up *** ---connection master_a +--connection server_1 DROP TABLE t1,t2; ---source include/circular_rpl_for_4_hosts_sync.inc ---connection master_a -STOP SLAVE; -RESET SLAVE; ---connection master_b -STOP SLAVE; -RESET SLAVE; ---connection master_c -STOP SLAVE; -RESET SLAVE; ---connection master_d -STOP SLAVE; -RESET SLAVE; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_colSize.test b/mysql-test/suite/rpl/t/rpl_colSize.test index c20f2c3fd35..0a64817bf36 100644 --- a/mysql-test/suite/rpl/t/rpl_colSize.test +++ b/mysql-test/suite/rpl/t/rpl_colSize.test @@ -218,3 +218,4 @@ DROP TABLE t1; sync_slave_with_master; # END 5.1 Test Case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_commit_after_flush.test b/mysql-test/suite/rpl/t/rpl_commit_after_flush.test index 47df391d6be..5e070b14301 100644 --- a/mysql-test/suite/rpl/t/rpl_commit_after_flush.test +++ b/mysql-test/suite/rpl/t/rpl_commit_after_flush.test @@ -1,12 +1,6 @@ -##################################### -# Wrapper for rpl_commit_after_flush# -##################################### -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc -- source include/master-slave.inc let $engine_type=innodb; -- source extra/rpl_tests/rpl_commit_after_flush.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_concurrency_error.test b/mysql-test/suite/rpl/t/rpl_concurrency_error.test index da2951afb1a..a5c77e830d6 100644 --- a/mysql-test/suite/rpl/t/rpl_concurrency_error.test +++ b/mysql-test/suite/rpl/t/rpl_concurrency_error.test @@ -125,13 +125,11 @@ while ($type) connection master; sync_slave_with_master; -connection master; -let $diff_statement= SELECT * FROM t order by i; -source include/diff_master_slave.inc; +let $rpl_diff_statement= SELECT * FROM t order by i; +source include/rpl_diff.inc; -connection master; -let $diff_statement= SELECT * FROM n order by d, f; -source include/diff_master_slave.inc; +let $rpl_diff_statement= SELECT * FROM n order by d, f; +source include/rpl_diff.inc; --echo ######################################################################## --echo # Cleanup @@ -147,3 +145,4 @@ sync_slave_with_master; connection master; disconnect conn1; disconnect conn2; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_conditional_comments.test b/mysql-test/suite/rpl/t/rpl_conditional_comments.test index 14251d5eb37..88adf3a20f1 100644 --- a/mysql-test/suite/rpl/t/rpl_conditional_comments.test +++ b/mysql-test/suite/rpl/t/rpl_conditional_comments.test @@ -26,15 +26,15 @@ let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); source include/show_binlog_events.inc; let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; -source include/diff_tables.inc; +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc --echo --echo # Case 2: --echo # ----------------------------------------------------------------- --echo # Verify whether it can be binlogged correctly when executing prepared --echo # statement. +--connection master PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/'; EXECUTE stmt; DROP TABLE t1; @@ -42,10 +42,10 @@ CREATE TABLE t1(c1 INT); EXECUTE stmt; sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; -source include/diff_tables.inc; +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc +--connection master --echo SET @value=62; PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/'; @@ -58,17 +58,17 @@ source include/show_binlog_events.inc; let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; -source include/diff_tables.inc; +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc --echo --echo # Case 3: --echo # ----------------------------------------------------------------- --echo # Verify it can restore the '!', if the it is an uncomplete conditional --echo # comments +--connection master --error 1064 SELECT c1 FROM /*!99999 t1 WHEREN; DROP TABLE t1; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_create_database.test b/mysql-test/suite/rpl/t/rpl_create_database.test index e3e2e637594..5eac3de0d15 100644 --- a/mysql-test/suite/rpl/t/rpl_create_database.test +++ b/mysql-test/suite/rpl/t/rpl_create_database.test @@ -70,3 +70,4 @@ DROP DATABASE IF EXISTS mysqltest_bob; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test b/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test index cf26e58c3ec..12183531677 100644 --- a/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test +++ b/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test @@ -147,4 +147,4 @@ sync_slave_with_master; connection master; DROP TABLE t1; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test b/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test index a06dfa54cb1..daf6b7e9ad8 100644 --- a/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test +++ b/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test @@ -38,4 +38,4 @@ CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; source include/show_binlog_events.inc; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_critical_errors.test b/mysql-test/suite/rpl/t/rpl_critical_errors.test index aa1f251b738..bc0d7096f80 100644 --- a/mysql-test/suite/rpl/t/rpl_critical_errors.test +++ b/mysql-test/suite/rpl/t/rpl_critical_errors.test @@ -35,7 +35,7 @@ connection master1; # This sleep is picked so that the query above has started to insert # some rows into t2. If it hasn't the slave will not stop below. let $wait_condition= SELECT COUNT(*) > 1000 FROM t1; -source include/wait_condition.inc +--source include/wait_condition.inc # SHOW PROCESSLIST; @@ -62,4 +62,5 @@ connection slave; # The following should be 0 SELECT COUNT(*) FROM t2; +--source include/rpl_end.inc enable_parsing; diff --git a/mysql-test/suite/rpl/t/rpl_cross_version-master.opt b/mysql-test/suite/rpl/t/rpl_cross_version-master.opt index 0ea05290c11..2b2d357b124 100644 --- a/mysql-test/suite/rpl/t/rpl_cross_version-master.opt +++ b/mysql-test/suite/rpl/t/rpl_cross_version-master.opt @@ -1 +1,2 @@ --replicate-same-server-id --relay-log=slave-relay-bin --secure-file-priv=$MYSQL_TMP_DIR +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_cross_version.test b/mysql-test/suite/rpl/t/rpl_cross_version.test index 8cd268a5fd9..d3e834b5358 100644 --- a/mysql-test/suite/rpl/t/rpl_cross_version.test +++ b/mysql-test/suite/rpl/t/rpl_cross_version.test @@ -10,7 +10,7 @@ # The master's binlog is treated as a relay log that the SQL thread executes. # ---source include/have_log_bin.inc +--source include/master-slave.inc # The test is disabled for windows due to # Bug #42879 CHANGE MASTER RELAY_LOG_FILE=path fails on windows @@ -22,6 +22,10 @@ # --echo ==== Initialize ==== +--connection slave +--source include/stop_slave.inc +RESET SLAVE; + # the relay log contains create t1, t3 tables and load data infile --let $fake_relay_log = $MYSQL_TEST_DIR/suite/binlog/std_data/binlog_old_version_4_1.000001 --source include/setup_fake_relay_log.inc @@ -36,6 +40,8 @@ start slave sql_thread; SELECT COUNT(*) - 17920 as zero FROM t3; --echo ==== Clean up ==== -stop slave sql_thread; +--source include/stop_slave_sql.inc --source include/cleanup_fake_relay_log.inc drop table t1, t3; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_current_user-master.opt b/mysql-test/suite/rpl/t/rpl_current_user-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_current_user-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_current_user.cnf b/mysql-test/suite/rpl/t/rpl_current_user.cnf index 999ee727a88..58b605ad928 100644 --- a/mysql-test/suite/rpl/t/rpl_current_user.cnf +++ b/mysql-test/suite/rpl/t/rpl_current_user.cnf @@ -1,9 +1,8 @@ !include ../my.cnf [mysqld.3] -server-id=3 -log-bin=slave-bin +log-slave-updates [ENV] -SLAVE_MYPORT1= @mysqld.3.port -SLAVE_MYSOCK1= @mysqld.3.socket +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/rpl_current_user.test b/mysql-test/suite/rpl/t/rpl_current_user.test index 72581ed7049..bdb53cbcdfe 100644 --- a/mysql-test/suite/rpl/t/rpl_current_user.test +++ b/mysql-test/suite/rpl/t/rpl_current_user.test @@ -10,34 +10,22 @@ # 'ALTER EVENT'. # ############################################################################## -source include/master-slave.inc; + source include/have_binlog_format_statement.inc; ---echo ---echo # On slave2 -connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,); -connection slave2; +--let $rpl_topology= 1->2->3 +--source include/rpl_init.inc ---echo # Connect slave2 to slave ---replace_result $SLAVE_MYPORT SLAVE_MYPORT; -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, - MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; -START SLAVE; -source include/wait_for_slave_to_start.inc; +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave +--let $rpl_server_number= 2 +--source include/rpl_connect.inc + +--connection master ---echo ---echo # [On master] -connection master; ---disable_warnings -DROP VIEW IF EXISTS v_user; -DROP VIEW IF EXISTS v_tables_priv; -DROP VIEW IF EXISTS v_procs_priv; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS my_grant; -DROP PROCEDURE IF EXISTS my_revoke; -DROP FUNCTION IF EXISTS my_user; -DROP EVENT IF EXISTS e1; ---enable_warnings CREATE TABLE t1(c1 char(100)); CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; @@ -63,75 +51,76 @@ connection conn1; --echo # [On conn1] --echo # Verify 'REVOKE ALL' statement REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); -let $diff_table= test.v_user; -let $diff_server_list= master, slave, slave2; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user; +source include/diff_tables.inc; --echo --echo # Verify 'GRANT ... ON TABLE ...' statement -connection conn1; GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv; +source include/diff_tables.inc; --echo --echo # Verify 'GRANT ... ON PROCEDURE...' statement -connection conn1; GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); -let $diff_table= test.v_procs_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv; +source include/diff_tables.inc; --echo --echo # Verify 'GRANT ... ON *.* ...' statement -connection conn1; GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv; +source include/diff_tables.inc; --echo --echo # Verify 'REVOKE ... ON TABLE ...' statement -connection conn1; REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv; +source include/diff_tables.inc; --echo --echo # Verify 'REVOKE ... ON PROCEDURE...' statement -connection conn1; REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); -let $diff_table= test.v_procs_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv; +source include/diff_tables.inc; --echo --echo # Verify 'REVOKE ... ON *.* ...' statement -connection conn1; REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); -let $diff_table= test.v_user; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user; +source include/diff_tables.inc; --echo --echo # Verify 'GRANT ...' statement in the procedure -connection conn1; CREATE PROCEDURE my_grant() GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); call my_grant; -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv; +source include/diff_tables.inc; --echo --echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure -connection conn1; CREATE PROCEDURE my_revoke() REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); call my_revoke; -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv; +source include/diff_tables.inc; --echo --echo # Verify 'RENAME USER ...' statement -connection conn1; RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; -let $diff_table= test.v_user; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user; +source include/diff_tables.inc; disconnect conn1; @@ -142,7 +131,9 @@ GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,); connection conn1; DROP USER CURRENT_USER(); -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user; +source include/diff_tables.inc; --echo --echo # Verify 'ALTER EVENT...' statement @@ -151,16 +142,17 @@ CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; --echo # Explicitly assign CURRENT_USER() to definer ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; -let $diff_table= test.v_event; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_event, server_2:v_event, server_3:v_event; +source include/diff_tables.inc; -connection master; --echo --echo # Session user will be set as definer, if the statement does not assign --echo # a definer ALTER EVENT e1 ENABLE; -sync_slave_with_master; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_event, server_2:v_event, server_3:v_event; +source include/diff_tables.inc; --echo --echo # Verify that this patch does not affect the calling of CURRENT_USER() @@ -172,8 +164,8 @@ SELECT * FROM t1; sync_slave_with_master; --echo # [On slave] SELECT * FROM t1; ---echo # [On slave2] -sync_slave_with_master slave2; +--echo # [On server_3] +sync_slave_with_master server_3; SELECT * FROM t1; connection master; @@ -183,8 +175,8 @@ SELECT * FROM t1; sync_slave_with_master; --echo # [On slave] SELECT * FROM t1; -sync_slave_with_master slave2; ---echo # [On slave2] +sync_slave_with_master server_3; +--echo # [On server_3] SELECT * FROM t1; connection master; @@ -194,8 +186,8 @@ SELECT * FROM t1; sync_slave_with_master; --echo # [On slave] SELECT * FROM t1; -sync_slave_with_master slave2; ---echo # [On slave2] +sync_slave_with_master server_3; +--echo # [On server_3] SELECT * FROM t1; connection master; @@ -218,8 +210,8 @@ sync_slave_with_master; --echo # [On slave] SELECT * FROM t1; SELECT * FROM t2; -sync_slave_with_master slave2; ---echo # [On slave2] +sync_slave_with_master server_3; +--echo # [On server_3] SELECT * FROM t1; SELECT * FROM t2; @@ -233,6 +225,5 @@ DROP PROCEDURE my_grant; DROP PROCEDURE my_revoke; DROP FUNCTION my_user; DROP EVENT e1; -sync_slave_with_master; -sync_slave_with_master slave2; -source include/master-slave-end.inc; +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_ddl.test b/mysql-test/suite/rpl/t/rpl_ddl.test index 80df16a7a00..83a530131a6 100644 --- a/mysql-test/suite/rpl/t/rpl_ddl.test +++ b/mysql-test/suite/rpl/t/rpl_ddl.test @@ -30,3 +30,4 @@ let $temp_engine_type= MEMORY; let $show_binlog = 0; let $manipulate = 0; -- source extra/rpl_tests/rpl_ddl.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test b/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test index ee907f81b22..14776263516 100644 --- a/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test @@ -1,11 +1,5 @@ -################################ -# Wrapper for rpl_deadlock.test# -################################ -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc +-- source include/long_test.inc let $engine_type=innodb; -- source extra/rpl_tests/rpl_deadlock.test diff --git a/mysql-test/suite/rpl/t/rpl_delete_no_where.test b/mysql-test/suite/rpl/t/rpl_delete_no_where.test index 64a293b4058..4bfe6d07b5a 100644 --- a/mysql-test/suite/rpl/t/rpl_delete_no_where.test +++ b/mysql-test/suite/rpl/t/rpl_delete_no_where.test @@ -5,3 +5,4 @@ -- source include/master-slave.inc let $engine_type=myisam; -- source extra/rpl_tests/rpl_delete_no_where.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index bbc78bfbe9a..54d9a076245 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -221,17 +221,19 @@ stop slave; connection master; # user was already dropped in the slave before -# so no need to wait for the slave to replicate -# this statement (if it did and we later synced -# the slave it would end up in an error anyway) +# so we should not replicate this statement. +SET SQL_LOG_BIN= 0; DROP USER 'create_rout_db'@'localhost'; +SET SQL_LOG_BIN= 1; --enable_warnings # finish entire clean up (remove binlogs) # so that we leave a pristine environment for the # following tests --- source include/master-slave-reset.inc +--let $rpl_only_running_threads= 1 +-- source include/rpl_reset.inc +USE test; # BUG#49119: Master crashes when executing 'REVOKE ... ON # {PROCEDURE|FUNCTION} FROM ...' @@ -256,7 +258,7 @@ DROP USER 'create_rout_db'@'localhost'; -- echo ######## BUG#49119 ####### -- echo ### i) test case from the 'how to repeat section' --- source include/master-slave-reset.inc + -- connection master CREATE TABLE t1(c1 INT); @@ -277,7 +279,7 @@ DROP PROCEDURE p1; -- echo ### ii) Test case in which REVOKE partially succeeds -- connection master --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master CREATE TABLE t1(c1 INT); @@ -337,8 +339,7 @@ DROP USER 'user49119'@'localhost'; # Bug #51987 revoke privileges logs wrong error code # --- connection master --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master grant all on *.* to foo@"1.2.3.4"; @@ -352,11 +353,7 @@ revoke all privileges, grant option from "foo"; ## assertion: slave replicates revoke and does not fail because master ## logged revoke with correct expected error code --- let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1) - if ($err) -{ - -- die UNEXPECTED ERROR AT SLAVE: $err -} +--source include/check_slave_no_error.inc -- connection master DROP USER foo@"1.2.3.4"; @@ -364,8 +361,7 @@ DROP USER foo@"1.2.3.4"; --echo --echo # Bug#27606 GRANT statement should be replicated with DEFINER information ---connection master ---source include/master-slave-reset.inc +--source include/rpl_reset.inc --connection master GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost; @@ -382,5 +378,5 @@ SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; --connection master DROP USER user_bug27606@localhost; ---source include/master-slave-end.inc --echo "End of test" +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_drop.test b/mysql-test/suite/rpl/t/rpl_drop.test index 336edad6fc5..748a5759513 100644 --- a/mysql-test/suite/rpl/t/rpl_drop.test +++ b/mysql-test/suite/rpl/t/rpl_drop.test @@ -2,15 +2,12 @@ # exist, must be binlogged with a non-zero error code) source include/master-slave.inc; source include/have_innodb.inc; ---disable_warnings -drop table if exists t1, t2; ---enable_warnings + create table t1 (a int); --error 1051 drop table t1, t2; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master + # End of 4.1 tests # BUG#55625 RBR breaks on failing 'CREATE TABLE' @@ -65,3 +62,5 @@ SET @@global.binlog_format= @old_binlog_format; SET @@global.binlog_format= @old_binlog_format; # End of 5.1 tests + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test index 11e93e7307a..c3194f08f52 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_db.test +++ b/mysql-test/suite/rpl/t/rpl_drop_db.test @@ -58,4 +58,5 @@ drop table t1; drop database mysqltest1; sync_slave_with_master; -source include/stop_slave.inc; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_drop_temp.test b/mysql-test/suite/rpl/t/rpl_drop_temp.test index f2a4dd70da6..0b6d1458893 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_temp.test +++ b/mysql-test/suite/rpl/t/rpl_drop_temp.test @@ -67,3 +67,4 @@ connection master; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_drop_view.test b/mysql-test/suite/rpl/t/rpl_drop_view.test index 11633a0a7e8..99c5edb928d 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_view.test +++ b/mysql-test/suite/rpl/t/rpl_drop_view.test @@ -34,3 +34,4 @@ select * from v3; connection master; drop table t1, t2, t3; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test index ab1de6a2e9f..618576f5641 100644 --- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test +++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test @@ -6,33 +6,21 @@ # of their server id). # It also will test BUG#13861. -source include/master-slave.inc; source include/have_innodb.inc; - -# set up "dual head" - -# Needed for debug info in wait_for_slave_sql_to_stop. -let $master_connection= slave; -connection slave; -reset master; - -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root"; - -source include/start_slave.inc; +--let $rpl_topology= 1->2->1 +--source include/rpl_init.inc # now we test it -connection slave; +connection server_2; create table t1 (n int); let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1); let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1); let $master_log_pos_1= `SELECT $master_log_pos_1 + 3`; -sync_slave_with_master master; +--sync_slave_with_master server_1 # # BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if @@ -42,7 +30,7 @@ source include/stop_slave.inc; create table t2 (n int); # create one ignored event -sync_slave_with_master; +--sync_slave_with_master server_2 show tables; @@ -59,7 +47,8 @@ insert into t3 values(3); commit; insert into t3 values(4); -connection master; + +connection server_1; # bug is that START SLAVE UNTIL may stop too late, we test that by # asking it to stop before creation of t3. @@ -89,26 +78,20 @@ source include/start_slave.inc; # BUG#13023 is that Exec_master_log_pos may stay too low "forever": -connection master; +connection server_1; create table t4 (n int); # create 3 ignored events create table t5 (n int); create table t6 (n int); -sync_slave_with_master; -sync_slave_with_master master; +--sync_slave_with_master server_2 # then BUG#13023 caused hang below ("master" looks behind, while it's # not in terms of updates done). +--sync_slave_with_master server_1 show tables; # cleanup - -source include/stop_slave.inc; -reset slave; -drop table t1,t2,t3,t4,t5,t6; - -sync_slave_with_master; - -# End of 4.1 tests +drop table t1, t2, t3, t4, t5, t6; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_empty_master_crash.test b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test index 863b450a6d9..a657b82fc94 100644 --- a/mysql-test/suite/rpl/t/rpl_empty_master_crash.test +++ b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test @@ -10,3 +10,4 @@ connection slave; load table t1 from master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test index f358c0ee356..01ef5298e48 100644 --- a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test +++ b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test @@ -62,3 +62,6 @@ DROP TABLE test.t4; sync_slave_with_master; # End of 4.1 tests # Adding comment for force manual merge 5.0 -> wl1012. delete me if needed + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test index 327ad9bf22c..ed5ebd3dbc4 100644 --- a/mysql-test/suite/rpl/t/rpl_events.test +++ b/mysql-test/suite/rpl/t/rpl_events.test @@ -111,3 +111,4 @@ DROP EVENT event44331_2; DROP EVENT event44331_3; DROP EVENT event44331_4; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_innodb.test b/mysql-test/suite/rpl/t/rpl_extraCol_innodb.test deleted file mode 100644 index e9685baf01b..00000000000 --- a/mysql-test/suite/rpl/t/rpl_extraCol_innodb.test +++ /dev/null @@ -1,13 +0,0 @@ -########################################### -# Author: Jeb -# Date: 2006-09-08 -# Purpose: Wapper for rpl_extraSlave_Col.test -# Using innodb -########################################### --- source include/have_binlog_format_row.inc --- source include/have_innodb.inc --- source include/master-slave.inc -let $engine_type = 'InnoDB'; --- source extra/rpl_tests/rpl_extraSlave_Col.test - - diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_myisam.test b/mysql-test/suite/rpl/t/rpl_extraCol_myisam.test deleted file mode 100644 index d56df394ccf..00000000000 --- a/mysql-test/suite/rpl/t/rpl_extraCol_myisam.test +++ /dev/null @@ -1,12 +0,0 @@ -########################################### -# Author: Jeb -# Date: 2006-09-07 -# Purpose: Wapper for rpl_extraSlave_Col.test -# Using MyISAM -########################################### --- source include/have_binlog_format_row.inc --- source include/master-slave.inc -let $engine_type = 'MyISAM'; --- source extra/rpl_tests/rpl_extraSlave_Col.test - - diff --git a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test b/mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test index 5255a9cfbad..11211e51286 100644 --- a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test @@ -7,10 +7,11 @@ let $engine_type = 'InnoDB'; set binlog_format=row; --- source extra/rpl_tests/rpl_extraMaster_Col.test +-- source extra/rpl_tests/rpl_extra_col_master.test set binlog_format=statement; --- source extra/rpl_tests/rpl_extraMaster_Col.test +-- source extra/rpl_tests/rpl_extra_col_master.test set binlog_format=mixed; --- source extra/rpl_tests/rpl_extraMaster_Col.test +-- source extra/rpl_tests/rpl_extra_col_master.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test b/mysql-test/suite/rpl/t/rpl_extra_col_master_myisam.test index e6b41eabd0d..2343d430784 100644 --- a/mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_extra_col_master_myisam.test @@ -6,10 +6,11 @@ let $engine_type = 'MyISAM'; set binlog_format=row; --- source extra/rpl_tests/rpl_extraMaster_Col.test +-- source extra/rpl_tests/rpl_extra_col_master.test set binlog_format=statement; --- source extra/rpl_tests/rpl_extraMaster_Col.test +-- source extra/rpl_tests/rpl_extra_col_master.test set binlog_format=mixed; --- source extra/rpl_tests/rpl_extraMaster_Col.test +-- source extra/rpl_tests/rpl_extra_col_master.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test b/mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test new file mode 100644 index 00000000000..8b2cb2ded1c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test @@ -0,0 +1,6 @@ +-- source include/have_binlog_format_row.inc +-- source include/have_innodb.inc +-- source include/master-slave.inc +let $engine_type = 'InnoDB'; +-- source extra/rpl_tests/rpl_extra_col_slave.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test b/mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test new file mode 100644 index 00000000000..52d312de878 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test @@ -0,0 +1,5 @@ +-- source include/have_binlog_format_row.inc +-- source include/master-slave.inc +let $engine_type = 'MyISAM'; +-- source extra/rpl_tests/rpl_extra_col_slave.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_failed_optimize.test b/mysql-test/suite/rpl/t/rpl_failed_optimize.test index 81e8342b5c0..798b3ef8b41 100644 --- a/mysql-test/suite/rpl/t/rpl_failed_optimize.test +++ b/mysql-test/suite/rpl/t/rpl_failed_optimize.test @@ -1,10 +1,3 @@ -####################################### -# Wrapper for rpl_failed_optimize.test# -####################################### -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test index aa2dee0fe57..8e1c9eb98b2 100644 --- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test +++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test @@ -204,4 +204,4 @@ SELECT * FROM t3; connection master; echo [on master]; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt index 95bca94fd3a..eb35347af33 100644 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt +++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt @@ -1 +1 @@ --O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.1/data/relay-log +-O max_binlog_size=1M diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh deleted file mode 100755 index a321dd690cd..00000000000 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh +++ /dev/null @@ -1,5 +0,0 @@ -rm -f $MYSQLTEST_VARDIR/slave-data/*-bin.* -rm -f $MYSQLTEST_VARDIR/slave-data/master.info -rm -f $MYSQLTEST_VARDIR/slave-data/*.index - - diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt index e2aa63225a3..eb35347af33 100644 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt @@ -1 +1 @@ --O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.2/data/relay-log +-O max_binlog_size=1M diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh deleted file mode 100755 index e46ea6d400b..00000000000 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh +++ /dev/null @@ -1,4 +0,0 @@ -rm -f $MYSQLTEST_VARDIR/master-data/master.info -rm -f $MYSQLTEST_VARDIR/master-data/*-bin.* -rm -f $MYSQLTEST_VARDIR/master-data/*.index - diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test index 487f910ba2b..d5d362bac0f 100644 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test +++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test @@ -1,33 +1,12 @@ # Testing if "flush logs" command bouncing resulting in logs created in a loop # in case of bi-directional replication --- source include/master-slave.inc +--let $rpl_topology= 1->2->1 +--source include/rpl_init.inc let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/ show variables like 'relay_log%'; -connection slave; ---disable_warnings -stop slave; ---enable_warnings ---replace_result $MASTER_MYPORT MASTER_PORT -eval change master to master_host='127.0.0.1',master_user='root', - master_password='',master_port=$MASTER_MYPORT; -start slave; - -# -# Start replication slave -> master -# -connection master; ---disable_warnings -stop slave; ---enable_warnings ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval change master to master_host='127.0.0.1',master_user='root', - master_password='',master_port=$SLAVE_MYPORT; - -source include/start_slave.inc; - # # Flush logs of slave # @@ -39,16 +18,16 @@ source include/start_slave.inc; CREATE TABLE t1 (a INT KEY) ENGINE= MyISAM; let $wait_binlog_event= CREATE TABLE t1; --source include/wait_for_binlog_event.inc -sync_slave_with_master; +sync_slave_with_master server_2; -connection master; +connection server_1; INSERT INTO t1 VALUE(1); FLUSH LOGS; -sync_slave_with_master; +sync_slave_with_master server_2; INSERT INTO t1 VALUE(2); let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1); -sync_slave_with_master master; +sync_slave_with_master server_1; # # Check that the master server's slave threads are still running and show @@ -59,7 +38,9 @@ sync_slave_with_master master; --source include/show_slave_status.inc --disable_query_log -connection master; +connection server_1; DROP TABLE t1; -sync_slave_with_master; +sync_slave_with_master server_2; --enable_query_log + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test index d085bff2012..ce28c0334ec 100644 --- a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test @@ -1,10 +1,3 @@ -################################### -# Wrapper for rpl_foreign_key.test# -################################### -# Change Author: JBM -# Change Date: 2006-01-17 -# Change: FK not supported, skip test when NDB is forced -#################################### -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=INNODB; diff --git a/mysql-test/suite/rpl/t/rpl_found_rows.test b/mysql-test/suite/rpl/t/rpl_found_rows.test index ff8d2c3107a..3e5d741d788 100644 --- a/mysql-test/suite/rpl/t/rpl_found_rows.test +++ b/mysql-test/suite/rpl/t/rpl_found_rows.test @@ -114,9 +114,8 @@ DELETE FROM logtbl; DROP PROCEDURE just_log; DROP PROCEDURE calc_and_log; DROP FUNCTION log_rows; -sync_slave_with_master; -source include/reset_master_and_slave.inc; +--source include/rpl_reset.inc --echo #### 2. Using mixed mode #### @@ -254,3 +253,4 @@ DROP PROCEDURE log_me_inner; DROP FUNCTION log_rows; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_free_items.test b/mysql-test/suite/rpl/t/rpl_free_items.test index 043e84160b8..581409cfc10 100644 --- a/mysql-test/suite/rpl/t/rpl_free_items.test +++ b/mysql-test/suite/rpl/t/rpl_free_items.test @@ -20,3 +20,4 @@ drop table t2; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_geometry.test b/mysql-test/suite/rpl/t/rpl_geometry.test index eac98924b98..769c49c96b1 100644 --- a/mysql-test/suite/rpl/t/rpl_geometry.test +++ b/mysql-test/suite/rpl/t/rpl_geometry.test @@ -23,4 +23,4 @@ sync_slave_with_master; connection master; drop table t1, t2; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_get_lock.test b/mysql-test/suite/rpl/t/rpl_get_lock.test index 87366f41ba2..f87932113ac 100644 --- a/mysql-test/suite/rpl/t/rpl_get_lock.test +++ b/mysql-test/suite/rpl/t/rpl_get_lock.test @@ -22,9 +22,7 @@ while ($1) dec $1; } enable_query_log; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select get_lock("lock",3); select * from t1; # There is no point in testing REPLICATIION of the IS_*_LOCK @@ -41,8 +39,9 @@ select is_free_lock("lock2"); select is_free_lock(NULL); connection master1; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; + + +--source include/rpl_end.inc # End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test index 28f13c17042..ec1d6d57555 100644 --- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test +++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test @@ -7,12 +7,6 @@ # So they can't be verified by test case here. # Finish the following tests by calling its common test script: # extra/rpl_tests/rpl_get_master_version_and_clock.test. -# And meanwhile this test checks that the slave I/O thread refuses to start if slave -# and master have the same server id (because this is a useless setup, -# and otherwise SHOW SLAVE STATUS shows progress but all queries are -# ignored, which has caught our customers), unless -# --replicate-same-server-id. -# source include/master-slave.inc; source include/have_debug.inc; @@ -47,20 +41,6 @@ source extra/rpl_tests/rpl_get_master_version_and_clock.test; eval set global debug= '$debug_saved'; -#Test case 3: This test checks that the slave I/O thread refuses to start -#if slave and master have the same server id. -connection slave; -reset master; -# replicate ourselves -source include/stop_slave.inc; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval change master to master_port=$SLAVE_MYPORT; -start slave; - ---echo *** must be having the replicate-same-server-id IO thread error *** -let $slave_io_errno= 1593; -let $show_slave_io_error= 1; -source include/wait_for_slave_io_error.inc; # cleanup @@ -68,3 +48,4 @@ source include/wait_for_slave_io_error.inc; SET DEBUG_SYNC= 'RESET'; # End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_grant.test b/mysql-test/suite/rpl/t/rpl_grant.test index 6fbdafc0f9c..1091e5aab0d 100644 --- a/mysql-test/suite/rpl/t/rpl_grant.test +++ b/mysql-test/suite/rpl/t/rpl_grant.test @@ -36,3 +36,5 @@ sync_slave_with_master; --echo **** On Slave **** SELECT user,host FROM mysql.user WHERE user like 'dummy%'; SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test index c96b88a1b1a..ffdc21a5756 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_idempotency.test @@ -9,6 +9,7 @@ source include/have_innodb.inc; # Add suppression for expected warning(s) in slaves error log call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032"); +call mtr.add_suppression("Can't find record in 't.'"); call mtr.add_suppression("Slave: Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451"); call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); @@ -37,10 +38,7 @@ SELECT * FROM t2 ORDER BY a; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +--source include/check_slave_no_error.inc # An insert of a row that already exists. Since we are replacing the # row if it already exists, the most apropriate representation is @@ -53,10 +51,7 @@ INSERT IGNORE INTO t1 VALUES (-2); SELECT * FROM t1 ORDER BY a; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +--source include/check_slave_no_error.inc # BUG#19958: RBR idempotency issue for UPDATE and DELETE @@ -80,10 +75,7 @@ SELECT * FROM t2 ORDER BY a; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +--source include/check_slave_no_error.inc connection master; DROP TABLE t1, t2; @@ -211,12 +203,9 @@ select * from ti1 order by b /* must be (2),(3) */; --echo *** slave must stop (Trying to delete a referenced foreing key) connection slave; -source include/wait_for_slave_sql_to_stop.inc; - -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1451 = ER_ROW_ID_REFERENCED_2 +--let $slave_sql_errno= 1451 +--source include/wait_for_slave_sql_error.inc select * from ti1 order by b /* must be (1),(2),(3) - not deleted */; set foreign_key_checks= 0; @@ -245,12 +234,9 @@ insert into ti2 set a=3, b=3 /* offending write event */; --echo *** slave must stop (Trying to insert an invalid foreign key) connection slave; -source include/wait_for_slave_sql_to_stop.inc; - -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1452 = ER_NO_REFERENCED_ROW_2 +--let $slave_sql_errno= 1452 +--source include/wait_for_slave_sql_error.inc select * from ti2 order by b /* must be (2,2) */; set foreign_key_checks= 0; @@ -284,12 +270,9 @@ insert into ti1 set b=1 /* offending write event */; --echo *** slave must stop (Trying to insert a dupliacte key) connection slave; -source include/wait_for_slave_sql_to_stop.inc; - -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1062 = ER_DUP_ENTRY +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc set foreign_key_checks= 0; delete from ti1 where b=1; @@ -319,12 +302,9 @@ DELETE FROM t1 WHERE a = -2; --echo *** slave must stop (Key was not found) connection slave; -source include/wait_for_slave_sql_to_stop.inc; - -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1032 = ER_KEY_NOT_FOUND +--let $slave_sql_errno= 1032 +--source include/wait_for_slave_sql_error.inc set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; @@ -337,12 +317,9 @@ connection master; DELETE FROM t2 WHERE a = -2; --echo *** slave must stop (Key was not found) connection slave; -source include/wait_for_slave_sql_to_stop.inc; - -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1032 = ER_KEY_NOT_FOUND +--let $slave_sql_errno= 1032 +source include/wait_for_slave_sql_error.inc; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; @@ -359,12 +336,9 @@ UPDATE t1 SET a = 1 WHERE a = -1; --echo *** slave must stop (Key was not found) connection slave; -source include/wait_for_slave_sql_to_stop.inc; - -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1032 = ER_KEY_NOT_FOUND +--let $slave_sql_errno= 1032 +source include/wait_for_slave_sql_error.inc; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; @@ -379,12 +353,9 @@ UPDATE t2 SET a = 1 WHERE a = -1; --echo *** slave must stop (Key was not found) connection slave; -source include/wait_for_slave_sql_to_stop.inc; - -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1032 = ER_KEY_NOT_FOUND +--let $slave_sql_errno= 1032 +source include/wait_for_slave_sql_error.inc; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; @@ -399,6 +370,6 @@ connection master; set @@session.binlog_format= @save_binlog_format; drop table t1,t2,ti2,ti1; ---source include/master-slave-end.inc +--source include/rpl_end.inc --echo *** end of tests diff --git a/mysql-test/suite/rpl/t/rpl_ignore_grant.test b/mysql-test/suite/rpl/t/rpl_ignore_grant.test index 2e6e2ce9a31..34074ba8ca9 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_grant.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_grant.test @@ -57,3 +57,4 @@ delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_revoke.test b/mysql-test/suite/rpl/t/rpl_ignore_revoke.test index 00171605a92..db20e807afc 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_revoke.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_revoke.test @@ -49,3 +49,4 @@ sync_slave_with_master; # Since changes to mysql.* are ignored, the revoke need to # be done on slave as well delete from mysql.user where user="user_foo"; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test index 15c4b193669..64a3338b16e 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test @@ -2,6 +2,10 @@ source include/master-slave.inc; let collation=utf8_unicode_ci; --source include/have_collation.inc +call mtr.add_suppression("Can't find record in 't.'"); +call mtr.add_suppression("Can't find record in 'user'"); +call mtr.add_suppression("Can't find record in 'tables_priv'"); + # # BUG#16487 # @@ -176,3 +180,7 @@ SELECT * FROM tmptbl504451f4258$1; connection master; DROP TABLE t5; sync_slave_with_master; + +--source include/force_restart.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test index fe030f90411..840052e2f25 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test @@ -36,3 +36,4 @@ sync_with_master; drop table mysqltest_foo,mysqltest_bar,t1; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test index 08096d03c11..b65441c7d50 100644 --- a/mysql-test/suite/rpl/t/rpl_incident.test +++ b/mysql-test/suite/rpl/t/rpl_incident.test @@ -37,3 +37,4 @@ source include/check_slave_is_running.inc; connection master; DROP TABLE t1; --sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_init_slave.test b/mysql-test/suite/rpl/t/rpl_init_slave.test index 58d1f6bdc01..1803b146819 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave.test @@ -25,10 +25,10 @@ set global init_connect="set @c=1"; show variables like 'init_connect'; connection master; sync_slave_with_master; -source include/stop_slave.inc; # Restore changed global variable set global init_connect= @my_global_init_connect; set global max_connections= default; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test index 180821730ec..cf72de18e13 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test @@ -53,10 +53,11 @@ start slave; # slave is going to stop because of emulated failures # but there won't be any crashes nor asserts hit. # -source include/wait_for_slave_to_stop.inc; +# 1593 = ER_SLAVE_FATAL_ERROR +--let $slave_sql_errno= 1593 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc -let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1); -echo Reporting the following error: $error; call mtr.add_suppression("Failed during slave I/O thread initialization"); SET GLOBAL debug= ""; @@ -66,22 +67,23 @@ SET GLOBAL debug= ""; ###################################################################### connection slave; ---disable_warnings -stop slave; ---enable_warnings -source include/wait_for_slave_to_stop.inc; - reset slave; SET GLOBAL init_slave= "garbage"; start slave; -source include/wait_for_slave_sql_to_stop.inc; - -let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1); -echo Reporting the following error: $error; +# 1064 = ER_PARSE_ERROR +--let $slave_sql_errno= 1064 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc ###################################################################### # Clean up ###################################################################### SET GLOBAL init_slave= ""; + +# Clean up Last_SQL_Error +--source include/stop_slave_io.inc +RESET SLAVE; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_innodb.test b/mysql-test/suite/rpl/t/rpl_innodb.test index 64a85d27c88..b9b6080cfe5 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_innodb.test @@ -120,6 +120,6 @@ connection master; FLUSH LOGS; DROP DATABASE mysqltest1; --- source include/master-slave-end.inc +--source include/rpl_end.inc --echo End of 5.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test b/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test index a9cd6b15b6e..782c01ec04f 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test @@ -151,4 +151,4 @@ DROP TABLE test.regular_tbl; DROP TABLE test.bykey_tbl; DROP TABLE test.byrange_tbl; ---source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test b/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test index 4311328b064..9bfce61804b 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test @@ -62,5 +62,5 @@ connection master; DROP PROCEDURE test.proc_norm; DROP TABLE test.regular_tbl; ---source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test b/mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test index 6eb9c7075e4..5147e67c160 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test @@ -1,6 +1,4 @@ ######################################### -# Author: Serge Kozlov skozlov@mysql.com -# Date: 07/10/2006 # Purpose: testing the replication in mixed mode # Requirements: define binlog format for mysqld as in example below: # ./mysql-test-run.pl --mysqld=--binlog-format=mixed @@ -8,7 +6,4 @@ --source include/have_binlog_format_mixed.inc --source include/have_innodb.inc let $engine_type= innodb; - --source suite/rpl/include/rpl_mixed_ddl.inc - -# End 5.1 Test Case diff --git a/mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test b/mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test index d48e847a6c8..d04ced0f476 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test @@ -1,6 +1,4 @@ ######################################### -# Author: Serge Kozlov skozlov@mysql.com -# Date: 07/10/2006 # Purpose: testing the replication in mixed mode # Requirements: define binlog format for mysqld as in example below: # ./mysql-test-run.pl --mysqld=--binlog-format=mixed @@ -8,7 +6,4 @@ --source include/have_binlog_format_mixed.inc --source include/have_innodb.inc let $engine_type= innodb; - --source suite/rpl/include/rpl_mixed_dml.inc - -# End 5.1 Test Case diff --git a/mysql-test/suite/rpl/t/rpl_insert.test b/mysql-test/suite/rpl/t/rpl_insert.test index 6fb9ec8fd72..45576e53070 100644 --- a/mysql-test/suite/rpl/t/rpl_insert.test +++ b/mysql-test/suite/rpl/t/rpl_insert.test @@ -38,3 +38,4 @@ connection master; USE test; DROP SCHEMA mysqlslap; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_insert_id.test b/mysql-test/suite/rpl/t/rpl_insert_id.test index 45cc32c9d39..f2f62a207a0 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_id.test +++ b/mysql-test/suite/rpl/t/rpl_insert_id.test @@ -1,10 +1,6 @@ ################################# # Wrapper for rpl_insert_id.test# ################################# -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=myisam; diff --git a/mysql-test/suite/rpl/t/rpl_insert_id_pk.test b/mysql-test/suite/rpl/t/rpl_insert_id_pk.test index 01f30b78ac5..c0d68855f85 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_id_pk.test +++ b/mysql-test/suite/rpl/t/rpl_insert_id_pk.test @@ -1,10 +1,6 @@ ################################# # Wrapper for rpl_insert_id.test# ################################# -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=innodb; diff --git a/mysql-test/suite/rpl/t/rpl_insert_ignore.test b/mysql-test/suite/rpl/t/rpl_insert_ignore.test index 2709430f85d..1d6c8e7168e 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_ignore.test +++ b/mysql-test/suite/rpl/t/rpl_insert_ignore.test @@ -7,3 +7,4 @@ let $engine_type=innodb; let $engine_type2=myisam; -- source extra/rpl_tests/rpl_insert_ignore.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_insert_select.test b/mysql-test/suite/rpl/t/rpl_insert_select.test index 677be526982..23bc7ecd167 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_select.test +++ b/mysql-test/suite/rpl/t/rpl_insert_select.test @@ -17,3 +17,4 @@ select * from t1; connection master; drop table t1,t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features.test b/mysql-test/suite/rpl/t/rpl_invoked_features.test index e73964a6e14..7082117b9eb 100644 --- a/mysql-test/suite/rpl/t/rpl_invoked_features.test +++ b/mysql-test/suite/rpl/t/rpl_invoked_features.test @@ -308,3 +308,4 @@ DROP EVENT IF EXISTS e11; --sync_slave_with_master slave # End 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_killed_ddl.test b/mysql-test/suite/rpl/t/rpl_killed_ddl.test index 21ac1af3f06..97ef2fcaf96 100644 --- a/mysql-test/suite/rpl/t/rpl_killed_ddl.test +++ b/mysql-test/suite/rpl/t/rpl_killed_ddl.test @@ -142,7 +142,7 @@ disable_warnings; ######## DATABASE ######## -let $diff_statement= SHOW DATABASES LIKE 'd%'; +--let $rpl_diff_statement= SHOW DATABASES LIKE \'d%\' send CREATE DATABASE d2; source include/kill_query_and_diff_master_slave.inc; @@ -161,7 +161,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## EVENT ######## -let $diff_statement= SELECT event_name, event_body, execute_at FROM information_schema.events where event_name like 'e%'; +--let $rpl_diff_statement= SELECT event_name, event_body, execute_at FROM information_schema.events where event_name like \'e%\' send CREATE EVENT e2 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY @@ -182,7 +182,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## FUNCTION ######## -let $diff_statement= SHOW FUNCTION STATUS LIKE 'f%'; +--let $rpl_diff_statement= SHOW FUNCTION STATUS LIKE \'f%\' send CREATE FUNCTION f2 () RETURNS INT DETERMINISTIC RETURN 1; @@ -211,7 +211,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## PROCEDURE ######## -let $diff_statement= SHOW PROCEDURE STATUS LIKE 'p%'; +--let $rpl_diff_statement= SHOW PROCEDURE STATUS LIKE \'p%\' DELIMITER //; send CREATE PROCEDURE p2 (OUT rows INT) @@ -234,7 +234,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## TABLE ######## -let $diff_statement= SHOW TABLES LIKE 't%'; +--let $rpl_diff_statement= SHOW TABLES LIKE \'t%\' send CREATE TABLE t2 (b int); source include/kill_query_and_diff_master_slave.inc; @@ -247,7 +247,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## INDEX ######## -let $diff_statement= SHOW INDEX FROM t1; +--let $rpl_diff_statement= SHOW INDEX FROM t1 send CREATE INDEX i2 on t1 (a); source include/kill_query_and_diff_master_slave.inc; @@ -260,7 +260,7 @@ source include/kill_query_and_diff_master_slave.inc; # Tempoarily disabled, see bug#25705 -# let $diff_statement= SELECT * FROM mysql.server WHERE name like 's%'; +# --let $rpl_diff_statement= SELECT * FROM mysql.server WHERE name like \'s%\' # send CREATE SERVER s2 # FOREIGN DATA WRAPPER mysql @@ -284,7 +284,7 @@ connection master; CREATE TABLE IF NOT EXISTS t4 (a int); connection master1; -let $diff_statement= SHOW TRIGGERS LIKE 'v%'; +--let $rpl_diff_statement= SHOW TRIGGERS LIKE \'v%\' DELIMITER //; send CREATE TRIGGER tr2 BEFORE INSERT ON t4 @@ -303,7 +303,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## VIEW ######## -let $diff_statement= SHOW TABLES LIKE 'v%'; +--let $rpl_diff_statement= SHOW TABLES LIKE \'v%\' send CREATE VIEW v2 AS SELECT a FROM t1 WHERE a > 100; source include/kill_query_and_diff_master_slave.inc; @@ -316,7 +316,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## DROP TABLE ######## -let $diff_statement= SHOW TABLES LIKE 't%'; +--let $rpl_diff_statement= SHOW TABLES LIKE \'t%\' send DROP TABLE t1; source include/kill_query_and_diff_master_slave.inc; @@ -357,3 +357,4 @@ DROP PROCEDURE IF EXISTS p2; DROP PROCEDURE IF EXISTS p3; DROP PROCEDURE IF EXISTS p4; enable_warnings; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test index 5b31b094b62..a8c7c2c1f5b 100644 --- a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test +++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test @@ -25,7 +25,7 @@ connection master; INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10; SELECT * FROM t1; connection slave; ---source include/wait_for_slave_sql_to_stop.inc + # show the error message #1105 = ER_UNKNOWN_ERROR --let $slave_sql_errno= 1105 @@ -81,17 +81,25 @@ ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c; SELECT * FROM t1; connection slave; ---source include/wait_for_slave_sql_to_stop.inc + # show the error message #1105 = ER_UNKNOWN_ERROR --let $slave_sql_errno= 1105 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc + # show that it was not replicated SELECT * FROM t1; connection master; + +# clean up drop table t1, t2; connection slave; drop table t1, t2; +# clear error message in sql thread +--source include/stop_slave_io.inc +RESET SLAVE; # End of 5.0 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_load_from_master.test b/mysql-test/suite/rpl/t/rpl_load_from_master.test index 0f085457817..6d09f71e809 100644 --- a/mysql-test/suite/rpl/t/rpl_load_from_master.test +++ b/mysql-test/suite/rpl/t/rpl_load_from_master.test @@ -179,3 +179,4 @@ drop database mysqltest2; drop database mysqltest3; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test index aad113878d3..5474124c337 100644 --- a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test +++ b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test @@ -96,3 +96,4 @@ drop table t1; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata.test b/mysql-test/suite/rpl/t/rpl_loaddata.test index 6f9ee4ef80a..4682e1e59eb 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata.test @@ -1,7 +1,3 @@ -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_loaddata.test diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test index 031a0f6c351..768b61d5741 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test @@ -48,3 +48,4 @@ source include/rpl_loaddata_charset.inc; # LOAD DATA LOCAL INFILE let $LOAD_LOCAL=0; source include/rpl_loaddata_charset.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test index b8975308a86..ecbaddb6995 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test @@ -23,3 +23,4 @@ connection master; DROP TABLE t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_m.test b/mysql-test/suite/rpl/t/rpl_loaddata_m.test index 42c3ad99f33..bbe11bbb887 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_m.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_m.test @@ -50,3 +50,4 @@ DROP TABLE test.t1; sync_slave_with_master; # End of test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_map.test b/mysql-test/suite/rpl/t/rpl_loaddata_map.test index 1db7c4a893b..24c8221c20f 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_map.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map.test @@ -71,3 +71,4 @@ connection master; drop table t2; sync_slave_with_master; remove_file $MYSQLTEST_VARDIR/tmp/bug30435_5k.txt; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_s.test b/mysql-test/suite/rpl/t/rpl_loaddata_s.test index 2dd2218eb5c..80785bb562f 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_s.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_s.test @@ -26,3 +26,4 @@ source include/show_binlog_events.inc; connection master; drop table test.t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test index 439c2b48ca5..a09d3feec42 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test @@ -12,3 +12,4 @@ SELECT * FROM t1 ORDER BY word; connection master; drop table t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh index 066f72926af..e5bb3e61d11 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh @@ -1 +1,2 @@ +rm -f $MYSQLTEST_VARDIR/std_data_master_link ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_master_link diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh index 218209a2542..7a0c0bb382a 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh @@ -1 +1,2 @@ +rm -f $MYSQLTEST_VARDIR/std_data_slave_link ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_slave_link diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test b/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test index 69b481bddd1..c73fa2897f3 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test @@ -19,3 +19,4 @@ connection master; drop table t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test index a93a82d6d9f..572c660faf7 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test +++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test @@ -168,3 +168,4 @@ SET SESSION sql_mode=@old_mode; sync_slave_with_master; connection master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test index adb23d2c2bc..ced0054c52c 100644 --- a/mysql-test/suite/rpl/t/rpl_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_loadfile.test @@ -58,8 +58,7 @@ # vii) assert that the contents of master and slave # table are the same -connection master; -source include/reset_master_and_slave.inc; +--source include/rpl_reset.inc connection master; let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; @@ -105,11 +104,12 @@ sync_slave_with_master; # if the file was removed before the slave started, # meaning that contents were indeed transfered # through binlog (in row format) -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; # CLEAN UP +--connection master DROP TABLE t1; DROP PROCEDURE p; -sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_locale.test b/mysql-test/suite/rpl/t/rpl_locale.test index 2f2d637e1b4..0d6692dd89c 100644 --- a/mysql-test/suite/rpl/t/rpl_locale.test +++ b/mysql-test/suite/rpl/t/rpl_locale.test @@ -22,3 +22,4 @@ sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test index daf4b9093fe..0e746d55935 100644 --- a/mysql-test/suite/rpl/t/rpl_log_pos.test +++ b/mysql-test/suite/rpl/t/rpl_log_pos.test @@ -33,7 +33,7 @@ let $slave_io_errno= 1236; let $show_slave_io_error= 1; source include/wait_for_slave_io_error.inc; --disable_warnings -source include/stop_slave.inc; +source include/stop_slave_sql.inc; --enable_warnings connection master; @@ -54,3 +54,4 @@ drop table t1; sync_slave_with_master; --echo End of 5.0 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test index ecdf10ac2c2..b0d3b23b4e1 100644 --- a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test +++ b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test @@ -58,10 +58,10 @@ FLUSH LOGS; # error to slave. call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log'); connection slave; -source include/wait_for_slave_io_to_stop.inc; -let $last_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); -echo Last_IO_Error; -echo $last_error; +# 1236 = ER_MASTER_FATAL_ERROR_READING_BINLOG +--let $slave_io_errno= 1236 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc connection master; @@ -103,4 +103,4 @@ SHOW TABLES; connection master; DROP TABLE t1, t2, t3, t4; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_many_optimize.test b/mysql-test/suite/rpl/t/rpl_many_optimize.test index 91fab0b27a8..d5e9f69b4bc 100644 --- a/mysql-test/suite/rpl/t/rpl_many_optimize.test +++ b/mysql-test/suite/rpl/t/rpl_many_optimize.test @@ -20,3 +20,4 @@ drop table t1; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test index 2f7b18ae04b..a6a49950300 100644 --- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test +++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test @@ -27,3 +27,5 @@ echo "*** must be NULL ***"; select master_pos_wait('foo', 98); # End of 4.1 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test index b84042160cd..9b7bfd35579 100644 --- a/mysql-test/suite/rpl/t/rpl_misc_functions.test +++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test @@ -122,3 +122,4 @@ DROP FUNCTION test_replication_sf; --sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test b/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test index 55f6ad61446..d2aa8363060 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test @@ -76,3 +76,4 @@ sync_slave_with_master; connection master; DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test index 3df43607bfe..238ea9aa29c 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test @@ -45,3 +45,4 @@ drop table t2,t3,t5; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete.test b/mysql-test/suite/rpl/t/rpl_multi_delete.test index a251cbf8833..9df8ca4d29a 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_delete.test +++ b/mysql-test/suite/rpl/t/rpl_multi_delete.test @@ -24,3 +24,4 @@ connection slave; sync_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete2.test b/mysql-test/suite/rpl/t/rpl_multi_delete2.test index 81379d4056b..7317dfa8732 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_delete2.test +++ b/mysql-test/suite/rpl/t/rpl_multi_delete2.test @@ -66,3 +66,4 @@ drop database mysqltest_to; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_engine.test b/mysql-test/suite/rpl/t/rpl_multi_engine.test index 31c4a2050d7..b1dbf99f114 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_engine.test +++ b/mysql-test/suite/rpl/t/rpl_multi_engine.test @@ -102,3 +102,4 @@ DROP TABLE t1; sync_slave_with_master; # End of 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_update.test b/mysql-test/suite/rpl/t/rpl_multi_update.test index a6111455d16..710337816da 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_update.test +++ b/mysql-test/suite/rpl/t/rpl_multi_update.test @@ -1,7 +1,3 @@ -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_multi_update.test diff --git a/mysql-test/suite/rpl/t/rpl_multi_update2.test b/mysql-test/suite/rpl/t/rpl_multi_update2.test index 812a486ad69..497568f2738 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_update2.test +++ b/mysql-test/suite/rpl/t/rpl_multi_update2.test @@ -8,3 +8,4 @@ --source include/master-slave.inc let $engine_type=MyISAM; --source extra/rpl_tests/rpl_multi_update2.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_update3.test b/mysql-test/suite/rpl/t/rpl_multi_update3.test index 5da91c26b04..f6e70f14b30 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_update3.test +++ b/mysql-test/suite/rpl/t/rpl_multi_update3.test @@ -8,3 +8,4 @@ --source include/master-slave.inc let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_multi_update3.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_update4.test b/mysql-test/suite/rpl/t/rpl_multi_update4.test index 4991a385f6f..8f069b9c18f 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_update4.test +++ b/mysql-test/suite/rpl/t/rpl_multi_update4.test @@ -43,3 +43,4 @@ drop database d2; sync_slave_with_master; # End of test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test index bf5c6d2b921..beefd8bc0cf 100644 --- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test +++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test @@ -54,3 +54,5 @@ if (!`SELECT '$before_position'='$after_position'`) DROP DATABASE `mysqltest-1`; connection slave; DROP DATABASE `#mysql50#mysqltest-1`; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_name_const.test b/mysql-test/suite/rpl/t/rpl_name_const.test index d3ef557ddc0..4cacafa0523 100644 --- a/mysql-test/suite/rpl/t/rpl_name_const.test +++ b/mysql-test/suite/rpl/t/rpl_name_const.test @@ -45,4 +45,4 @@ select * from t1 order by id; connection master; drop table t1; drop procedure test_procedure; ---sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test b/mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test index 9ff2e2d081e..2c5db21b0e3 100644 --- a/mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test +++ b/mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test @@ -50,8 +50,9 @@ INSERT INTO t1 VALUES (RAND()); INSERT INTO t1 VALUES (LAST_INSERT_ID()); --sync_slave_with_master ---let $diff_table_1= master:test.t1 ---let $diff_table_2= slave:test.t1 +--let $diff_tables= master:t1, slave:t1 --source include/diff_tables.inc +--connection master DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_not_null_innodb.test b/mysql-test/suite/rpl/t/rpl_not_null_innodb.test index dca0ea6589c..1e67ba4eda1 100644 --- a/mysql-test/suite/rpl/t/rpl_not_null_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_not_null_innodb.test @@ -17,3 +17,4 @@ let $engine=Innodb; --source extra/rpl_tests/rpl_not_null.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_not_null_myisam.test b/mysql-test/suite/rpl/t/rpl_not_null_myisam.test index 0c036f5bfd7..dcfaf006dad 100644 --- a/mysql-test/suite/rpl/t/rpl_not_null_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_not_null_myisam.test @@ -16,3 +16,4 @@ let $engine=MyISAM; --source extra/rpl_tests/rpl_not_null.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_optimize.test b/mysql-test/suite/rpl/t/rpl_optimize.test index 7bd53a3fead..840c37d96d4 100644 --- a/mysql-test/suite/rpl/t/rpl_optimize.test +++ b/mysql-test/suite/rpl/t/rpl_optimize.test @@ -61,3 +61,4 @@ sync_slave_with_master; # starts, this test will demonstrate nothing but will pass. # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test index 08a533e22ca..b11bd0a227e 100644 --- a/mysql-test/suite/rpl/t/rpl_packet.test +++ b/mysql-test/suite/rpl/t/rpl_packet.test @@ -43,20 +43,16 @@ select @@net_buffer_length, @@max_allowed_packet; create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023'); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; eval select count(*) from `$db`.`t1` /* must be 1 */; SHOW STATUS LIKE 'Slave_running'; select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING'; connection master; eval drop database $db; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; # # Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits @@ -89,17 +85,21 @@ connection master; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); -# The slave I/O thread must stop after trying to read the above event -connection slave; ---source include/wait_for_slave_io_to_stop.inc -let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); ---echo Slave_IO_Running = $slave_io_running (expect No) + # # Bug#42914: The slave I/O thread must stop after trying to read the above # event, However there is no Last_IO_Error report. # -let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); -eval SELECT "$last_io_error" AS Last_IO_Error; + +# The slave I/O thread must stop after trying to read the above event +connection slave; +# 1153 = ER_NET_PACKET_TOO_LARGE +--let $slave_io_errno= 1153 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc + +# TODO: this is needed because of BUG#55790. Remove once that is fixed. +--source include/stop_slave_sql.inc # # Bug#42914: On the master, if a binary log event is larger than @@ -107,7 +107,14 @@ eval SELECT "$last_io_error" AS Last_IO_Error; # is sent to a slave when it requests a dump from the master, thus leading the # I/O thread to stop. However, there is no Last_IO_Error reported. # -source include/master-slave-reset.inc; + +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc +--connection master +DROP TABLE t1; +--sync_slave_with_master + + connection master; CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; sync_slave_with_master; @@ -117,12 +124,10 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), R connection slave; # The slave I/O thread must stop after receiving -# ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master. ---source include/wait_for_slave_io_to_stop.inc -let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); ---echo Slave_IO_Running = $slave_io_running (expect No) -let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); -eval SELECT "$last_io_error" AS Last_IO_Error; +# 1236=ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master. +--let $slave_io_errno= 1236 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc # Remove the bad binlog and clear error status on slave. STOP SLAVE; @@ -165,4 +170,8 @@ eval SET @@global.net_buffer_length= $old_net_buffer_length; connection slave; DROP TABLE t1; +# Clear Last_IO_Error +RESET SLAVE; + +--source include/rpl_end.inc # End of tests diff --git a/mysql-test/suite/rpl/t/rpl_plugin_load.test b/mysql-test/suite/rpl/t/rpl_plugin_load.test index 100683922ad..5f9725a8e66 100644 --- a/mysql-test/suite/rpl/t/rpl_plugin_load.test +++ b/mysql-test/suite/rpl/t/rpl_plugin_load.test @@ -56,5 +56,5 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE'; sync_slave_with_master; # # Cleanup ---source include/master-slave-end.inc +--source include/rpl_end.inc --echo End of test diff --git a/mysql-test/suite/rpl/t/rpl_ps.test b/mysql-test/suite/rpl/t/rpl_ps.test index b00dec6b80c..e93c68d0e10 100644 --- a/mysql-test/suite/rpl/t/rpl_ps.test +++ b/mysql-test/suite/rpl/t/rpl_ps.test @@ -72,75 +72,36 @@ stop slave; ############################################################################### ---echo --echo # Connection: slave ---echo --connection slave ---echo START SLAVE; ---echo --echo # Connection: master ---echo --connection master ---echo CREATE DATABASE mysqltest1; CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32)); ---echo PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)'; ---echo EXECUTE stmt_d_1; ---echo use mysqltest1; ---echo EXECUTE stmt_d_1; ---echo ---save_master_pos - ---echo --echo # Connection: slave ---echo ---connection slave ---sync_with_master +--sync_slave_with_master ---echo SELECT * FROM t1; ---echo --echo # Connection: master ---echo --connection master ---echo DROP DATABASE mysqltest1; ---echo use test; DROP TABLE t1; ---echo ---save_master_pos - ---echo ---echo # Connection: slave ---echo ---connection slave ---sync_with_master - ---echo -STOP SLAVE; - ---echo ---echo ######################################################################## - -############################################################################### -reset master; -reset slave; -disconnect master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test index ec50311fc7c..86dd2eb78eb 100644 --- a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test +++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test @@ -38,3 +38,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp --remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql --remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_read_only.test b/mysql-test/suite/rpl/t/rpl_read_only.test index 62864b62a28..c791bc3e1ea 100644 --- a/mysql-test/suite/rpl/t/rpl_read_only.test +++ b/mysql-test/suite/rpl/t/rpl_read_only.test @@ -111,3 +111,4 @@ sync_slave_with_master; set global read_only=0; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test b/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test index 156d53ef856..ca16a583fe5 100644 --- a/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test @@ -1,22 +1,4 @@ -################################### -# Wrapper rpl_sv_relay_space.test # -# This test has to be wrapped as # -# It tests ndb, innodb and MyISAM.# -# By Wrapping we are saving some # -# space and making the test more # -# Maintainable by only having one # -# test file and reusing the code # -# In Addition, INNODB has to have # -# Option files during this test # -# to force innodb on the slave # -# else the test will fail # -################################### -#Change Author: JBM # -#Change Date: 2006-02-03 # -#Change: Added Comments # -################################### -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_sv_relay_space.test - diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_myisam.test b/mysql-test/suite/rpl/t/rpl_relay_space_myisam.test index 1d8563e7fd9..13719cbdc33 100644 --- a/mysql-test/suite/rpl/t/rpl_relay_space_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_relay_space_myisam.test @@ -1,21 +1,3 @@ -################################### -# Wrapper rpl_sv_relay_space.test # -# This test has to be wrapped as # -# It tests ndb, innodb and MyISAM.# -# By Wrapping we are saving some # -# space and making the test more # -# Maintainable by only having one # -# test file and reusing the code # -# In Addition, INNODB has to have # -# Option files during this test # -# to force innodb on the slave # -# else the test will fail # -################################### -#Change Author: JBM # -#Change Date: 2006-02-03 # -#Change: Added Comments # -################################### -- source include/not_ndb_default.inc let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_sv_relay_space.test - diff --git a/mysql-test/suite/rpl/t/rpl_relayrotate.test b/mysql-test/suite/rpl/t/rpl_relayrotate.test index 248389d793d..f187fbc033f 100644 --- a/mysql-test/suite/rpl/t/rpl_relayrotate.test +++ b/mysql-test/suite/rpl/t/rpl_relayrotate.test @@ -12,3 +12,4 @@ let $engine_type=innodb; -- source extra/rpl_tests/rpl_relayrotate.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_relayspace.test b/mysql-test/suite/rpl/t/rpl_relayspace.test index cd04c2ccc0b..9df62e3a095 100644 --- a/mysql-test/suite/rpl/t/rpl_relayspace.test +++ b/mysql-test/suite/rpl/t/rpl_relayspace.test @@ -40,3 +40,4 @@ eval select master_pos_wait('$master_log_file',200,30)=-1; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test index 382e198aaf9..c6cbf819deb 100644 --- a/mysql-test/suite/rpl/t/rpl_replicate_do.test +++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test @@ -88,3 +88,4 @@ connection master; drop table t1; drop table t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test b/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test index bcfef919fad..f1907456ed5 100644 --- a/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test +++ b/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test @@ -28,3 +28,4 @@ connection master; drop database mysqltest1; drop database mysqltest2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_report.test b/mysql-test/suite/rpl/t/rpl_report.test index 8798905d372..a73442917fa 100644 --- a/mysql-test/suite/rpl/t/rpl_report.test +++ b/mysql-test/suite/rpl/t/rpl_report.test @@ -19,3 +19,4 @@ set @@global.report_host='my.new.address.net'; --echo end of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_rewrt_db.test b/mysql-test/suite/rpl/t/rpl_rewrt_db.test index 585b08be0b3..996ad0a10c7 100644 --- a/mysql-test/suite/rpl/t/rpl_rewrt_db.test +++ b/mysql-test/suite/rpl/t/rpl_rewrt_db.test @@ -237,3 +237,4 @@ connection master; sync_slave_with_master; # end of 5.0 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt deleted file mode 100644 index 80190bf6d29..00000000000 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---server-id=2 diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh deleted file mode 100755 index 81490a54b4b..00000000000 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh +++ /dev/null @@ -1,2 +0,0 @@ -rm -f $MYSQLTEST_VARDIR/slave-data/master.info -rm -f $MYSQLTEST_VARDIR/slave-data/*relay* diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test index e8bcc904e4c..68a3a20b501 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test @@ -18,19 +18,14 @@ -- source include/have_binlog_format_mixed_or_statement.inc connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); ---disable_warnings -drop table if exists t1, t2, t3, t4; ---enable_warnings connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK); + # Create empty file let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; write_file $MYSQLD_SLAVE_DATADIR/master.info; EOF chmod 0000 $MYSQLD_SLAVE_DATADIR/master.info; connection slave; ---disable_warnings -drop table if exists t1, t2, t3, t4; ---enable_warnings # START SLAVE will fail because it can't read the file (mode 000) # (system error 13) @@ -97,11 +92,9 @@ connection master; set insert_id=1234; insert into t2 values(NULL); connection slave; ---source include/wait_for_slave_sql_to_stop.inc - -#restart slave skipping one event -set global sql_slave_skip_counter=1; -start slave; +# 1062 = ER_DUP_ENTRY +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error_and_skip.inc connection master; @@ -194,3 +187,5 @@ show binlog events in ''; purge master logs before now(); --echo End of 5.0 tests +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_HOST = ''; diff --git a/mysql-test/suite/rpl/t/rpl_row_001.test b/mysql-test/suite/rpl/t/rpl_row_001.test index f949e0b2d5f..96521280afd 100644 --- a/mysql-test/suite/rpl/t/rpl_row_001.test +++ b/mysql-test/suite/rpl/t/rpl_row_001.test @@ -10,3 +10,4 @@ let $engine_type=MYISAM; -- source extra/rpl_tests/rpl_row_001.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_4_bytes.test b/mysql-test/suite/rpl/t/rpl_row_4_bytes.test index 73ef6dd2345..6130f74983e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_4_bytes.test +++ b/mysql-test/suite/rpl/t/rpl_row_4_bytes.test @@ -31,3 +31,4 @@ select * from t2 order by a; connection master; DROP DATABASE mysqltest1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_NOW.test b/mysql-test/suite/rpl/t/rpl_row_NOW.test index c28b714277e..d732c6e6733 100644 --- a/mysql-test/suite/rpl/t/rpl_row_NOW.test +++ b/mysql-test/suite/rpl/t/rpl_row_NOW.test @@ -72,3 +72,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave. sync_slave_with_master; # End of 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_USER.test b/mysql-test/suite/rpl/t/rpl_row_USER.test index 7b13ebc50ee..010e0e6ea05 100644 --- a/mysql-test/suite/rpl/t/rpl_row_USER.test +++ b/mysql-test/suite/rpl/t/rpl_row_USER.test @@ -58,3 +58,4 @@ DROP USER ''@'localhost%'; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_UUID.test b/mysql-test/suite/rpl/t/rpl_row_UUID.test index b0ef96463d0..ce3a4ed40a9 100644 --- a/mysql-test/suite/rpl/t/rpl_row_UUID.test +++ b/mysql-test/suite/rpl/t/rpl_row_UUID.test @@ -7,3 +7,4 @@ -- source include/master-slave.inc let $engine_type=myisam; --source extra/rpl_tests/rpl_row_UUID.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test index 2bf5a01a71f..b7fc0d3bd2a 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test +++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test @@ -4,10 +4,13 @@ let $SERVER_VERSION=`select version()`; #This test case is not written for NDB, the result files #will not match when NDB is the default engine --- source include/not_ndb_default.inc +--source include/not_ndb_default.inc --source include/master-slave.inc +# Add suppression for expected warning(s) in slaves error log +call mtr.add_suppression("Can't find record in 't.'"); + # Bug#15942 (RBR ignores --binlog_ignore_db and tries to map to table # on slave for writes) @@ -34,13 +37,15 @@ USE test_ignore; connection master; DROP DATABASE test_ignore; +USE test; +DROP TABLE t1; sync_slave_with_master; +USE test; + # Bug#19995: Extreneous table maps generated for statements that does # not generate rows ---disable_query_log ---source include/master-slave-reset.inc ---enable_query_log +--source include/rpl_reset.inc connection master; CREATE TABLE t1 (a INT); @@ -56,9 +61,7 @@ DROP TABLE t1; # BUG#17620: Replicate (Row Based) Fails when Query Cache enabled on # slave --echo ================ Test for BUG#17620 ================ ---disable_query_log ---source include/master-slave-reset.inc ---enable_query_log +--source include/rpl_reset.inc --echo **** On Slave **** connection slave; @@ -90,12 +93,13 @@ sync_slave_with_master; SELECT * FROM t1; SET GLOBAL QUERY_CACHE_SIZE=0; +--connection master +DROP TABLE t1; + # Bug#22550: Replication of BIT columns failing --echo ================ Test for BUG#22550 ================ ---disable_query_log ---source include/master-slave-reset.inc ---enable_query_log +--source include/rpl_reset.inc connection master; CREATE TABLE t1 (a BIT(1), b INT) ENGINE=MYISAM; @@ -121,9 +125,7 @@ sync_slave_with_master; # field does not work --echo ================ Test for BUG#22583 ================ ---disable_query_log ---source include/master-slave-reset.inc ---enable_query_log +--source include/rpl_reset.inc # disabling warnings temporarily for ENGINE=INNODB to work without InnoDB --disable_warnings @@ -228,13 +230,10 @@ sync_slave_with_master; # row-based replication # -disable_query_log; -source include/master-slave-reset.inc; -enable_query_log; +--source include/rpl_reset.inc --echo **** On Master **** connection master; -SET SESSION BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT PRIMARY KEY, b SET('master','slave')); INSERT INTO t1 VALUES (1,'master,slave'), (2,'master,slave'); --echo **** On Slave **** @@ -242,7 +241,7 @@ sync_slave_with_master; UPDATE t1 SET a = 5, b = 'slave' WHERE a = 1; SELECT * FROM t1 ORDER BY a; # since bug#31552/31609 idempotency is not default any longer. In -# order the preceeding test UPDATE t1 to pass the mode is switched +# order for the preceeding test UPDATE t1 to pass, the mode is switched # temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; --echo **** On Master **** @@ -256,9 +255,10 @@ let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; enable_query_log; + SELECT * FROM t1 ORDER BY a; -DROP TABLE t1; --echo **** On Master **** connection master; DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test b/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test index c5648fa1d77..f1f5c584543 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test +++ b/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test @@ -4,3 +4,4 @@ let $type= 'MYISAM' ; let $extra_index= ; -- source extra/rpl_tests/rpl_row_basic.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test index 3786a697e3f..d5dfcd7b75c 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test @@ -6,3 +6,4 @@ let $type= 'INNODB' ; let $extra_index= ; -- source extra/rpl_tests/rpl_row_basic.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test b/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test index 687b3bc785d..3ec79ec8cd5 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test +++ b/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test @@ -208,3 +208,4 @@ SHOW CREATE TABLE t1; DROP TABLE IF EXISTS t1; # End of 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test b/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test index 6aa6c2a31b9..eaf86688a29 100644 --- a/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test @@ -12,3 +12,4 @@ let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_row_blob.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test b/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test index 11f5336502a..482ccb7ecc0 100644 --- a/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test @@ -11,3 +11,4 @@ let $engine_type=myisam; -- source extra/rpl_tests/rpl_row_blob.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_colSize.test b/mysql-test/suite/rpl/t/rpl_row_colSize.test index 078e6886ec7..04434517518 100644 --- a/mysql-test/suite/rpl/t/rpl_row_colSize.test +++ b/mysql-test/suite/rpl/t/rpl_row_colSize.test @@ -166,3 +166,4 @@ DROP TABLE IF EXISTS t1; sync_slave_with_master; # END 5.1 Test Case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_conflicts.test b/mysql-test/suite/rpl/t/rpl_row_conflicts.test index 59757e2e802..0f525e0f58d 100644 --- a/mysql-test/suite/rpl/t/rpl_row_conflicts.test +++ b/mysql-test/suite/rpl/t/rpl_row_conflicts.test @@ -9,6 +9,7 @@ source include/master-slave.inc; connection slave; call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*"); +call mtr.add_suppression("Can't find record in 't.'"); --echo [on slave] connection slave; @@ -20,6 +21,8 @@ SET @old_slave_exec_mode= @@global.slave_exec_mode; SET @@global.slave_exec_mode = 'STRICT'; source extra/rpl_tests/rpl_conflicts.test; +--source include/rpl_reset.inc + --echo ######## Run with slave_exec_mode=IDEMPOTENT ######## @@ -28,4 +31,4 @@ source extra/rpl_tests/rpl_conflicts.test; SET @@global.slave_exec_mode= @old_slave_exec_mode; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test index 148032f2987..bfe480f724e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_create_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test @@ -29,7 +29,7 @@ SET GLOBAL storage_engine=memory; START SLAVE; --enable_query_log ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; CREATE TABLE t1 (a INT, b INT); @@ -65,7 +65,7 @@ SELECT * FROM t5 ORDER BY a,b,c; --query_vertical SHOW CREATE TABLE t6 SELECT * FROM t6 ORDER BY a,b,c; ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; # Test for erroneous constructions @@ -84,7 +84,7 @@ SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; CREATE TEMPORARY TABLE tt4 (a INT, b INT); @@ -97,7 +97,7 @@ SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; CREATE TABLE t8 LIKE t4; @@ -127,7 +127,7 @@ START SLAVE; # table' from log): --echo ================ BUG#22864 ================ ---source include/master-slave-reset.inc +--source include/rpl_reset.inc connection master; SET AUTOCOMMIT=0; @@ -164,15 +164,7 @@ SET AUTOCOMMIT=1; sync_slave_with_master; # Some tests with temporary tables -connection slave; -STOP SLAVE; -RESET SLAVE; - -connection master; -RESET MASTER; - -connection slave; -START SLAVE; +--source include/rpl_reset.inc connection master; CREATE TABLE t1 (a INT); @@ -198,7 +190,7 @@ connection master; TRUNCATE TABLE t2; sync_slave_with_master; ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; BEGIN; @@ -247,7 +239,7 @@ sync_slave_with_master; # BUG#34707: Row based replication: slave creates table within wrong database # -source include/master-slave-reset.inc; +--source include/rpl_reset.inc connection master; --disable_warnings @@ -269,7 +261,7 @@ sync_slave_with_master; # <tmp_tbl> with RBL # -source include/master-slave-reset.inc; +--source include/rpl_reset.inc connection master; CREATE TEMPORARY TABLE t7(c1 INT); @@ -299,6 +291,7 @@ DROP VIEW IF EXISTS bug48506_t1, bug48506_t2, bug48506_t3; DROP TEMPORARY TABLES t7; DROP TABLES t4, t5; DROP TABLES IF EXISTS bug48506_t4; + sync_slave_with_master; # @@ -308,9 +301,10 @@ sync_slave_with_master; connection master; CREATE TABLE t1 SELECT 1; CREATE TABLE IF NOT EXISTS t1 SELECT 1; -let $diff_table=test.t1; -source include/rpl_diff_tables.inc; +--let $diff_tables= master:test.t1,slave:test.t1 +--source include/diff_tables.inc DROP TABLE t1; -source include/master-slave-end.inc; +--source include/rpl_end.inc + --echo end of the tests diff --git a/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test b/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test index a0e74567349..db41ff09117 100644 --- a/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test +++ b/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test @@ -1,7 +1,3 @@ -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc let $engine_type=myisam; -- source extra/rpl_tests/rpl_row_delayed_ins.test diff --git a/mysql-test/suite/rpl/t/rpl_row_drop.test b/mysql-test/suite/rpl/t/rpl_row_drop.test index d18ebc2846b..eca2ae0f643 100644 --- a/mysql-test/suite/rpl/t/rpl_row_drop.test +++ b/mysql-test/suite/rpl/t/rpl_row_drop.test @@ -43,3 +43,4 @@ DROP TABLE IF EXISTS t2; sync_slave_with_master; --enable_warnings --enable_query_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_find_row.test b/mysql-test/suite/rpl/t/rpl_row_find_row.test index 9163ab54406..7f633c5aa97 100644 --- a/mysql-test/suite/rpl/t/rpl_row_find_row.test +++ b/mysql-test/suite/rpl/t/rpl_row_find_row.test @@ -50,7 +50,7 @@ DROP TABLE t; # but it gets disabled sometime. # Replication does not break anymore. # --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master CREATE TABLE t (a int, b int, c int, key(b)); @@ -84,8 +84,7 @@ DROP TABLE t; # As a consquence, the wrong row would be updated. # --- connection master --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 INT, UNIQUE KEY(c1,c3), KEY(c2)); @@ -94,11 +93,11 @@ INSERT INTO t1(c1,c2) VALUES(1,2); UPDATE t1 SET c1=1000 WHERE c2=2; -- sync_slave_with_master --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE t1; -- sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test index 8764b35a537..2429dbc1142 100644 --- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test +++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test @@ -15,4 +15,3 @@ let $rename_event_pos= `select @binlog_start_pos + 819`; --disable_ps_protocol -- source extra/rpl_tests/rpl_flsh_tbls.test --enable_ps_protocol - diff --git a/mysql-test/suite/rpl/t/rpl_row_func001.test b/mysql-test/suite/rpl/t/rpl_row_func001.test index 53fb55118e6..6ff97388b31 100644 --- a/mysql-test/suite/rpl/t/rpl_row_func001.test +++ b/mysql-test/suite/rpl/t/rpl_row_func001.test @@ -55,3 +55,4 @@ DROP TABLE test.t1; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_func002.test b/mysql-test/suite/rpl/t/rpl_row_func002.test index 44a704bfbc5..2f4e3fdd910 100644 --- a/mysql-test/suite/rpl/t/rpl_row_func002.test +++ b/mysql-test/suite/rpl/t/rpl_row_func002.test @@ -102,3 +102,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/func002_master.sql $MYSQLTEST_VARDIR/tmp/func00 # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_func003.test b/mysql-test/suite/rpl/t/rpl_row_func003.test index 30b24cf4174..a17d70e4b04 100644 --- a/mysql-test/suite/rpl/t/rpl_row_func003.test +++ b/mysql-test/suite/rpl/t/rpl_row_func003.test @@ -11,3 +11,4 @@ -- source include/master-slave.inc let $engine_type=INNODB; -- source extra/rpl_tests/rpl_row_func003.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_index_choice.test b/mysql-test/suite/rpl/t/rpl_row_index_choice.test index a4ff999ec69..d393c65438a 100644 --- a/mysql-test/suite/rpl/t/rpl_row_index_choice.test +++ b/mysql-test/suite/rpl/t/rpl_row_index_choice.test @@ -239,3 +239,5 @@ DROP TABLE t1; sync_slave_with_master; connection slave; SET GLOBAL debug=""; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test index 0c038c41ebf..b695428dd38 100644 --- a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test +++ b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test @@ -29,14 +29,16 @@ INSERT INTO t1 VALUES (1); --echo [on slave] connection slave; # slave should have stopped because can't find table t1 ---source include/wait_for_slave_sql_to_stop.inc -# see if we have a good error message: -let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); ---echo Last_SQL_Error = $err +# 1146 = ER_NO_SUCH_TABLE +--let $slave_sql_errno= 1146 +--source include/wait_for_slave_sql_error.inc --echo ==== Clean up ==== -source include/stop_slave.inc; +source include/stop_slave_io.inc; +RESET SLAVE; --echo [on master] connection master; DROP TABLE t1; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test b/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test index 9aeb57c4fa2..71ae0cb5e17 100644 --- a/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test +++ b/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test @@ -12,3 +12,4 @@ set @@global.binlog_format = row; connection master; set @@global.binlog_format = @old_global_binlog_format; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_log.test b/mysql-test/suite/rpl/t/rpl_row_log.test index 197f83c85af..b156a4c8dd4 100644 --- a/mysql-test/suite/rpl/t/rpl_row_log.test +++ b/mysql-test/suite/rpl/t/rpl_row_log.test @@ -15,3 +15,4 @@ let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_log.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_log_innodb.test b/mysql-test/suite/rpl/t/rpl_row_log_innodb.test index 16e775287b3..631fb29c7bc 100644 --- a/mysql-test/suite/rpl/t/rpl_row_log_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_log_innodb.test @@ -12,3 +12,4 @@ let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_log.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test index ecbca6fc077..dd46eeb393e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test @@ -365,3 +365,4 @@ DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test b/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test index 67e4c4fb14d..57d67c5c71b 100644 --- a/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test @@ -8,3 +8,4 @@ -- let $engine= InnoDB -- source extra/rpl_tests/rpl_record_compare.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test b/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test index 43fa99a51da..e40cd615ca6 100644 --- a/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test @@ -12,7 +12,7 @@ -- echo ## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==0 ## Added here because AFAIK it's only MyISAM and NDB that use Field_bits --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master -- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bit(5)) ENGINE=$engine DEFAULT CHARSET=latin1 @@ -22,10 +22,10 @@ INSERT INTO t1(c1,c2) VALUES (NULL, b'1'); UPDATE t1 SET c1= 0; -- sync_slave_with_master --- let $diff_table_1= master:test.t1 --- let $diff_table_2= slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE t1; -- sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp001.test b/mysql-test/suite/rpl/t/rpl_row_sp001.test index 1595c4a21d5..07345781225 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp001.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp001.test @@ -148,3 +148,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_sl --remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test index e272e34e715..aec421407c9 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test @@ -1,10 +1,3 @@ -################################# -# Wrapper for rpl_row_sp002.test# -################################# -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=INNODB; diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003.test b/mysql-test/suite/rpl/t/rpl_row_sp003.test index ab49174ddfa..b5d62f60199 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp003.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp003.test @@ -10,7 +10,9 @@ -- source include/have_binlog_format_row.inc # Slow test, don't run during staging part -- source include/not_staging.inc +--source include/long_test.inc -- source include/master-slave.inc let $engine_type=INNODB; -- source extra/rpl_tests/rpl_row_sp003.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp005.test b/mysql-test/suite/rpl/t/rpl_row_sp005.test index f5a74325b7c..2a06a6ae1dc 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp005.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp005.test @@ -112,3 +112,4 @@ DROP TABLE IF EXISTS test.t3; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test index e5be4e6dc28..df3952bead1 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test @@ -11,3 +11,4 @@ -- source include/master-slave.inc let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_row_sp006.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test index 41af5a5f997..fcac31df780 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test @@ -1,10 +1,3 @@ -################################# -# Wrapper for rpl_row_sp007.test# -################################# -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=INNODB; diff --git a/mysql-test/suite/rpl/t/rpl_row_sp008.test b/mysql-test/suite/rpl/t/rpl_row_sp008.test index b1295820c99..8c3e2966647 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp008.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp008.test @@ -55,3 +55,4 @@ DROP TABLE IF EXISTS test.t2; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp009.test b/mysql-test/suite/rpl/t/rpl_row_sp009.test index 92d47c6f50f..2f05a55e6f8 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp009.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp009.test @@ -103,3 +103,4 @@ DROP TABLE test.t2; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp010.test b/mysql-test/suite/rpl/t/rpl_row_sp010.test index 28b82217517..71ab3c1a772 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp010.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp010.test @@ -78,3 +78,4 @@ DROP TABLE IF EXISTS test.t2; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp011.test b/mysql-test/suite/rpl/t/rpl_row_sp011.test index 25c2fc9ad26..d2a323faad2 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp011.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp011.test @@ -109,3 +109,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_sl --remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp012.test b/mysql-test/suite/rpl/t/rpl_row_sp012.test index 3a8d295121c..23bc92b51cf 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp012.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp012.test @@ -73,3 +73,4 @@ sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test index 9b24c78e62d..b9b7a2cfc0e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test +++ b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test @@ -28,5 +28,6 @@ select count(*) from t1; connection master; drop table t1; connection slave; # slave SQL thread is stopped -source include/stop_slave.inc; drop table t1; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test b/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test index ab4914e15fa..030ec7d6541 100644 --- a/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test +++ b/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test @@ -6,3 +6,4 @@ let $engine_type = 'MyISAM'; -- source extra/rpl_tests/rpl_row_tabledefs.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test index 7824fbfb663..35eddfc3ed4 100644 --- a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test @@ -7,3 +7,4 @@ let $engine_type = 'InnoDB'; -- source extra/rpl_tests/rpl_row_tabledefs.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test b/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test index d854aa64dc5..e8ac74f0125 100644 --- a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test +++ b/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test @@ -193,8 +193,7 @@ FLUSH LOGS; -- connection master -- echo ### assertion: the slave replicated event successfully and tables match --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc DROP TABLE `t1`; @@ -229,7 +228,7 @@ DROP TABLE `t1`; # in both cases: when slave is replaying events and when # mysqlbinlog is used to read the binary log --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master # Create several tables with field_metadata_size ranging @@ -313,8 +312,7 @@ FLUSH LOGS; while($ntables) { -- echo ### assertion: the slave replicated event successfully and tables match for t$ntables - -- let $diff_table_1=master:test.t$ntables - -- let $diff_table_2=slave:test.t$ntables + -- let $diff_tables= master:t$ntables, slave:t$ntables -- source include/diff_tables.inc -- connection master @@ -337,4 +335,4 @@ while($ntables) ## For debugging purposes you might want not to remove these -- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog -- remove_file $generated_sql --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trig001.test b/mysql-test/suite/rpl/t/rpl_row_trig001.test index 8669034713a..39f2662b569 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trig001.test +++ b/mysql-test/suite/rpl/t/rpl_row_trig001.test @@ -113,3 +113,4 @@ sync_slave_with_master; diff_files $MYSQLTEST_VARDIR/tmp/trig001_master.sql $MYSQLTEST_VARDIR/tmp/trig001_slave.sql; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trig002.test b/mysql-test/suite/rpl/t/rpl_row_trig002.test index 7ca8a68f060..2835d07ce2a 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trig002.test +++ b/mysql-test/suite/rpl/t/rpl_row_trig002.test @@ -78,3 +78,4 @@ DROP TABLE test.t3; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trig003.test b/mysql-test/suite/rpl/t/rpl_row_trig003.test index dada855a89e..67c05174fae 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trig003.test +++ b/mysql-test/suite/rpl/t/rpl_row_trig003.test @@ -154,3 +154,4 @@ sync_slave_with_master; diff_files $MYSQLTEST_VARDIR/tmp/trg003_master.sql $MYSQLTEST_VARDIR/tmp/trg003_slave.sql; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trig004.test b/mysql-test/suite/rpl/t/rpl_row_trig004.test index a918c602d56..fa5f973c355 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trig004.test +++ b/mysql-test/suite/rpl/t/rpl_row_trig004.test @@ -16,3 +16,4 @@ let $engine_type=INNODB; -- source extra/rpl_tests/rpl_trig004.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test b/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test index 60e1cd73200..394bf949f72 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test +++ b/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test @@ -32,4 +32,4 @@ SELECT * FROM t2; DROP TABLE t1; connection master; DROP TABLE t2; ---source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test b/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test index 069700546ce..9e6485d6630 100644 --- a/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test +++ b/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test @@ -33,3 +33,4 @@ connection master; DROP TABLE t1, t2; sync_slave_with_master; connection master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test index 9e3cbbd325a..afd964ca81a 100644 --- a/mysql-test/suite/rpl/t/rpl_row_until.test +++ b/mysql-test/suite/rpl/t/rpl_row_until.test @@ -4,9 +4,6 @@ # Note: The test is dependent on binlog positions -# prepare version for substitutions -let $VERSION=`select version()`; - # Create some events on master connection master; CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); @@ -121,3 +118,10 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561; START SLAVE; --replace_result 740 MASTER_LOG_POS START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740; + +--source include/stop_slave.inc +# Clear slave IO error. +RESET SLAVE; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_view01.test b/mysql-test/suite/rpl/t/rpl_row_view01.test index 77e4b98f780..cc60ab9912c 100644 --- a/mysql-test/suite/rpl/t/rpl_row_view01.test +++ b/mysql-test/suite/rpl/t/rpl_row_view01.test @@ -95,3 +95,4 @@ sync_slave_with_master; # End of 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_wide_table.test b/mysql-test/suite/rpl/t/rpl_row_wide_table.test index 7b17d7c4866..b1d16133096 100644 --- a/mysql-test/suite/rpl/t/rpl_row_wide_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_wide_table.test @@ -337,3 +337,4 @@ sync_slave_with_master; # END of Test Case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_server_id1.test b/mysql-test/suite/rpl/t/rpl_server_id1.test index c97f7975278..90198a4ac5e 100644 --- a/mysql-test/suite/rpl/t/rpl_server_id1.test +++ b/mysql-test/suite/rpl/t/rpl_server_id1.test @@ -4,21 +4,19 @@ # ignored, which has caught our customers), unless # --replicate-same-server-id. -source include/master-slave.inc; -connection slave; -reset master; +--let $rpl_topology= 2->2 +--let $rpl_skip_start_slave= 1 +--source include/rpl_init.inc -# replicate ourselves -source include/stop_slave.inc; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval change master to master_port=$SLAVE_MYPORT; -start slave; +--connection server_2 +START SLAVE; +# 1593 = ER_SLAVE_FATAL_ERROR +--let $slave_io_errno= 1593 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc -let $slave_param= Last_IO_Errno; -let $slave_param_value= 1593; -source include/wait_for_slave_param.inc; ---echo *** must be having the replicate-same-server-id IO thread error *** -let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1); -let $last_io_error= query_get_value("show slave status", Last_IO_Error, 1); -echo Slave_IO_Errno= $last_io_errno; -echo Slave_IO_Error= $last_io_error; +--source include/stop_slave_sql.inc +RESET SLAVE; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_server_id2.test b/mysql-test/suite/rpl/t/rpl_server_id2.test index 488a3aa6ab6..32d5e1ec8f2 100644 --- a/mysql-test/suite/rpl/t/rpl_server_id2.test +++ b/mysql-test/suite/rpl/t/rpl_server_id2.test @@ -61,3 +61,4 @@ drop table t2; sync_slave_with_master; # End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_session_var.test b/mysql-test/suite/rpl/t/rpl_session_var.test index 50efc8930a1..4ea07d4f9d6 100644 --- a/mysql-test/suite/rpl/t/rpl_session_var.test +++ b/mysql-test/suite/rpl/t/rpl_session_var.test @@ -63,3 +63,4 @@ drop table t1; save_master_pos; connection slave; sync_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_set_charset.test b/mysql-test/suite/rpl/t/rpl_set_charset.test index c70eb2681f5..53ec08f752f 100644 --- a/mysql-test/suite/rpl/t/rpl_set_charset.test +++ b/mysql-test/suite/rpl/t/rpl_set_charset.test @@ -33,3 +33,4 @@ connection slave; sync_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_set_null_innodb.test b/mysql-test/suite/rpl/t/rpl_set_null_innodb.test index dba79b78fa1..2d0c34e1d0a 100644 --- a/mysql-test/suite/rpl/t/rpl_set_null_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_set_null_innodb.test @@ -4,3 +4,4 @@ -- let $engine= InnoDB -- source extra/rpl_tests/rpl_set_null.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_set_null_myisam.test b/mysql-test/suite/rpl/t/rpl_set_null_myisam.test index 7b433071553..13cd7c3e4a8 100644 --- a/mysql-test/suite/rpl/t/rpl_set_null_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_set_null_myisam.test @@ -3,3 +3,4 @@ -- let $engine= MyISAM -- source extra/rpl_tests/rpl_set_null.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_running.test b/mysql-test/suite/rpl/t/rpl_show_slave_running.test index 8a3e56975ad..e589e126186 100644 --- a/mysql-test/suite/rpl/t/rpl_show_slave_running.test +++ b/mysql-test/suite/rpl/t/rpl_show_slave_running.test @@ -80,3 +80,4 @@ connection slave; eval set global debug= '$debug_saved'; SET DEBUG_SYNC= 'RESET'; --echo End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_skip_error.test b/mysql-test/suite/rpl/t/rpl_skip_error.test index 8d176ac0c3b..2853c95b212 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_error.test +++ b/mysql-test/suite/rpl/t/rpl_skip_error.test @@ -167,3 +167,4 @@ DROP TABLE t1; DROP TABLE t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test index 1a0ff8d52f0..70ebba0047b 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test +++ b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test @@ -62,7 +62,9 @@ SELECT * FROM t2 ORDER BY a; SELECT * FROM t3 ORDER BY a; --connection slave ---source include/wait_for_slave_sql_to_stop.inc +# 1146 = ER_NO_SUCH_TABLE +--let $slave_sql_errno= 1146 +--source include/wait_for_slave_sql_error.inc SHOW TABLES LIKE 't%'; if (`SELECT @@BINLOG_FORMAT = 'ROW'`) { --replace_regex /AA/AA_for_row_or_XX_for_stmt_mixed/ @@ -77,7 +79,7 @@ if (!`SELECT @@BINLOG_FORMAT = 'ROW'`) { SELECT * FROM t2 ORDER BY a; } ---source include/stop_slave.inc +--source include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; --source include/start_slave.inc @@ -107,7 +109,9 @@ INSERT INTO t1 VALUES(2, 'B'); UPDATE t1 SET b = 'X' WHERE a = 2; --connection slave ---source include/wait_for_slave_sql_to_stop.inc +# 1146 = ER_NO_SUCH_TABLE +--let $slave_sql_errno= 1146 +--source include/wait_for_slave_sql_error.inc --connection master SELECT * FROM t1 ORDER BY a; @@ -119,7 +123,7 @@ SHOW TABLES LIKE 't%'; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; ---source include/stop_slave.inc +--source include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; --source include/start_slave.inc @@ -151,7 +155,9 @@ INSERT INTO t3 VALUES (3, 'C'), (4, 'D'); COMMIT; --connection slave ---source include/wait_for_slave_sql_to_stop.inc +# 1146 = ER_NO_SUCH_TABLE +--let $slave_sql_errno= 1146 +--source include/wait_for_slave_sql_error.inc --connection master SELECT * FROM t1 ORDER BY a; @@ -163,7 +169,7 @@ SHOW TABLES LIKE 't%'; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; -source include/stop_slave.inc; +source include/stop_slave_io.inc; RENAME TABLE t3_bak TO t3; source include/start_slave.inc; @@ -174,3 +180,4 @@ DROP TABLE t1,t2,t3; --sync_slave_with_master # End of 5.1 test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_in.test b/mysql-test/suite/rpl/t/rpl_slave_load_in.test index 54ebdffce69..80a27479ae2 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_in.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_in.test @@ -31,12 +31,10 @@ commit; ########################################################################## sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; ########################################################################## @@ -48,3 +46,4 @@ drop table t1; drop table t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index b7342fd1c40..d80a2ed9e25 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -42,8 +42,12 @@ connection master; drop table t1; -connection slave; +--source include/sync_slave_io_with_master.inc +--source include/stop_slave_io.inc +RESET SLAVE; drop table t1; call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3"); +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test index 68c41abf537..0481581998c 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test @@ -5,20 +5,17 @@ --source include/have_log_bin.inc --source include/not_embedded.inc -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); -connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); +--let $rpl_skip_start_slave= 1 +--source include/master-slave.inc -connection slave; - ---replace_result $MASTER_MYPORT MASTER_MYPORT -eval CHANGE MASTER TO MASTER_USER='root', - MASTER_CONNECT_RETRY=1, - MASTER_HOST='127.0.0.1', - MASTER_PORT=$MASTER_MYPORT; +--connection slave START SLAVE; +# Why 12??? +--let $slave_sql_errno= 12 +source include/wait_for_slave_sql_error.inc; + +--source include/stop_slave_io.inc +RESET SLAVE; -source include/wait_for_slave_sql_to_stop.inc; -let $errno=query_get_value("show slave status", Last_SQL_Errno, 1); -echo $errno; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test index 4c5930d74fe..2dddabf4b4c 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_skip.test +++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test @@ -299,3 +299,4 @@ connection master; DROP TABLE t10; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test index 4edf1802a5d..83a18474976 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_status.test +++ b/mysql-test/suite/rpl/t/rpl_slave_status.test @@ -55,15 +55,20 @@ source include/stop_slave.inc; START SLAVE; source include/wait_for_slave_sql_to_start.inc; ---echo ==== Verify that Slave_IO_Running = No ==== -let $result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); ---echo Slave_IO_Running = $result (should be No) +--echo ==== Verify that Slave IO thread stopped with error ==== +# 1045 = ER_ACCESS_DENIED_ERROR +--let $slave_io_errno= 1045 +--source include/wait_for_slave_io_error.inc --echo ==== Cleanup (Note that slave IO thread is not running) ==== -DROP TABLE t1; -# cleanup: slave io thread has been stopped "irrecoverably" -# so we clean up mess manually + +# cleanup: slave io thread has is stopped so we reset replication +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc --echo [on master] connection master; DROP TABLE t1; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log.test b/mysql-test/suite/rpl/t/rpl_slow_query_log.test index ced4859ebe7..76664705f99 100644 --- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test +++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test @@ -195,7 +195,7 @@ disconnect extra2; # BUG#50620: Adding an index to a table prevents slave from logging into slow log # --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master SET @old_log_output= @@log_output; @@ -306,3 +306,4 @@ DROP TABLE t1; -- sync_slave_with_master SET @@global.log_output= @old_log_output; SET @@global.long_query_time= @old_long_query_time; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test index 243136a0d38..10e23eb5928 100644 --- a/mysql-test/suite/rpl/t/rpl_sp.test +++ b/mysql-test/suite/rpl/t/rpl_sp.test @@ -643,3 +643,4 @@ drop function mysqltestbug36570_f1; # Cleanup sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sp004.test b/mysql-test/suite/rpl/t/rpl_sp004.test index 967e7007c15..b916c78a6fb 100644 --- a/mysql-test/suite/rpl/t/rpl_sp004.test +++ b/mysql-test/suite/rpl/t/rpl_sp004.test @@ -95,3 +95,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/sp004_master.sql $MYSQLTEST_VARDIR/tmp/sp004_sl # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sp_effects.test b/mysql-test/suite/rpl/t/rpl_sp_effects.test index 63ac3a8ad9c..df13ff253b1 100644 --- a/mysql-test/suite/rpl/t/rpl_sp_effects.test +++ b/mysql-test/suite/rpl/t/rpl_sp_effects.test @@ -261,3 +261,4 @@ SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creato sync_slave_with_master; --echo end of the tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sporadic_master.test b/mysql-test/suite/rpl/t/rpl_sporadic_master.test index 824f7abc9f5..2a60a5c5e29 100644 --- a/mysql-test/suite/rpl/t/rpl_sporadic_master.test +++ b/mysql-test/suite/rpl/t/rpl_sporadic_master.test @@ -27,3 +27,4 @@ drop table t1,t2; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test index 803b08eeec5..0ba88a62242 100644 --- a/mysql-test/suite/rpl/t/rpl_ssl.test +++ b/mysql-test/suite/rpl/t/rpl_ssl.test @@ -97,4 +97,14 @@ drop user replssl@localhost; drop table t1; sync_slave_with_master; +--source include/stop_slave.inc +CHANGE MASTER TO + master_user = 'root', + master_ssl = 0, + master_ssl_ca = '', + master_ssl_cert = '', + master_ssl_key = ''; + --echo End of 5.0 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test index eca6a8cf46e..0a64415dbd8 100644 --- a/mysql-test/suite/rpl/t/rpl_ssl1.test +++ b/mysql-test/suite/rpl/t/rpl_ssl1.test @@ -9,11 +9,8 @@ source include/master-slave.inc; connection master; grant replication slave on *.* to replssl@localhost require ssl; create table t1 (t int); -save_master_pos; -#syncing with master -connection slave; -sync_with_master; +sync_slave_with_master; #trying to use this user without ssl stop slave; @@ -37,9 +34,7 @@ start slave; #avoiding unneeded sleeps connection master; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; #checking that replication is ok select * from t1; @@ -56,9 +51,8 @@ start slave; connection master; drop user replssl@localhost; drop table t1; -save_master_pos; -connection slave; -sync_with_master; + +sync_slave_with_master; source include/show_slave_status.inc; source include/check_slave_is_running.inc; # End of 4.1 tests @@ -90,6 +84,19 @@ select * from t1; source include/show_slave_status.inc; --source include/check_slave_is_running.inc +# ==== Clean up ==== + connection master; drop table t1; sync_slave_with_master; +--source include/stop_slave.inc +CHANGE MASTER TO + master_host="127.0.0.1", + master_ssl_ca ='', + master_ssl_cert='', + master_ssl_key='', + master_ssl_verify_server_cert=0, + master_ssl=0; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test index 709731d5889..15f98916485 100644 --- a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test @@ -123,3 +123,4 @@ drop table t1i, t2m; sync_slave_with_master; # End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001.test b/mysql-test/suite/rpl/t/rpl_stm_000001.test index aee067b2d4a..9841ecb040a 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_000001.test +++ b/mysql-test/suite/rpl/t/rpl_stm_000001.test @@ -1,2 +1,128 @@ -let $engine_type=myisam; --- source extra/rpl_tests/rpl_stm_000001.test +# Requires binlog_format=statement format since query involving +# get_lock() is logged in row format if binlog_format=mixed or row. +-- source include/have_binlog_format_statement.inc +-- source include/master-slave.inc + +--let $engine_type= myisam +CALL mtr.add_suppression("Statement may not be safe to log in statement format."); + +# Load some data into t1 +create table t1 (word char(20) not null); +load data infile '../../std_data/words.dat' into table t1; +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1; +select * from t1 limit 10; + +# +# Test slave with wrong password +# +sync_slave_with_master; +stop slave; +connection master; +set password for root@"localhost" = password('foo'); +connection slave; +start slave; +connection master; +# +# Give slave time to do at last one failed connect retry +# This one must be short so that the slave will not stop retrying +real_sleep 2; +set password for root@"localhost" = password(''); +# Give slave time to connect (will retry every second) +sleep 2; + +create table t3(n int); +insert into t3 values(1),(2); +sync_slave_with_master; +select * from t3; +select sum(length(word)) from t1; +connection master; +drop table t1,t3; +sync_slave_with_master; + +# Test if the slave SQL thread can be more than 16K behind the slave +# I/O thread (> IO_SIZE) + +connection master; +# we'll use table-level locking to delay slave SQL thread +eval create table t1 (n int) engine=$engine_type; +sync_slave_with_master; +connection master; +reset master; +connection slave; +stop slave; +reset slave; + +connection master; +let $1=5000; +# Generate 16K of relay log +disable_query_log; +while ($1) +{ + eval insert into t1 values($1); + dec $1; +} +enable_query_log; + +# Try to cause a large relay log lag on the slave by locking t1 +connection slave; +lock tables t1 read; +start slave; +#hope this is long enough for I/O thread to fetch over 16K relay log data +sleep 3; +unlock tables; + +#test handling of aborted connection in the middle of update + +connection master; +create table t2(id int); +insert into t2 values(connection_id()); + +connection master1; +# Avoid generating result +create temporary table t3(n int); +--disable_warnings +insert into t3 select get_lock('crash_lock%20C', 1) from t2; +--enable_warnings + +connection master; +send update t1 set n = n + get_lock('crash_lock%20C', 2); +connection master1; +sleep 3; +select (@id := id) - id from t2; +kill @id; +# We don't drop t3 as this is a temporary table +drop table t2; +connection master; +# The get_lock function causes warning for unsafe statement. +--disable_warnings +--error 1317,2013 +reap; +--enable_warnings +connection slave; +# The SQL slave thread should now have stopped because the query was killed on +# the master (so it has a non-zero error code in the binlog). +# 1053 = ER_SERVER_SHUTDOWN +--let $slave_sql_errno= 1053 +--source include/wait_for_slave_sql_error_and_skip.inc + +select count(*) from t1; +connection master1; +drop table t1; +create table t1 (n int); +insert into t1 values(3456); +insert into mysql.user (Host, User, Password) + VALUES ("10.10.10.%", "blafasel2", password("blafasel2")); +select select_priv,user from mysql.user where user = _binary'blafasel2'; +update mysql.user set Select_priv = "Y" where User= _binary"blafasel2"; +select select_priv,user from mysql.user where user = _binary'blafasel2'; +sync_slave_with_master; +select n from t1; +select select_priv,user from mysql.user where user = _binary'blafasel2'; +connection master1; +drop table t1; +delete from mysql.user where user="blafasel2"; +sync_slave_with_master; + +# End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test b/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test index a8139bbbcd2..6381150217f 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test +++ b/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test @@ -108,3 +108,4 @@ DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; enable_warnings; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test b/mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test index f0c36c7b40c..2a899b06a2d 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test +++ b/mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test @@ -228,3 +228,4 @@ sync_slave_with_master; --echo ################################################################################### SET @commands= 'clean'; --source extra/rpl_tests/rpl_mixing_engines.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_conflicts.test b/mysql-test/suite/rpl/t/rpl_stm_conflicts.test index 07b7a0bf8f7..cd9e71cbff9 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_conflicts.test +++ b/mysql-test/suite/rpl/t/rpl_stm_conflicts.test @@ -1,11 +1,6 @@ -# See the top of mysql-test/extra/rpl_tests/rpl_conflicts.test for an -# explanation of what this test does. -# -# This test file is for statement-logging mode. - source include/have_binlog_format_mixed_or_statement.inc; source include/master-slave.inc; source extra/rpl_tests/rpl_conflicts.test; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_create_if_not_exists.test b/mysql-test/suite/rpl/t/rpl_stm_create_if_not_exists.test index 69866cad267..b72a2e1532d 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_create_if_not_exists.test +++ b/mysql-test/suite/rpl/t/rpl_stm_create_if_not_exists.test @@ -11,4 +11,4 @@ source extra/rpl_tests/rpl_stm_create_if_not_exists.test; let $is_temporary=1; source extra/rpl_tests/rpl_stm_create_if_not_exists.test; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test index cffa70ac9ce..83ef8699425 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test +++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test @@ -4,6 +4,3 @@ let $rename_event_pos= `select @binlog_start_pos + 578`; -- source extra/rpl_tests/rpl_flsh_tbls.test - -# End of 4.1 tests -# Adding comment for force manual merge 5.0 -> wl1012. Delete me if needed. diff --git a/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test b/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test index d55e3a4da2c..e9ee040c890 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test +++ b/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test @@ -18,3 +18,4 @@ set @@global.binlog_format = mixed; connection master; set @@global.binlog_format = @old_global_binlog_format; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_loadfile.test b/mysql-test/suite/rpl/t/rpl_stm_loadfile.test index 3db8385a2f2..acf8c9a1bde 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_stm_loadfile.test @@ -18,3 +18,4 @@ -- source extra/rpl_tests/rpl_loadfile.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_log.test b/mysql-test/suite/rpl/t/rpl_stm_log.test index 7bc17fbaada..7e7e1d4033f 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_log.test +++ b/mysql-test/suite/rpl/t/rpl_stm_log.test @@ -7,3 +7,4 @@ let $engine_type=MyISAM; # End of 4.1 tests # Adding comment for force manual merge 5.0 -> wl1012: Delete me +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_maria.test b/mysql-test/suite/rpl/t/rpl_stm_maria.test index b4dc0ef7e4a..ebcddf4175d 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_maria.test +++ b/mysql-test/suite/rpl/t/rpl_stm_maria.test @@ -54,3 +54,6 @@ sync_slave_with_master; connection master; drop table t1,t2,t3; sync_slave_with_master; + +# End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test b/mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test index 950aa8b322a..1a7139c889a 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test +++ b/mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test @@ -6,6 +6,3 @@ # Requires statement logging -- source include/have_binlog_format_mixed_or_statement.inc -- source extra/rpl_tests/rpl_max_relay_size.test - -# End of 4.1 tests -# diff --git a/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test index 4086fd03ca1..575180e9177 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test @@ -8,7 +8,7 @@ # BUG#49522: Replication problem with mixed MyISAM/InnoDB # --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master CREATE TABLE `t1` ( @@ -32,12 +32,11 @@ SET AUTOCOMMIT=1; -- sync_slave_with_master --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE `t1`; -- sync_slave_with_master --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_multi_query.test b/mysql-test/suite/rpl/t/rpl_stm_multi_query.test index c39d1fad015..e234f4b9622 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_multi_query.test +++ b/mysql-test/suite/rpl/t/rpl_stm_multi_query.test @@ -3,10 +3,5 @@ # CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not # one binlog event containing all queries) -# Requires statement logging -- source include/have_binlog_format_mixed_or_statement.inc -- source extra/rpl_tests/rpl_multi_query.test - - -# End of 4.1 tests -# diff --git a/mysql-test/suite/rpl/t/rpl_stm_no_op.test b/mysql-test/suite/rpl/t/rpl_stm_no_op.test index 66dc89bd712..1605b177ac4 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_no_op.test +++ b/mysql-test/suite/rpl/t/rpl_stm_no_op.test @@ -91,3 +91,4 @@ select * from t2; connection master; drop table t1, t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_sql_mode.test b/mysql-test/suite/rpl/t/rpl_stm_sql_mode.test index d5aac4a43e2..0eb41d1c6bd 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_sql_mode.test +++ b/mysql-test/suite/rpl/t/rpl_stm_sql_mode.test @@ -22,3 +22,4 @@ DROP TABLE t1; -- echo # duplicate key error (because it has received event -- echo # with expected error code). -- sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_until-master.opt b/mysql-test/suite/rpl/t/rpl_stm_until-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stm_until-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test index f5e57ec2bd6..feac9b21c84 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_until.test +++ b/mysql-test/suite/rpl/t/rpl_stm_until.test @@ -19,6 +19,7 @@ -- source include/have_binlog_format_mixed_or_statement.inc -- source include/master-slave.inc +-- source include/rpl_reset.inc # Test is dependent on binlog positions @@ -192,10 +193,12 @@ sync_with_master; # to substitute the genuine one with a prepared on 4.1 server. # ---source include/master-slave-reset.inc +--source include/rpl_reset.inc connection master; +--disable_warnings drop table if exists t1; # there is create table t1 in bug47142_master-bin.000001 +--enable_warnings sync_slave_with_master; connection slave; stop slave; @@ -218,9 +221,7 @@ show tables /* t1 must exist */; drop table t1; # drop on slave only, master does not have t1. stop slave; -reset slave; - -connection master; -reset master; # End of tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test index e44cf3e94b7..e7c67448dbe 100644 --- a/mysql-test/suite/rpl/t/rpl_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test @@ -57,4 +57,4 @@ SET GLOBAL debug= '$debug_save'; connection master; DROP TABLE t1, t2; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test index a9c668b4293..e44d2d9912b 100644 --- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test @@ -611,3 +611,4 @@ sync_slave_with_master; connection master; # Restore binlog format setting set global binlog_format =@my_binlog_format; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_table_options.test b/mysql-test/suite/rpl/t/rpl_table_options.test index b3d75bb0f95..2252192adeb 100644 --- a/mysql-test/suite/rpl/t/rpl_table_options.test +++ b/mysql-test/suite/rpl/t/rpl_table_options.test @@ -28,4 +28,7 @@ connection master; drop table t1; set storage_engine=default; select 1; + +# Cleanup uninstall plugin example; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temp_table.test b/mysql-test/suite/rpl/t/rpl_temp_table.test index 9b73961aeea..4118e9783fa 100644 --- a/mysql-test/suite/rpl/t/rpl_temp_table.test +++ b/mysql-test/suite/rpl/t/rpl_temp_table.test @@ -54,6 +54,7 @@ show status like 'Slave_open_temp_tables'; connect (master2,localhost,root,,); connection master2; drop table if exists t1,t2; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test index 82537a06e89..b41fb83fa4a 100644 --- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test +++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test @@ -32,6 +32,7 @@ SHOW STATUS LIKE "Slave_open_temp_tables"; --connection master disconnect master; +--echo [on master1] --connection master1 # waiting DROP TEMPORARY TABLE event to be written into binlog @@ -47,7 +48,10 @@ SHOW STATUS LIKE "Slave_open_temp_tables"; --echo ==== Clean up ==== --echo [on master] ---connection master1 +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc +--connection master DROP TABLE t1; --echo [on slave] @@ -89,8 +93,7 @@ sync_slave_with_master; # 10. in the end the slave should not have open temp tables. # -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master # action: setup environment @@ -191,11 +194,13 @@ COMMIT; source include/show_binlog_events.inc; +--sync_slave_with_master + --echo # Compare the base table. -let diff_table= test.t1; -source include/rpl_diff_tables.inc; +--let $diff_tables= master:t1, slave:t1 +--source include/diff_tables.inc --echo connection master; DROP TABLE t1; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test index 26273e86c48..f9e481c1e7b 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temporary.test @@ -1,11 +1,11 @@ --- source include/master-slave.inc - # Test need anonymous user when connection are made as "zedjzlcsjhd" # But we only need it on the master, not the slave. SET sql_log_bin = 0; source include/add_anonymous_users.inc; SET sql_log_bin = 1; +-- source include/master-slave.inc + # Clean up old slave's binlogs. # The slave is started with --log-slave-updates # and this test does SHOW BINLOG EVENTS on the slave's @@ -292,11 +292,15 @@ connection master; drop table t1; --remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql -# Delete the anonymous users -SET sql_log_bin = 0; -source include/delete_anonymous_users.inc; -SET sql_log_bin = 1; +--sync_slave_with_master +# Delete the anonymous users. +--source include/stop_slave.inc +source include/delete_anonymous_users.inc; +--connection master +source include/delete_anonymous_users.inc; +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc # @@ -328,9 +332,7 @@ connection slave; DROP USER user43748@127.0.0.1; ---echo -- done. back to master. -connection master; - - --echo End of 5.1 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test index 6b1ba558d2d..e441dd8cb85 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test +++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test @@ -2,6 +2,7 @@ source include/master-slave.inc; source include/have_innodb.inc; call mtr.add_suppression("Deadlock found"); +call mtr.add_suppression("Can't find record in 't.'"); --echo **** On Master **** connection master; @@ -27,13 +28,13 @@ set @@global.slave_exec_mode= default; SHOW STATUS LIKE 'Slave_retried_transactions'; SELECT * FROM t1; source include/check_slave_is_running.inc; -DROP TABLE t1; --echo **** On Master **** connection master; -SET SQL_LOG_BIN= 0; DROP TABLE t1; -SET SQL_LOG_BIN= 1; +--sync_slave_with_master +--connection master + # BUG#Bug #53259 Unsafe statement binlogged in statement format w/MyIsam temp tables # @@ -78,6 +79,4 @@ DROP TABLE t_myisam, t_innodb; # "Deadlock found" set in this test case is not effective during server # shutdown. --sync_slave_with_master -connection slave; -STOP SLAVE; ---source include/wait_for_slave_to_stop.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_test_framework.cnf b/mysql-test/suite/rpl/t/rpl_test_framework.cnf new file mode 100644 index 00000000000..8a34e5b060d --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_test_framework.cnf @@ -0,0 +1,46 @@ +!include ../my.cnf +[mysqld.1] +log-slave-updates +[mysqld.2] +log-slave-updates +[mysqld.3] +log-slave-updates +[mysqld.4] +log-slave-updates +[mysqld.5] +log-slave-updates +[mysqld.6] +log-slave-updates +[mysqld.7] +log-slave-updates +[mysqld.8] +log-slave-updates +[mysqld.9] +log-slave-updates +# [mysqld.10] +# log-slave-updates +# [mysqld.11] +# log-slave-updates +# [mysqld.12] +# log-slave-updates +# [mysqld.13] +# log-slave-updates +# [mysqld.14] +# log-slave-updates +# [mysqld.15] +# log-slave-updates + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYPORT_4= @mysqld.4.port +SERVER_MYPORT_5= @mysqld.5.port +SERVER_MYPORT_6= @mysqld.6.port +SERVER_MYPORT_7= @mysqld.7.port +SERVER_MYPORT_8= @mysqld.8.port +SERVER_MYPORT_9= @mysqld.9.port +# SERVER_MYPORT_10= @mysqld.10.port +# SERVER_MYPORT_11= @mysqld.11.port +# SERVER_MYPORT_12= @mysqld.12.port +# SERVER_MYPORT_13= @mysqld.13.port +# SERVER_MYPORT_14= @mysqld.14.port +# SERVER_MYPORT_15= @mysqld.15.port diff --git a/mysql-test/suite/rpl/t/rpl_test_framework.test b/mysql-test/suite/rpl/t/rpl_test_framework.test new file mode 100644 index 00000000000..e0f961caff1 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_test_framework.test @@ -0,0 +1,143 @@ +# ==== Purpose ==== +# +# Test that the sync chain generated by +# include/rpl_change_topology.inc (sourced from include/rpl_init.inc) +# is correct. +# +# We test a number of different topologies. Each topology is tested +# in extra/rpl_tests/rpl_test_framework.inc. See +# extra/rpl_tests/rpl_test_framework.inc for details on how the sync +# chain is tested. +# +# ==== Related bugs ==== +# +# BUG#49978: Replication tests don't clean up replication state at the end + + +# We only need to execute this test once. Also, we rely on 'DELETE +# FROM t1' to remove rows in slave tables that don't exist in master +# tables (see include/rpl_test_framework.inc for details). +--source include/have_binlog_format_statement.inc + + +--echo ==== Create t1 on all servers. ==== +if ($mtr_supports_more_than_10_servers) +{ + --let $rpl_server_count= 15 + --let $rpl_topology= 1->2->3->4->5->6->7->8->9->10->11->12->13->14->15 +} +if (!$mtr_supports_more_than_10_servers) +{ + --let $rpl_server_count= 9 + --let $rpl_topology= 1->2->3->4->5->6->7->8->9 +} +--source include/rpl_init.inc +CREATE TABLE t1 (a INT); +--source include/rpl_end.inc + +# Initialize $next_number before first call to +# extra/rpl_tests/rpl_test_framework.text +--let $next_number= 0 + + +--echo ==== Test 3-server topologies ==== + +--let $rpl_server_count= 3 + +--let $rpl_topology= 1 -> 2 +--let $masters= 1,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 2 -> 3 +--let $masters= 1,2 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= none +--let $masters= 1,2,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2, 2->1 +--let $masters= 1,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2->1 +--let $masters= 2,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 2->1->2 +--let $masters= 1,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2->3 +--let $masters= 1 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 2->3->2->1 +--let $masters= 3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2,2->3,3->1 +--let $masters= 3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->3->2->1 +--let $masters= 3 +--source extra/rpl_tests/rpl_test_framework.inc + + +--echo ==== Test 6-server topologies ==== + +--let $rpl_server_count= 6 + +--let $rpl_topology= 1->2->3->4->1->5->6 +--let $masters= 1 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 3->4->5->6->3->1->2 +--let $masters= 4 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 6->5->4->3->2->1 +--let $masters= 6 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2->3->1,4->5->6 +--let $masters= 3,4 +--source extra/rpl_tests/rpl_test_framework.inc + + +--echo ==== Test 9-server topology ==== + +--let $rpl_server_count= 9 + +--let $rpl_topology= 1->2, 2->3, 3->4, 4->5, 5->1, 1->6, 6->7, 6->8, 8->9 +--let $masters= 2 +--source extra/rpl_tests/rpl_test_framework.inc + +if ($mtr_supports_more_than_10_servers) { +--echo ==== Test 15-server topologies ==== + +--let $rpl_server_count= 15 + +--let $rpl_topology= 1->2->3->4->5->6->7->8->9->10->11->12->13->14->15->1 +--let $masters= 2 +--source extra/rpl_tests/rpl_test_framework.inc + +# This is a binary tree +--let $rpl_topology= 1->2->4->8,1->3->6->12,2->5->10,3->7->14,4->9,5->11,6->13,7->15 +--let $masters= 1 +--source extra/rpl_tests/rpl_test_framework.inc +} + +--echo ==== Clean up ==== + +if ($mtr_supports_more_than_10_servers) { + --let $rpl_topology= 1->2->3->4->5->6->7->8->9->10->11->12->13->14->15 +} +if (!$mtr_supports_more_than_10_servers) { + --let $rpl_topology= 1->2->3->4->5->6->7->8->9 +} +--source include/rpl_init.inc +--connection server_1 +DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_timezone.test b/mysql-test/suite/rpl/t/rpl_timezone.test index 45d1f12b5d5..5b8b1df2652 100644 --- a/mysql-test/suite/rpl/t/rpl_timezone.test +++ b/mysql-test/suite/rpl/t/rpl_timezone.test @@ -164,6 +164,8 @@ SET @@session.time_zone = default; connection master; DROP TABLE t1; SET @@session.time_zone = default; +--sync_slave_with_master +--source include/stop_slave.inc # Bug#41719 delayed INSERT into timestamp col needs set time_zone for concurrent binlogging # To test that time_zone is correctly binloging for 'insert delayed' statement @@ -196,4 +198,7 @@ select * from t1 order by a; DROP TABLE t1; SET @@session.time_zone = default; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc + --echo End of 5.0 tests diff --git a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test index d8c6ae5ade8..f4860d112eb 100644 --- a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test +++ b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test @@ -10,3 +10,5 @@ source include/have_binlog_format_row.inc; LET $ENGINE_TYPE= MyISAM; source extra/rpl_tests/rpl_tmp_table_and_DDL.test; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test index 442f18ca61d..6baf7077d52 100644 --- a/mysql-test/suite/rpl/t/rpl_trigger.test +++ b/mysql-test/suite/rpl/t/rpl_trigger.test @@ -317,24 +317,19 @@ let $MYSQLD_DATADIR= `select @@datadir`; FLUSH LOGS; # Stop master server ---echo --> Stop master server ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF ---shutdown_server 10 ---source include/wait_until_disconnected.inc +--let $rpl_server_number= 1 +--source include/rpl_stop_server.inc + # Replace binlog remove_file $MYSQLD_DATADIR/master-bin.000001; copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLD_DATADIR/master-bin.000001; - ---echo --> Start master server ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF ---enable_reconnect ---source include/wait_until_connected_again.inc + +--let $rpl_server_number= 1 +--source include/rpl_start_server.inc + let $binlog_version= query_get_value(SHOW BINLOG EVENTS, Info, 1); + # Make the slave to replay the new binlog. --echo --> Master binlog: $binlog_version @@ -510,7 +505,8 @@ sync_slave_with_master; # connection master; -source include/master-slave-reset.inc; +--source include/rpl_reset.inc + connection slave; connection master; @@ -525,12 +521,10 @@ insert into t1 values ( 1 ); rollback; sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; --source include/diff_tables.inc -let $diff_table_1=master:test.log; -let $diff_table_2=slave:test.log; +let $diff_tables= master:log, slave:log; --source include/diff_tables.inc connection master; @@ -540,3 +534,4 @@ sync_slave_with_master; # # End of tests # +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_trunc_temp.test b/mysql-test/suite/rpl/t/rpl_trunc_temp.test index 88ecb7c18b0..0e7d5483f62 100644 --- a/mysql-test/suite/rpl/t/rpl_trunc_temp.test +++ b/mysql-test/suite/rpl/t/rpl_trunc_temp.test @@ -52,3 +52,6 @@ let $wait_binlog_event= DROP; source include/wait_for_binlog_event.inc; show status like 'Slave_open_temp_tables'; + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test b/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test index a0f0ea04f44..bea6332963e 100644 --- a/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test +++ b/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test @@ -1,4 +1,3 @@ --source include/not_ndb_default.inc let $engine=MyISAM; --source extra/rpl_tests/rpl_truncate.test - diff --git a/mysql-test/suite/rpl/t/rpl_truncate_3innodb.test b/mysql-test/suite/rpl/t/rpl_truncate_3innodb.test index a31fd62a29a..093cf56a316 100644 --- a/mysql-test/suite/rpl/t/rpl_truncate_3innodb.test +++ b/mysql-test/suite/rpl/t/rpl_truncate_3innodb.test @@ -1,6 +1,4 @@ - --source include/have_innodb.inc --source include/not_ndb_default.inc - let $engine=InnoDB; --source extra/rpl_tests/rpl_truncate.test diff --git a/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test b/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test index e7882b28065..d4aae5736b4 100644 --- a/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test @@ -6,17 +6,16 @@ # BUG#49618: Field length stored incorrectly in binary log for InnoDB # -source include/reset_master_and_slave.inc; - connection master; CREATE TABLE t1(b1 BIT(1), b2 BIT(2), b3 BIT(3)) ENGINE=InnoDB; INSERT INTO t1 VALUES (b'0', b'01', b'101'); sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; connection master; DROP TABLE t1; sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_udf.test b/mysql-test/suite/rpl/t/rpl_udf.test index 262ad04630c..452431e2f52 100644 --- a/mysql-test/suite/rpl/t/rpl_udf.test +++ b/mysql-test/suite/rpl/t/rpl_udf.test @@ -20,3 +20,4 @@ set binlog_format=statement; # Embedded server doesn't support binlogging --source include/rpl_udf.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_user.test b/mysql-test/suite/rpl/t/rpl_user.test index b8fe41d03c4..caa17b47733 100644 --- a/mysql-test/suite/rpl/t/rpl_user.test +++ b/mysql-test/suite/rpl/t/rpl_user.test @@ -59,3 +59,4 @@ select Host,User from mysql.user where Host='fakehost'; # connection master; source include/show_binlog_events.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_user_variables.test b/mysql-test/suite/rpl/t/rpl_user_variables.test index 8d570f28f64..d496458c3fb 100644 --- a/mysql-test/suite/rpl/t/rpl_user_variables.test +++ b/mysql-test/suite/rpl/t/rpl_user_variables.test @@ -378,4 +378,5 @@ DROP FUNCTION f2; DROP TABLE t1; sync_slave_with_master; -stop slave; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_variables.test b/mysql-test/suite/rpl/t/rpl_variables.test index 6c3b3ab6d8a..001b8a6bc8e 100644 --- a/mysql-test/suite/rpl/t/rpl_variables.test +++ b/mysql-test/suite/rpl/t/rpl_variables.test @@ -109,9 +109,7 @@ SET @user_text = 'Alunda'; # Stop slave so that we get a fresh sql thread, reading the slave's # global values of variables into its local copies. ---echo [on master] -connection master; -source include/reset_master_and_slave.inc; +--source include/rpl_reset.inc # We would have wanted to set this together with the other variables # above, but can't because it affects how the slave works. @@ -679,30 +677,11 @@ EXECUTE p61; EXECUTE p62; EXECUTE p63; EXECUTE p64; # Show the result in table test.tstmt on master... SELECT * FROM tstmt ORDER BY id; -let $diff_table_1=master:test.tstmt; -# ... then compare test.tstmt on master to the other tables on master... -let $diff_table_2=master:test.tproc; -source include/diff_tables.inc; -let $diff_table_2=master:test.tfunc; -source include/diff_tables.inc; -let $diff_table_2=master:test.ttrig; -source include/diff_tables.inc; -let $diff_table_2=master:test.tprep; -source include/diff_tables.inc; +--sync_slave_with_master -# ... and to all tables on slave. -connection master; -sync_slave_with_master; -let $diff_table_2=slave:test.tstmt; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tproc; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tfunc; -source include/diff_tables.inc; -let $diff_table_2=slave:test.ttrig; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tprep; +# ... then compare test.tstmt on master to the other tables on master and slave. +let $diff_tables= master:tstmt,tproc,tfunc,ttrig,tprep, slave:tstmt,tproc,tfunc,ttrig,tprep; source include/diff_tables.inc; @@ -737,3 +716,4 @@ SET @@global.sync_binlog= @s_sync_binlog; connection master; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_variables_stm.test b/mysql-test/suite/rpl/t/rpl_variables_stm.test index 85152ae878a..f2f535f27d1 100644 --- a/mysql-test/suite/rpl/t/rpl_variables_stm.test +++ b/mysql-test/suite/rpl/t/rpl_variables_stm.test @@ -575,29 +575,11 @@ EXECUTE p61; EXECUTE p62; EXECUTE p63; EXECUTE p64; # Show the result in table test.tstmt on master... SELECT * FROM tstmt ORDER BY id; -let $diff_table_1=master:test.tstmt; -# ... then compare test.tstmt on master to the other tables on master... -let $diff_table_2=master:test.tproc; -source include/diff_tables.inc; -let $diff_table_2=master:test.tfunc; -source include/diff_tables.inc; -let $diff_table_2=master:test.ttrig; -source include/diff_tables.inc; -let $diff_table_2=master:test.tprep; -source include/diff_tables.inc; +--sync_slave_with_master -# ... and to all tables on slave. -sync_slave_with_master; -let $diff_table_2=slave:test.tstmt; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tproc; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tfunc; -source include/diff_tables.inc; -let $diff_table_2=slave:test.ttrig; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tprep; +# ... then compare test.tstmt on master to the other tables on master and slave. +let $diff_tables= master:tstmt,tproc,tfunc,ttrig,tprep, slave:tstmt,tproc,tfunc,ttrig,tprep; source include/diff_tables.inc; @@ -634,3 +616,4 @@ SET @@global.collation_database= @s_collation_database; connection master; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_view.test b/mysql-test/suite/rpl/t/rpl_view.test index 1053514bfec..5d878fda205 100644 --- a/mysql-test/suite/rpl/t/rpl_view.test +++ b/mysql-test/suite/rpl/t/rpl_view.test @@ -183,3 +183,4 @@ DROP TABLE t1; sync_slave_with_master; --echo End of 5.0 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result index 28ca1ac43b9..eae70ca5a69 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET storage_engine=ndb; === NDB -> MYISAM === @@ -805,3 +801,4 @@ TRUNCATE TABLE t1; DROP TABLE IF EXISTS t1; drop table mysql.ndb_apply_status; set @@global.slave_exec_mode= @old_slave_exec_mode; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result index 6babf49dcaa..136aee25fe2 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=NDB; @@ -38,3 +34,4 @@ DROP PROCEDURE test.p1; DROP FUNCTION test.fn1; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result index 0fcd361da21..5e44591f87e 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] *** on slave there should be zero rows *** select count(*) from mysql.ndb_apply_status; count(*) @@ -18,3 +14,4 @@ select count(*) from mysql.ndb_apply_status; count(*) 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result index dd4cc90a75f..c537fb85ad2 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ***************** Test 1 ************************ CREATE TABLE t1 (a INT NOT NULL auto_increment,b INT, PRIMARY KEY (a)) ENGINE=NDB auto_increment=3; @@ -168,3 +164,4 @@ a 32 42 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result index d43165e2b5e..6109ea0b742 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', `nom` char(4) default NULL, `prenom` char(4) default NULL, @@ -140,7 +136,8 @@ set GLOBAL slave_transaction_retries=1; **** On Master **** UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1; **** On Slave **** -Last_SQL_Error = Could not execute Write_rows event on table test.t1; Got temporary error 266 'Time-out in NDB, probably caused by deadlock' from NDB, Error_code: 1297; Lock wait timeout exceeded; try restarting transaction, Error_code: 1205; handler error HA_ERR_LOCK_WAIT_TIMEOUT; the event's master log master-bin.000001, end_log_pos 6834 +include/wait_for_slave_sql_error.inc [errno=1205 ] +Last_SQL_Error = 'Could not execute Write_rows event on table test.t1; Got temporary error 266 'Time-out in NDB, probably caused by deadlock' from NDB, Error_code: 1297; Lock wait timeout exceeded; try restarting transaction, Error_code: 1205; handler error HA_ERR_LOCK_WAIT_TIMEOUT; the event's master log master-bin.000001, end_log_pos 6834' set GLOBAL slave_transaction_retries=10; include/start_slave.inc select * from t1 order by nid; @@ -191,3 +188,4 @@ c1 104 105 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result index c11de8c27e3..537af85d766 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 ( a int not null primary key, b text not null @@ -133,3 +129,4 @@ S testtttttttttt t1 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15 S testttttttttttt t1 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25 S testtttttttttttt t1 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob2.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob2.result index 055efffbd6a..4fb33dc4b6b 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob2.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; ***** Table Create Section **** @@ -154,3 +150,4 @@ c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result index dfbd7a37d8e..7ff7830449f 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result @@ -1,12 +1,6 @@ -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; -RESET MASTER; -CHANGE MASTER TO master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root"; -START SLAVE; +include/rpl_init.inc [topology=1->2->1] +include/rpl_connect.inc [creating master] +include/rpl_connect.inc [creating slave] CREATE TABLE t1 (a int key, b int) ENGINE=ndb; SHOW TABLES; Tables_in_test @@ -17,11 +11,12 @@ SELECT * FROM t1 ORDER BY a; a b 1 2 2 3 -Checking that both slave threads are running. +include/check_slave_is_running.inc SELECT * FROM t1 ORDER BY a; a b 1 2 2 3 -Checking that both slave threads are running. +include/check_slave_is_running.inc STOP SLAVE; DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result index b7d4a3d76db..75aa37f99f3 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result @@ -1,21 +1,8 @@ -STOP SLAVE; -STOP SLAVE; -STOP SLAVE; -STOP SLAVE; -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; -RESET MASTER; -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; -RESET MASTER; -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; -RESET MASTER; -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; -RESET MASTER; -RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_MYPORT,master_user='root'; -START SLAVE; -RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=SLAVE_MYPORT1,master_user='root'; -START SLAVE; +include/rpl_init.inc [topology=1->2,4->3] +include/rpl_connect.inc [creating master] +include/rpl_connect.inc [creating master1] +include/rpl_connect.inc [creating slave] +include/rpl_connect.inc [creating slave1] *** Check server_id of mysqld servers *** SHOW VARIABLES LIKE "server_id"; @@ -45,20 +32,20 @@ CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, *** Basic testing *** Insert rows via all hosts Check data on both clusters -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] *** Transaction testing *** BEGIN; BEGIN; COMMIT; COMMIT; Check data on both clusters -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] BEGIN; BEGIN; ROLLBACK; ROLLBACK; Check data on both clusters -Comparing tables master:test.t1 and slave:test.t1 -DROP TABLE t1; +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE IF EXISTS t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result index 99438d663bb..f3a4c132ee3 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a int key, b int) ENGINE=NDB; SHOW TABLES; Tables_in_test @@ -12,9 +8,9 @@ RESET MASTER; INSERT INTO t1 VALUES (1,2); INSERT INTO t1 VALUES (2,3); STOP SLAVE; -CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=SLAVE_PORT,MASTER_USER="root"; +include/rpl_change_topology.inc [new topology=1->2->1] START SLAVE; -Checking that both slave threads are running. +include/check_slave_is_running.inc SELECT * FROM t1 ORDER BY a; a b 1 2 @@ -25,5 +21,6 @@ SELECT * FROM t1 ORDER BY a; a b 1 2 2 3 -Checking that both slave threads are running. +include/check_slave_is_running.inc DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result index 3fc4ca26967..21546ed6524 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT) ENGINE=NDB; begin; insert into t1 values(1); @@ -11,3 +7,4 @@ flush tables with read lock; commit; unlock tables; drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result index a6e2144f532..aa67c678773 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] show variables like 'collation_server'; Variable_name Value collation_server ucs2_unicode_ci @@ -25,3 +21,4 @@ nid nom prenom 1 XYZ1 ABC1 ==== clean up ==== DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result index 6a0c863440e..6fda18ba207 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' @@ -70,3 +66,4 @@ drop datafile 'datafile02.dat' engine=ndb; DROP TABLESPACE ts1 ENGINE=NDB; DROP LOGFILE GROUP lg1 ENGINE=NDB; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result index c906f00bd40..acead977487 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] --- Doing pre test cleanup --- DROP TABLE IF EXISTS t1; CREATE LOGFILE GROUP lg1 @@ -788,3 +784,4 @@ drop datafile 'datafile02.dat' engine=ndb; DROP TABLESPACE ts1 ENGINE=NDB; DROP LOGFILE GROUP lg1 ENGINE=NDB; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result index e668b57293e..3ceb66f076a 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] -------- switch to master ------- SET AUTOCOMMIT = 1; @@ -1626,3 +1622,4 @@ use test; -------- switch to master ------- DROP DATABASE mysqltest1; DROP DATABASE mysqltest3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result index 1cecb030181..5f61e4d7803 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int, b int) engine=NDB; insert into t1 values(1,1); select * from t1; @@ -13,3 +9,4 @@ delete from t1; select * from t1; a b drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result index 316f5fc7e31..6171d10657f 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS replica; CREATE DATABASE replica; CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; @@ -56,3 +52,4 @@ Tables_in_test USE test; DROP TABLE t1, t2; DROP DATABASE IF EXISTS replica; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result index dda2844f6d0..6ac55944e33 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; @@ -24,3 +20,4 @@ ERROR 23000: Duplicate entry '3' for key 'PRIMARY' INSERT INTO t1 VALUES (3, repeat('bad too',1)); ERROR 23000: Duplicate entry '3' for key 'PRIMARY' DROP TABLE IF EXISTS t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result index 1a79affabe6..9ae340d713e 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** @@ -54,7 +50,8 @@ a b c 3 4 QA TESTING *** Start Slave *** START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.' STOP SLAVE; RESET SLAVE; SELECT * FROM t2 ORDER BY a; @@ -83,10 +80,8 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3' *** Drop t3 *** DROP TABLE t3; *** Create t4 on slave *** @@ -108,10 +103,8 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3' *** Drop t4 *** DROP TABLE t4; *** Create t5 on slave *** @@ -133,10 +126,8 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246' *** Drop t5 *** DROP TABLE t5; *** Create t6 on slave *** @@ -157,7 +148,8 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** -Last_SQL_Error = Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3' SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** DROP TABLE t6; @@ -231,10 +223,8 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5' *** Drop t10 *** DROP TABLE t10; *** Create t11 on slave *** @@ -255,10 +245,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252' *** Drop t11 *** DROP TABLE t11; *** Create t12 on slave *** @@ -468,10 +456,8 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5; ******************************************** *** Expect slave to fail with Error 1060 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1060] +Last_SQL_Error = 'Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'' *** Try to insert in master **** INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2); SELECT * FROM t15 ORDER BY c1; @@ -571,9 +557,8 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2' ** DROP table t17 *** DROP TABLE t17; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result index 7e750f2ce2a..3829d1468fd 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); DROP FUNCTION IF EXISTS test.f1; DROP TABLE IF EXISTS test.t1; @@ -28,3 +24,4 @@ ROLLBACK; SET AUTOCOMMIT=1; DROP FUNCTION test.f1; DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result index e2755c04f28..019b8bc4cf0 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ; INSERT INTO t1 VALUES ("row1","will go away",1); SELECT * FROM t1 ORDER BY c3; @@ -32,11 +28,12 @@ SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row3 C 3 row4 D 4 -Checking that both slave threads are running. +include/check_slave_is_running.inc STOP SLAVE; CHANGE MASTER TO master_log_file = 'master-bin.000001', master_log_pos = <the_pos> ; +include/check_slave_no_error.inc START SLAVE; SELECT * FROM t1 ORDER BY c3; c1 c2 c3 @@ -62,5 +59,6 @@ COMMIT; SELECT * FROM t1; c1 c2 c3 row2 new on slave 2 -Checking that both slave threads are running. +include/check_slave_is_running.inc DROP TABLE IF EXISTS t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb2ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb2ndb.result index 4c96ccf85ee..9fb019bf6e5 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb2ndb.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb2ndb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET storage_engine=innodb; --- Doing pre test cleanup --- DROP TABLE IF EXISTS t1; @@ -917,3 +913,4 @@ DELETE FROM t1; --- End test 5 key partition testing --- --- Do Cleanup --- DROP TABLE IF EXISTS t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result index 7c3f331958f..a01841af003 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int, unique(a)) engine=ndbcluster; create table t2 (a int, unique(a)) engine=innodb; begin; @@ -101,3 +97,4 @@ select count(*) from t2; count(*) 0 drop table t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result index 030845e89e2..195392ae0c5 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned, @@ -68,3 +64,4 @@ a b 5 5 6 6 drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result index 85ecb13bd66..a20e5d03595 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] include/stop_slave.inc reset master; reset slave; @@ -256,18 +252,13 @@ slave-bin.000002 # Table_map # # table_id: # (mysql.ndb_apply_status) slave-bin.000002 # Write_rows # # table_id: # slave-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000002 # Query # # COMMIT -Checking that both slave threads are running. +include/check_slave_is_running.inc show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; -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; +include/rpl_reset.inc create table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); set insert_id=5; @@ -289,3 +280,4 @@ a b 5 1 6 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result index 7caa88a16a1..d8b01dc1f5b 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE tmyisam (a int) ENGINE = MYISAM; CREATE TABLE tinnodb (a int) ENGINE = INNODB; CREATE TABLE tndb (a int) ENGINE = NDB; @@ -477,10 +473,11 @@ a 151 152 [on slave] -Comparing tables master:test.tmyisam and slave:test.tmyisam -Comparing tables master:test.tinnodb and slave:test.tinnodb -Comparing tables master:test.tndb and slave:test.tndb +include/diff_tables.inc [master:tmyisam, slave:tmyisam] +include/diff_tables.inc [master:tinnodb, slave:tinnodb] +include/diff_tables.inc [master:tndb, slave:tndb] ==== Clean up ==== [on master] DROP TABLE tmyisam, tinnodb, tndb; [on slave] +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result index 92fda774da5..3e88f846164 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result @@ -1,10 +1,6 @@ ==== Initialization ==== -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; +include/master-slave.inc +[connection master] ---- setup master ---- CREATE TABLE myisam_innodb (a INT) ENGINE=MYISAM; CREATE TABLE innodb_myisam (a INT) ENGINE=INNODB; @@ -274,13 +270,14 @@ a 34 57 58 -Comparing tables master:test.myisam_innodb and slave:test.myisam_innodb -Comparing tables master:test.innodb_myisam and slave:test.innodb_myisam -Comparing tables master:test.myisam_ndb and slave:test.myisam_ndb -Comparing tables master:test.ndb_myisam and slave:test.ndb_myisam -Comparing tables master:test.innodb_ndb and slave:test.innodb_ndb -Comparing tables master:test.ndb_innodb and slave:test.ndb_innodb +include/diff_tables.inc [master:myisam_innodb, slave:myisam_innodb] +include/diff_tables.inc [master:innodb_myisam, slave:innodb_myisam] +include/diff_tables.inc [master:myisam_ndb, slave:myisam_ndb] +include/diff_tables.inc [master:ndb_myisam, slave:ndb_myisam] +include/diff_tables.inc [master:innodb_ndb, slave:innodb_ndb] +include/diff_tables.inc [master:ndb_innodb, slave:ndb_innodb] ==== Clean up ==== drop table myisam_innodb, innodb_myisam; drop table myisam_ndb, ndb_myisam; drop table innodb_ndb, ndb_innodb; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result index 05524ae1ae3..97463efae94 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ; reset master; SHOW TABLES; @@ -27,11 +23,8 @@ SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ; @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) 106 master-bin.000001 -CHANGE MASTER TO -master_port=<MASTER_PORT1>, -master_log_file = 'MASTER_LOG_FILE', -master_log_pos = MASTER_LOG_POS ; -start slave; +include/rpl_change_topology.inc [new topology=3->2] +include/start_slave.inc INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); DELETE FROM t1 WHERE c3 = 1; UPDATE t1 SET c2="should go away" WHERE c3 = 2; @@ -54,4 +47,4 @@ row4 D 4 row5 E 5 ==== clean up ==== DROP TABLE t1; -STOP SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result index 5d00ae6598c..f3142678ff8 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1,t2; CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, @@ -53,3 +49,4 @@ select * from t1; a 3 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result index dc4e11c9c9e..d1cc10a930c 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] -------- Test for BUG#9361 -------- CREATE TABLE t1 ( @@ -195,3 +191,4 @@ idpro price nbprice 2 1.0000 2 3 2.0000 1 DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_myisam2ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_myisam2ndb.result index eb7d88c812b..d167a85bb8b 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_myisam2ndb.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_myisam2ndb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET storage_engine=myisam; --- Doing pre test cleanup --- DROP TABLE IF EXISTS t1; @@ -917,3 +913,4 @@ DELETE FROM t1; --- End test 5 key partition testing --- --- Do Cleanup --- DROP TABLE IF EXISTS t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result index 4e28a7e5865..801e1c0a9f2 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS replica; CREATE DATABASE replica; CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; @@ -52,3 +48,4 @@ Tables_in_test USE test; DROP TABLE t1, t2; DROP DATABASE IF EXISTS replica; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result index 7f75bdedd65..333e943d3ca 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (word CHAR(20) NOT NULL); LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; @@ -53,3 +49,4 @@ SELECT n FROM t1; n 3456 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_set_null.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_set_null.result index 473cd63169c..b37f55b36a4 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_set_null.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_set_null.result @@ -1,35 +1,22 @@ -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; -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; +include/master-slave.inc +[connection master] +include/rpl_reset.inc CREATE TABLE t1 (c1 BIT, c2 INT) Engine=NDB; INSERT INTO `t1` VALUES ( 1, 1 ); UPDATE t1 SET c1=NULL where c2=1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 WHERE c2=1 LIMIT 1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 CHAR) Engine=NDB; INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ; SELECT * FROM t1; c1 w UPDATE t1 SET c1=NULL WHERE c1='w'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 LIMIT 2; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp003.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp003.result index d7922c61b52..e28e438610f 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp003.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp003.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; @@ -47,3 +43,4 @@ a DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result index 047402f826f..2dd1754745b 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; DROP PROCEDURE IF EXISTS p1; @@ -42,3 +38,4 @@ DROP TABLE t1; DROP TABLE t2; DROP PROCEDURE p1; DROP PROCEDURE p2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result index 367738b21e5..f57becd18fe 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET binlog_format = STATEMENT; *** Test 1 *** @@ -123,12 +119,7 @@ master-bin.000002 # Xid 1 <end_pos> COMMIT /* XID */ ** Test 4 ** -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; +include/rpl_reset.inc select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; @@ -142,3 +133,4 @@ master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ *** DUMP MASTER & SLAVE FOR COMPARE ******** DROP DATABASE tpcb; ****** Do dumps compare ************ +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result index 49d068d5fe4..457933ae5f7 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] STOP SLAVE; CREATE DATABASE ndbsynctest; USE ndbsynctest; @@ -68,7 +64,7 @@ CHANGE MASTER TO master_log_file = 'master-bin.000001', master_log_pos = <the_pos> ; START SLAVE; -Checking that both slave threads are running. +include/check_slave_is_running.inc SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; hex(c1) hex(c2) c3 1 1 row1 @@ -89,3 +85,4 @@ Position File epoch inserts updates deletes schemaops reset slave; select * from mysql.ndb_apply_status; server_id epoch log_name start_pos end_pos +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result index ba5f0dea91c..c6d9e29183e 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TRIGGER test.t1_bi_t2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -28,3 +24,4 @@ n f DROP TRIGGER test.t1_bi_t2; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result index 04a75bf3479..12f171531b5 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'NDB' ; SELECT * FROM t1; C1 C2 @@ -422,11 +418,7 @@ a b c **** Test for BUG#31552 **** **** On Master **** DELETE FROM t1; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc **** On Master **** INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); **** On Master **** @@ -436,7 +428,7 @@ DELETE FROM t1; SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 set @@global.slave_exec_mode= default; -Checking that both slave threads are running. +include/check_slave_is_running.inc SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 **** Test for BUG#37076 **** @@ -478,50 +470,44 @@ j INT NOT NULL) ENGINE = 'NDB' ; [expecting slave to replicate correctly] INSERT INTO t1 VALUES (1, "", 1); INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] [expecting slave to replicate correctly] INSERT INTO t2 VALUES (1, "", 1); INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] [expecting slave to stop] INSERT INTO t3 VALUES (1, "", 1); INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t4 VALUES (1, "", 1); INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2); -Comparing tables master:test.t4 and slave:test.t4 +include/diff_tables.inc [master:t4, slave:t4] [expecting slave to stop] INSERT INTO t5 VALUES (1, "", 1); INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to stop] INSERT INTO t6 VALUES (1, "", 1); INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t7 VALUES (1, "", 1); INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2); -Comparing tables master:test.t7 and slave:test.t7 +include/diff_tables.inc [master:t7, slave:t7] drop table t1, t2, t3, t4, t5, t6, t7; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE='NDB' ; INSERT INTO t1 VALUES (1), (2), (3); UPDATE t1 SET a = 10; ERROR 23000: Duplicate entry '10' for key 'PRIMARY' INSERT INTO t1 VALUES (4); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( @@ -575,7 +561,7 @@ ERROR 23000: Duplicate entry '6' for key 'PRIMARY' DELETE FROM t2 WHERE `pk` < 7 LIMIT 1; UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6; *** results: t2 must be consistent **** -Comparing tables master:test.t2 and master:test.t2 +include/diff_tables.inc [master:t2, master:t2] DROP TABLE t1, t2; EOF OF TESTS CREATE TABLE t1 (a int) ENGINE='NDB' ; @@ -591,7 +577,7 @@ UPDATE t1 SET a = 9 WHERE a < 3; INSERT INTO t1 ( a ) VALUES ( 3 ); UPDATE t1 SET a = 0 WHERE a < 4; UPDATE t1 SET a = 8 WHERE a < 5; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; CREATE TABLE t1 (a bit) ENGINE='NDB' ; INSERT IGNORE INTO t1 VALUES (NULL); @@ -633,5 +619,6 @@ DELETE FROM t1 WHERE a < 3 LIMIT 0; UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2; INSERT INTO t1 ( a ) VALUES ( 1 ); UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result index 14d3baee1b0..dd84fea8258 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] **** On Master **** CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; INSERT INTO t1 VALUES (1,1), (2,2); @@ -87,3 +83,4 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE t1 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test index 3b075808481..8279d814deb 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test @@ -33,3 +33,4 @@ CREATE TABLE mysql.ndb_apply_status --connection slave drop table mysql.ndb_apply_status; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test index 560efec255b..265b2f412dc 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test @@ -32,3 +32,4 @@ CREATE TABLE mysql.ndb_apply_status --connection slave drop table mysql.ndb_apply_status; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test index e954c72fd1d..1d0ee48bd20 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test @@ -17,3 +17,4 @@ SET storage_engine=ndb; --echo connection slave; --source extra/rpl_tests/rpl_ndb_2multi_basic.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test index 41f91d62dec..df751214b40 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test @@ -48,3 +48,4 @@ SET storage_engine=innodb; connection slave; drop table mysql.ndb_apply_status; set @@global.slave_exec_mode= @old_slave_exec_mode; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test index ea623a06fd1..e2bcb143ab0 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test @@ -6,3 +6,4 @@ --source include/ndb_master-slave.inc let $engine_type=NDB; --source extra/rpl_tests/rpl_row_UUID.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test index cc74acc6490..92f71e294b2 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test @@ -24,3 +24,4 @@ select count(*) from mysql.ndb_apply_status; connection master; drop table t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test index 5e0584e332a..d2921424d6a 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test @@ -116,3 +116,4 @@ drop table t1; # End cleanup sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test index b90e6fff8bc..12bd8d533c5 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test @@ -179,3 +179,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/master_BANK.sql $MYSQLTEST_VARDIR/tmp/slave_BAN --dec $2 } +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test index c03738bc48b..1871c332c29 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test @@ -188,7 +188,6 @@ UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1; # Wait for deadlock to be detected. # When detected, the slave will stop, so we just wait for it to stop. connection slave; -source include/wait_for_slave_sql_to_stop.inc; # Replication should have stopped, since max retries were not enough. # verify with show slave status @@ -259,4 +258,4 @@ SELECT c1 FROM t1 ORDER BY c1 LIMIT 5; # cleanup --connection master DROP TABLE t1; --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test index 822f1f224cd..560cebe2a41 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test @@ -139,3 +139,4 @@ drop table t1; #let $VERSION=`select version()`; #--replace_result $VERSION VERSION #show binlog events; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test index e29f24998fe..ad4510d57c2 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test @@ -8,3 +8,4 @@ let $engine_type=NDBCLUSTER; -- source extra/rpl_tests/rpl_row_blob.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test index e63b7c5e8ff..233d4338256 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test @@ -1,15 +1,16 @@ --source include/have_ndb.inc ---source include/ndb_master-slave.inc # set up circular replication +--let $rpl_topology= 1->2->1 +--source include/rpl_init.inc ---connection slave -RESET MASTER; +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc ---connection master ---replace_result $SLAVE_MYPORT SLAVE_PORT ---eval CHANGE MASTER TO master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root" -START SLAVE; +--let $rpl_connection_name= slave +--let $rpl_server_number= 2 +--source include/rpl_connect.inc # create the table on the "slave" @@ -51,3 +52,6 @@ STOP SLAVE; --connection master DROP TABLE t1; -- sync_slave_with_master + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf index 64f69427643..b26c0a2c24f 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf @@ -12,13 +12,7 @@ skip-slave-start [mysqld.2.slave] server-id= 2 -master-host= 127.0.0.1 -master-port= @mysqld.2.1.port -master-password= @mysqld.2.1.#password -master-user= @mysqld.2.1.#user -master-connect-retry= 1 -init-rpl-role= slave -skip-slave-start +log-bin ndb_connectstring= @mysql_cluster.slave.ndb_connectstring [ENV] diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test index 8721e85780d..2d1f75f148d 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test @@ -75,9 +75,7 @@ let $wait_condition= SELECT COUNT(*)=40 FROM t1 WHERE c = 1; # Check data --echo Check data on both clusters -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; - +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; --echo *** Transaction testing *** @@ -116,9 +114,7 @@ let $wait_condition= SELECT COUNT(*)=400 FROM t1 WHERE c = 2; --source include/wait_condition.inc --echo Check data on both clusters -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; - +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; # Start transaction and then roll back @@ -155,18 +151,17 @@ let $wait_condition= SELECT COUNT(*)=200 FROM t1 WHERE c = 3; --source include/wait_condition.inc --echo Check data on both clusters -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; - +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; # Clean up --connection master -DROP TABLE t1; ---connection slave ---disable_warnings DROP TABLE IF EXISTS t1; ---enable_warnings +--connection slave +# Wait until table is dropped on slave. +--let $query= SELECT COUNT(*) FROM t1 +--source include/wait_for_query_to_fail.inc --echo # End of test 5.1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test index 8b0f869c1a3..19af5d54559 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test @@ -31,9 +31,9 @@ INSERT INTO t1 VALUES (2,3); # Replicate back to the master to test this mixed event on the master STOP SLAVE; +--let $rpl_topology= 1->2->1 +--source include/rpl_change_topology.inc connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=$SLAVE_MYPORT,MASTER_USER="root"; START SLAVE; @@ -76,3 +76,6 @@ source include/check_slave_is_running.inc; -- connection master DROP TABLE t1; -- sync_slave_with_master + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test index 8c45ac5dbdd..2353a2a8b5a 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test @@ -8,3 +8,4 @@ -- source include/ndb_master-slave.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_commit_after_flush.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test index 8d5ad334766..f2eec56e176 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test @@ -41,3 +41,4 @@ select * from t1 order by nid; connection master; DROP TABLE t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test index ac0ab01f8dd..dbe6929bbef 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test @@ -82,4 +82,4 @@ drop datafile 'datafile02.dat' engine=ndb; DROP TABLESPACE ts1 ENGINE=NDB; DROP LOGFILE GROUP lg1 ENGINE=NDB; --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test index c84854e89e8..373cc88fb00 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test @@ -308,3 +308,4 @@ DROP LOGFILE GROUP lg1 ENGINE=NDB; --sync_slave_with_master # End of 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test index 654d1c08944..5798bff163a 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test @@ -31,3 +31,4 @@ let $temp_engine_type= MEMORY; let $show_binlog = 0; let $manipulate = 0; -- source extra/rpl_tests/rpl_ddl.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test index 6b1d932f9a6..76484e5b5ae 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test @@ -6,3 +6,4 @@ -- source include/ndb_master-slave.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_delete_no_where.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test index ffe8551d00f..7b42d86a260 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test @@ -54,3 +54,4 @@ DROP DATABASE IF EXISTS replica; --sync_slave_with_master # End 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test index ee6abd580f5..9d5db57f988 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test @@ -43,3 +43,4 @@ INSERT INTO t1 VALUES (3, repeat('bad too',1)); connection master; DROP TABLE IF EXISTS t1, t2; --sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test index 9cf4f8dba0b..67101c11d26 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test @@ -11,3 +11,4 @@ let $engine_type = 'NDB'; -- source extra/rpl_tests/rpl_extraSlave_Col.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test index c02d82e2dc9..ca1f1d9463f 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test @@ -10,4 +10,4 @@ -- source include/ndb_master-slave.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_row_func003.test --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test index 99c9df40094..da22e0ae8f8 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test @@ -106,4 +106,4 @@ connection master; DROP TABLE IF EXISTS t1; # End of 5.1 Test --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test index 92374c26742..b9ad0f6375e 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test @@ -13,3 +13,4 @@ -- source include/ndb_master-slave.inc SET storage_engine=innodb; --source extra/rpl_tests/rpl_ndb_2multi_eng.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test index fcc2928c5e2..eaf34a0131d 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test @@ -64,3 +64,4 @@ connection master; drop table t1,t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test index e6c66011fb7..edbc3d17334 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test @@ -6,3 +6,4 @@ let $engine_type=NDB; let $engine_type2=myisam; -- source extra/rpl_tests/rpl_insert_ignore.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test index 75fe2688b4a..8411daa5e88 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test @@ -64,3 +64,4 @@ CREATE TABLE SERVER # --exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT --exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test index d32a05bf92a..7ce9d17a0c9 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test @@ -11,3 +11,4 @@ let $engine_type=NDB; -- source extra/rpl_tests/rpl_log.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test index 22ccabe3745..52fd19669bd 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test @@ -448,16 +448,13 @@ SELECT * FROM tndb ORDER BY a; --echo [on slave] --sync_slave_with_master -let $diff_table_1=master:test.tmyisam; -let $diff_table_2=slave:test.tmyisam; +let $diff_tables= master:tmyisam, slave:tmyisam; source include/diff_tables.inc; -let $diff_table_1=master:test.tinnodb; -let $diff_table_2=slave:test.tinnodb; +let $diff_tables= master:tinnodb, slave:tinnodb; source include/diff_tables.inc; -let $diff_table_1=master:test.tndb; -let $diff_table_2=slave:test.tndb; +let $diff_tables= master:tndb, slave:tndb; source include/diff_tables.inc; @@ -470,4 +467,4 @@ DROP TABLE tmyisam, tinnodb, tndb; --echo [on slave] sync_slave_with_master; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test index 7d7cd5770cf..d994393d75a 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test @@ -316,28 +316,22 @@ SELECT * FROM ndb_myisam ORDER BY a; SELECT * FROM innodb_ndb ORDER BY a; SELECT * FROM ndb_innodb ORDER BY a; -let $diff_table_1=master:test.myisam_innodb; -let $diff_table_2=slave:test.myisam_innodb; +let $diff_tables= master:myisam_innodb, slave:myisam_innodb; source include/diff_tables.inc; -let $diff_table_1=master:test.innodb_myisam; -let $diff_table_2=slave:test.innodb_myisam; +let $diff_tables= master:innodb_myisam, slave:innodb_myisam; source include/diff_tables.inc; -let $diff_table_1=master:test.myisam_ndb; -let $diff_table_2=slave:test.myisam_ndb; +let $diff_tables= master:myisam_ndb, slave:myisam_ndb; source include/diff_tables.inc; -let $diff_table_1=master:test.ndb_myisam; -let $diff_table_2=slave:test.ndb_myisam; +let $diff_tables= master:ndb_myisam, slave:ndb_myisam; source include/diff_tables.inc; -let $diff_table_1=master:test.innodb_ndb; -let $diff_table_2=slave:test.innodb_ndb; +let $diff_tables= master:innodb_ndb, slave:innodb_ndb; source include/diff_tables.inc; -let $diff_table_1=master:test.ndb_innodb; -let $diff_table_2=slave:test.ndb_innodb; +let $diff_tables= master:ndb_innodb, slave:ndb_innodb; source include/diff_tables.inc; @@ -347,3 +341,4 @@ drop table myisam_innodb, innodb_myisam; drop table myisam_ndb, ndb_myisam; drop table innodb_ndb, ndb_innodb; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test index e9107fd90bd..65093319fbe 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test @@ -1,6 +1,11 @@ --source include/have_multi_ndb.inc --source include/have_binlog_format_mixed_or_row.inc ---source include/ndb_master-slave.inc + +# We need server 3 later on in this test. +--let $rpl_server_count= 3 +--source include/master-slave.inc + +--connection master # note: server2 is another "master" connected to the master cluster @@ -38,13 +43,12 @@ let $the_pos= `SELECT @the_pos` ; let $the_file= `SELECT @the_file` ; # now connect the slave to the _other_ "master" -connection slave; ---replace_result $MASTER_MYPORT1 <MASTER_PORT1> $the_pos MASTER_LOG_POS $the_file MASTER_LOG_FILE -eval CHANGE MASTER TO - master_port=$MASTER_MYPORT1, - master_log_file = '$the_file', - master_log_pos = $the_pos ; -start slave; +--let $rpl_topology= 3->2 +--let $rpl_master_log_file= 2:$the_file +--let $rpl_master_log_pos= 2:$the_pos +--source include/rpl_change_topology.inc +--connection slave +--source include/start_slave.inc # insert some more values on the first master connection master; @@ -61,7 +65,6 @@ connection server2; INSERT INTO t1 VALUES ("row5","E",5); SELECT * FROM t1 ORDER BY c3; sync_slave_with_master; -connection slave; SELECT * FROM t1 ORDER BY c3; --echo ==== clean up ==== @@ -69,4 +72,4 @@ connection server2; DROP TABLE t1; sync_slave_with_master; -STOP SLAVE; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test index 6b86f8146f8..40ec8d2b6c5 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test @@ -11,3 +11,4 @@ let $engine_type=NDB; --source extra/rpl_tests/rpl_multi_update2.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test index f144965e9b0..fc618becd3c 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test @@ -6,3 +6,4 @@ -- source include/ndb_master-slave.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_multi_update3.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test index a9e56d17139..33a4b029914 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test @@ -12,3 +12,4 @@ -- source include/ndb_master-slave.inc SET storage_engine=myisam; --source extra/rpl_tests/rpl_ndb_2multi_eng.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test index b0b9dd9e7da..83cc64993b0 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test @@ -7,3 +7,4 @@ -- source include/ndb_master-slave.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_relayrotate.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test index 1f305d20c92..a88ac18f711 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test @@ -55,3 +55,4 @@ DROP DATABASE IF EXISTS replica; --sync_slave_with_master # End 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test index f5b05080131..083b1e59242 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test @@ -5,3 +5,4 @@ -- source include/ndb_master-slave.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_row_001.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_set_null.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_set_null.test index 454807d9591..41641ec793b 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_set_null.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_set_null.test @@ -4,3 +4,4 @@ -- let $engine= NDB -- source extra/rpl_tests/rpl_set_null.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test index 6453f45aa75..cff9bb7837a 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test @@ -8,3 +8,4 @@ -- source include/ndb_master-slave.inc let $engine_type=NDBCLUSTER; -- source extra/rpl_tests/rpl_row_sp003.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test index c2c7be6112c..5ad34c6a573 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test @@ -8,3 +8,4 @@ -- source include/ndb_master-slave.inc let $engine_type=NDBCLUSTER; -- source extra/rpl_tests/rpl_row_sp006.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test index 7c65e04717a..60d7d6b3d10 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test @@ -35,3 +35,4 @@ SET binlog_format = STATEMENT; let $off_set = 6; let $rpl_format = 'SBR'; --source extra/rpl_tests/rpl_ndb_apply_status.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test index b91ff198c51..f3722a1c8a4 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test @@ -98,3 +98,5 @@ reset slave; select * from mysql.ndb_apply_status; # End 5.1 Test +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test index 7f7e08685bf..a283aa60504 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test @@ -12,3 +12,4 @@ let $engine_type=NDB; -- source extra/rpl_tests/rpl_trig004.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test index 543393b980d..fdb0293676b 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test @@ -9,3 +9,4 @@ --exec echo Running mgmapi_logevent --exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" "$NDB_CONNECTSTRING_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test index 3a17de1bc9e..ac31e4de654 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test @@ -5,4 +5,4 @@ let $type= 'NDB' ; let $extra_index= ; -- source extra/rpl_tests/rpl_row_basic.test --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test index 898bf310dc5..a539720d6e7 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test @@ -63,4 +63,4 @@ connection master; DROP TABLE t1; source include/show_binlog_events.inc; --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test index 549227db61a..7c9684d5cbb 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test @@ -9,3 +9,4 @@ --source include/have_binlog_format_mixed.inc --source include/big_test.inc --source suite/rpl_ndb/t/rpl_truncate_7ndb.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/sphinx/suite.pm b/mysql-test/suite/sphinx/suite.pm index 199e59e26d7..e708b12faea 100644 --- a/mysql-test/suite/sphinx/suite.pm +++ b/mysql-test/suite/sphinx/suite.pm @@ -29,8 +29,17 @@ return "No SphinxSE" unless $ENV{HA_SPHINX_SO} or { local $_ = `"$exe_sphinx_searchd" --help`; + mtr_verbose("tool: $exe_sphinx_searchd\n$_"); my $ver = sprintf "%04d.%04d.%04d", (/([0-9]+)\.([0-9]+)\.([0-9]+)/); - return "Sphinx 0.9.9 or later is needed" unless $ver ge '0000.0009.0009'; + if ($ver eq "0000.0000.0000") + { + $ver = sprintf "%04d.%04d", (/([0-9]+)\.([0-9]+)-(alpha|beta|gamma|RC)/); + return "Sphinx 0.9.9 or later is needed" unless $ver ge '0001.0010'; + } + else + { + return "Sphinx 0.9.9 or later is needed" unless $ver ge '0000.0009.0009'; + } } ############# action methods ###################### diff --git a/mysql-test/suite/sys_vars/README b/mysql-test/suite/sys_vars/README deleted file mode 100644 index a84f00f1f62..00000000000 --- a/mysql-test/suite/sys_vars/README +++ /dev/null @@ -1,3 +0,0 @@ -Some of these tests allocate more than 4GB RAM. -So, assure that the machine on which the suite will be executed has more than 4GB RAM. - diff --git a/mysql-test/suite/sys_vars/inc/timestamp_basic.inc b/mysql-test/suite/sys_vars/inc/timestamp_basic.inc index 9ef57c97043..68ded3e5a97 100644 --- a/mysql-test/suite/sys_vars/inc/timestamp_basic.inc +++ b/mysql-test/suite/sys_vars/inc/timestamp_basic.inc @@ -66,10 +66,6 @@ SET @@timestamp = 0; --echo 'Setting 0 resets timestamp to session default timestamp' -SET @@timestamp = 123456789123456; -SELECT @@timestamp; -SET @@timestamp = 60*60*60*60*365; -SELECT @@timestamp; SET @@timestamp = -1000000000; SELECT @@timestamp; diff --git a/mysql-test/suite/sys_vars/r/general_log_file_basic.result b/mysql-test/suite/sys_vars/r/general_log_file_basic.result index 48a8d90b55e..5c0b93cf4ab 100644 --- a/mysql-test/suite/sys_vars/r/general_log_file_basic.result +++ b/mysql-test/suite/sys_vars/r/general_log_file_basic.result @@ -1,7 +1,6 @@ -SET @start_value = @@global.general_log_file; SELECT @start_value; @start_value -test.log +NULL '#---------------------FN_DYNVARS_004_01-------------------------#' SET @@global.general_log_file = DEFAULT; SELECT RIGHT(@@global.general_log_file,10) AS log_file; @@ -17,4 +16,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='general_log_file'; @@global.general_log_file = VARIABLE_VALUE 1 -SET @@global.general_log_file= @start_value; +SET @@global.general_log_file= 'test.log'; diff --git a/mysql-test/suite/sys_vars/r/general_log_func.result b/mysql-test/suite/sys_vars/r/general_log_func.result index 39ba90265d5..119991396e0 100644 --- a/mysql-test/suite/sys_vars/r/general_log_func.result +++ b/mysql-test/suite/sys_vars/r/general_log_func.result @@ -26,6 +26,7 @@ SELECT @@general_log; INSERT into t1(name) values('Record_3'); INSERT into t1(name) values('Record_4'); ## There should be a difference ## +SET @start_value= @@global.max_allowed_packet; SET @@global.max_allowed_packet= 1024*1024*1024; SET @orig_file= load_file('MYSQLD_LOGFILE.orig'); SET @copy_file= load_file('MYSQLD_LOGFILE.copy'); @@ -34,3 +35,4 @@ STRCMP(@orig_file, @copy_file) 1 ## Dropping tables ## DROP TABLE t1; +SET @@global.max_allowed_packet= @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_commit_concurrency_basic.result b/mysql-test/suite/sys_vars/r/innodb_commit_concurrency_basic.result index 301016d4362..201f183ad0e 100644 --- a/mysql-test/suite/sys_vars/r/innodb_commit_concurrency_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_commit_concurrency_basic.result @@ -1,30 +1,23 @@ SET @global_start_value = @@global.innodb_commit_concurrency; SELECT @global_start_value; @global_start_value -0 +10 '#--------------------FN_DYNVARS_046_01------------------------#' -SET @@global.innodb_commit_concurrency = 0; SET @@global.innodb_commit_concurrency = DEFAULT; SELECT @@global.innodb_commit_concurrency; @@global.innodb_commit_concurrency -0 +10 '#---------------------FN_DYNVARS_046_02-------------------------#' SET innodb_commit_concurrency = 1; ERROR HY000: Variable 'innodb_commit_concurrency' is a GLOBAL variable and should be set with SET GLOBAL SELECT @@innodb_commit_concurrency; @@innodb_commit_concurrency -0 +10 SELECT local.innodb_commit_concurrency; ERROR 42S02: Unknown table 'local' in field list SET global innodb_commit_concurrency = 0; -SELECT @@global.innodb_commit_concurrency; -@@global.innodb_commit_concurrency -0 +ERROR HY000: Incorrect arguments to SET '#--------------------FN_DYNVARS_046_03------------------------#' -SET @@global.innodb_commit_concurrency = 0; -SELECT @@global.innodb_commit_concurrency; -@@global.innodb_commit_concurrency -0 SET @@global.innodb_commit_concurrency = 1; SELECT @@global.innodb_commit_concurrency; @@global.innodb_commit_concurrency @@ -35,27 +28,17 @@ SELECT @@global.innodb_commit_concurrency; 1000 '#--------------------FN_DYNVARS_046_04-------------------------#' SET @@global.innodb_commit_concurrency = -1; -Warnings: -Warning 1292 Truncated incorrect commit_concurrency value: '18446744073709551615' -SELECT @@global.innodb_commit_concurrency; -@@global.innodb_commit_concurrency -1000 +SELECT @@global.innodb_commit_concurrency IN (4294967295,18446744073709551615); +@@global.innodb_commit_concurrency IN (4294967295,18446744073709551615) +1 SET @@global.innodb_commit_concurrency = "T"; ERROR 42000: Incorrect argument type to variable 'innodb_commit_concurrency' -SELECT @@global.innodb_commit_concurrency; -@@global.innodb_commit_concurrency -1000 SET @@global.innodb_commit_concurrency = "Y"; ERROR 42000: Incorrect argument type to variable 'innodb_commit_concurrency' -SELECT @@global.innodb_commit_concurrency; -@@global.innodb_commit_concurrency -1000 SET @@global.innodb_commit_concurrency = 1001; -Warnings: -Warning 1292 Truncated incorrect commit_concurrency value: '1001' SELECT @@global.innodb_commit_concurrency; @@global.innodb_commit_concurrency -1000 +1001 '#----------------------FN_DYNVARS_046_05------------------------#' SELECT @@global.innodb_commit_concurrency = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -65,32 +48,33 @@ VARIABLE_VALUE 1 SELECT @@global.innodb_commit_concurrency; @@global.innodb_commit_concurrency -1000 +1001 SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_commit_concurrency'; VARIABLE_VALUE -1000 +1001 '#---------------------FN_DYNVARS_046_06-------------------------#' SET @@global.innodb_commit_concurrency = OFF; ERROR 42000: Incorrect argument type to variable 'innodb_commit_concurrency' SELECT @@global.innodb_commit_concurrency; @@global.innodb_commit_concurrency -1000 +1001 SET @@global.innodb_commit_concurrency = ON; ERROR 42000: Incorrect argument type to variable 'innodb_commit_concurrency' SELECT @@global.innodb_commit_concurrency; @@global.innodb_commit_concurrency -1000 +1001 '#---------------------FN_DYNVARS_046_07----------------------#' SET @@global.innodb_commit_concurrency = TRUE; SELECT @@global.innodb_commit_concurrency; @@global.innodb_commit_concurrency 1 SET @@global.innodb_commit_concurrency = FALSE; +ERROR HY000: Incorrect arguments to SET SELECT @@global.innodb_commit_concurrency; @@global.innodb_commit_concurrency -0 +1 SET @@global.innodb_commit_concurrency = @global_start_value; SELECT @@global.innodb_commit_concurrency; @@global.innodb_commit_concurrency -0 +10 diff --git a/mysql-test/suite/sys_vars/r/log_output_basic.result b/mysql-test/suite/sys_vars/r/log_output_basic.result index 481d5862074..6f350556ff9 100644 --- a/mysql-test/suite/sys_vars/r/log_output_basic.result +++ b/mysql-test/suite/sys_vars/r/log_output_basic.result @@ -1,7 +1,7 @@ SET @start_value = @@global.log_output; SELECT @start_value; @start_value -FILE,TABLE +FILE '#--------------------FN_DYNVARS_065_01------------------------#' SET @@global.log_output = FILE; SET @@global.log_output = DEFAULT; @@ -172,4 +172,4 @@ TABLE SET @@global.log_output = @start_value; SELECT @@global.log_output; @@global.log_output -FILE,TABLE +FILE diff --git a/mysql-test/suite/sys_vars/r/log_output_func.result b/mysql-test/suite/sys_vars/r/log_output_func.result index 060f930a161..00a8e824f78 100644 --- a/mysql-test/suite/sys_vars/r/log_output_func.result +++ b/mysql-test/suite/sys_vars/r/log_output_func.result @@ -1,6 +1,5 @@ SET @start_value= @@global.log_output; SET @start_general_log= @@global.general_log; -SET @start_general_log_file= @@global.general_log_file; '#--------------------FN_DYNVARS_065_01-------------------------#' SET @@global.log_output = 'NONE'; 'connect (con1,localhost,root,,,,)' @@ -53,7 +52,7 @@ count(*) DROP TABLE t1; connection default; SET @@global.general_log= 'OFF'; -SET @@global.general_log_file= @start_general_log_file; +SET @@global.general_log_file= '/home/horst/bzr/5.1-52501/mysql-test/var/mysqld.1/mysqld.log'; SET @@global.log_output= @start_value; SET @@global.general_log= @start_general_log; SET @@global.general_log= 'ON'; diff --git a/mysql-test/suite/sys_vars/r/secure_file_priv2.result b/mysql-test/suite/sys_vars/r/secure_file_priv2.result new file mode 100644 index 00000000000..ec91b6037d0 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/secure_file_priv2.result @@ -0,0 +1,6 @@ +CREATE TABLE t1 (c1 INT); +LOAD DATA INFILE "t1.MYI" into table t1; +ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement +LOAD DATA INFILE "/test" into table t1; +ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result index 925f940a5c4..3cd62187d0b 100644 --- a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result @@ -1,4 +1,4 @@ -SET @start_value = @@global.slow_query_log_file; +slowtest.log '#---------------------FN_DYNVARS_004_01-------------------------#' SET @@global.slow_query_log_file = DEFAULT; SELECT RIGHT(@@global.slow_query_log_file,15); @@ -14,4 +14,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slow_query_log_file'; @@global.slow_query_log_file = VARIABLE_VALUE 1 -SET @@global.slow_query_log_file= @start_value; +SET @@global.slow_query_log_file= 'slowtest.log'; diff --git a/mysql-test/suite/sys_vars/r/timestamp_basic_32.result b/mysql-test/suite/sys_vars/r/timestamp_basic_32.result index a8be2201e68..87c9edc668e 100644 --- a/mysql-test/suite/sys_vars/r/timestamp_basic_32.result +++ b/mysql-test/suite/sys_vars/r/timestamp_basic_32.result @@ -8,14 +8,6 @@ ERROR HY000: Variable 'timestamp' is a SESSION variable and can't be used with S '#--------------------FN_DYNVARS_001_03------------------------#' SET @@timestamp = 0; 'Setting 0 resets timestamp to session default timestamp' -SET @@timestamp = 123456789123456; -SELECT @@timestamp; -@@timestamp -2249167232 -SET @@timestamp = 60*60*60*60*365; -SELECT @@timestamp; -@@timestamp -435432704 SET @@timestamp = -1000000000; SELECT @@timestamp; @@timestamp @@ -66,3 +58,7 @@ ERROR 42S02: Unknown table 'session' in field list SELECT timestamp = @@session.timestamp; ERROR 42S22: Unknown column 'timestamp' in 'field list' SET @@timestamp = @session_start_value; +SET @@timestamp = 123456789123456; +ERROR HY000: This version of MySQL doesn't support dates later than 2038 +SET @@timestamp = 60*60*60*60*365; +ERROR HY000: This version of MySQL doesn't support dates later than 2038 diff --git a/mysql-test/suite/sys_vars/r/timestamp_basic_64.result b/mysql-test/suite/sys_vars/r/timestamp_basic_64.result index 824a3ea5529..b5d3979610f 100644 --- a/mysql-test/suite/sys_vars/r/timestamp_basic_64.result +++ b/mysql-test/suite/sys_vars/r/timestamp_basic_64.result @@ -8,14 +8,6 @@ ERROR HY000: Variable 'timestamp' is a SESSION variable and can't be used with S '#--------------------FN_DYNVARS_001_03------------------------#' SET @@timestamp = 0; 'Setting 0 resets timestamp to session default timestamp' -SET @@timestamp = 123456789123456; -SELECT @@timestamp; -@@timestamp -123456789123456 -SET @@timestamp = 60*60*60*60*365; -SELECT @@timestamp; -@@timestamp -4730400000 SET @@timestamp = -1000000000; SELECT @@timestamp; @@timestamp @@ -66,3 +58,11 @@ ERROR 42S02: Unknown table 'session' in field list SELECT timestamp = @@session.timestamp; ERROR 42S22: Unknown column 'timestamp' in 'field list' SET @@timestamp = @session_start_value; +SET @@timestamp = 123456789123456; +SELECT @@timestamp; +@@timestamp +123456789123456 +SET @@timestamp = 60*60*60*60*365; +SELECT @@timestamp; +@@timestamp +4730400000 diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result index 2ebeb8d61d8..06b624ad5c8 100644 --- a/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result +++ b/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result @@ -100,8 +100,6 @@ SELECT @@session.tmp_table_size; SET @@session.tmp_table_size = "Test"; ERROR 42000: Incorrect argument type to variable 'tmp_table_size' SET @@session.tmp_table_size = 12345678901; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '12345678901' SELECT @@session.tmp_table_size IN (12345678901,4294967295); @@session.tmp_table_size IN (12345678901,4294967295) 1 diff --git a/mysql-test/suite/sys_vars/t/completion_type_func.test b/mysql-test/suite/sys_vars/t/completion_type_func.test index 8e363ed2a7d..82e2dc47e54 100644 --- a/mysql-test/suite/sys_vars/t/completion_type_func.test +++ b/mysql-test/suite/sys_vars/t/completion_type_func.test @@ -18,7 +18,7 @@ # server-system-variables.html#option_mysqld_completion_type # # # ################################################################################ - +--source include/not_embedded.inc --source include/have_innodb.inc --disable_warnings diff --git a/mysql-test/suite/sys_vars/t/disabled.def b/mysql-test/suite/sys_vars/t/disabled.def new file mode 100644 index 00000000000..915ea7a6f5c --- /dev/null +++ b/mysql-test/suite/sys_vars/t/disabled.def @@ -0,0 +1,13 @@ +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment> +# +# Do not use any TAB characters for whitespace. +# +############################################################################## +sys_vars.max_binlog_cache_size_basic_64 : bug#56408 2010-08-31 Horst +sys_vars.max_binlog_cache_size_basic_32 : bug#56408 2010-08-31 Horst diff --git a/mysql-test/suite/sys_vars/t/general_log_file_basic.test b/mysql-test/suite/sys_vars/t/general_log_file_basic.test index 014108f88d2..35905bad987 100644 --- a/mysql-test/suite/sys_vars/t/general_log_file_basic.test +++ b/mysql-test/suite/sys_vars/t/general_log_file_basic.test @@ -35,7 +35,8 @@ # Saving initial value of general_log_file in a temporary variable # ######################################################################## -SET @start_value = @@global.general_log_file; +#SET @start_value = @@global.general_log_file; +LET $start_value = `SELECT @@global.general_log_file`; SELECT @start_value; @@ -68,7 +69,8 @@ SELECT @@global.general_log_file = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='general_log_file'; -SET @@global.general_log_file= @start_value; +#SET @@global.general_log_file= @start_value; +eval SET @@global.general_log_file= '$start_value'; ##################################################### # END OF general_log_file TESTS # diff --git a/mysql-test/suite/sys_vars/t/general_log_func.test b/mysql-test/suite/sys_vars/t/general_log_func.test index 24d535e88e5..d355d0d619c 100644 --- a/mysql-test/suite/sys_vars/t/general_log_func.test +++ b/mysql-test/suite/sys_vars/t/general_log_func.test @@ -79,6 +79,7 @@ INSERT into t1(name) values('Record_4'); --chmod 0777 $MYSQLD_LOGFILE.orig --echo ## There should be a difference ## +SET @start_value= @@global.max_allowed_packet; SET @@global.max_allowed_packet= 1024*1024*1024; --replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE eval SET @orig_file= load_file('$MYSQLD_LOGFILE.orig'); @@ -91,3 +92,4 @@ eval SELECT STRCMP(@orig_file, @copy_file); --echo ## Dropping tables ## DROP TABLE t1; +SET @@global.max_allowed_packet= @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic-master.opt b/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic-master.opt new file mode 100644 index 00000000000..727bbc4b11b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic-master.opt @@ -0,0 +1 @@ +--innodb-commit-concurrency=10 diff --git a/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic.test b/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic.test index 1ef69e34999..2c7645f3b25 100644 --- a/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic.test @@ -11,6 +11,10 @@ # Creation Date: 2008-02-07 # # Author: Rizwan # # # +# Modified 2010-09-01 Horst # +# Added amaster.opt with innodb-commit-concurrency > 0 to be able to assign # +# different values <> 0 # +# # #Description:Test Cases of Dynamic System Variable innodb_commit_concurrency # # that checks the behavior of this variable in the following ways # # * Default Value # @@ -43,7 +47,6 @@ SELECT @global_start_value; # Display the DEFAULT value of innodb_commit_concurrency # ######################################################################## -SET @@global.innodb_commit_concurrency = 0; SET @@global.innodb_commit_concurrency = DEFAULT; SELECT @@global.innodb_commit_concurrency; @@ -60,20 +63,14 @@ SELECT @@innodb_commit_concurrency; --Error ER_UNKNOWN_TABLE SELECT local.innodb_commit_concurrency; +--error ER_WRONG_ARGUMENTS SET global innodb_commit_concurrency = 0; -SELECT @@global.innodb_commit_concurrency; - - --echo '#--------------------FN_DYNVARS_046_03------------------------#' ########################################################################## # change the value of innodb_commit_concurrency to a valid value # ########################################################################## - -SET @@global.innodb_commit_concurrency = 0; -SELECT @@global.innodb_commit_concurrency; - SET @@global.innodb_commit_concurrency = 1; SELECT @@global.innodb_commit_concurrency; SET @@global.innodb_commit_concurrency = 1000; @@ -85,15 +82,13 @@ SELECT @@global.innodb_commit_concurrency; ########################################################################### SET @@global.innodb_commit_concurrency = -1; -SELECT @@global.innodb_commit_concurrency; +SELECT @@global.innodb_commit_concurrency IN (4294967295,18446744073709551615); --Error ER_WRONG_TYPE_FOR_VAR SET @@global.innodb_commit_concurrency = "T"; -SELECT @@global.innodb_commit_concurrency; --Error ER_WRONG_TYPE_FOR_VAR SET @@global.innodb_commit_concurrency = "Y"; -SELECT @@global.innodb_commit_concurrency; SET @@global.innodb_commit_concurrency = 1001; SELECT @@global.innodb_commit_concurrency; @@ -131,6 +126,7 @@ SELECT @@global.innodb_commit_concurrency; SET @@global.innodb_commit_concurrency = TRUE; SELECT @@global.innodb_commit_concurrency; +--error ER_WRONG_ARGUMENTS SET @@global.innodb_commit_concurrency = FALSE; SELECT @@global.innodb_commit_concurrency; diff --git a/mysql-test/suite/sys_vars/t/log_output_func.test b/mysql-test/suite/sys_vars/t/log_output_func.test index 007c4f38659..8a2fbe0728b 100644 --- a/mysql-test/suite/sys_vars/t/log_output_func.test +++ b/mysql-test/suite/sys_vars/t/log_output_func.test @@ -26,7 +26,8 @@ SET @start_value= @@global.log_output; SET @start_general_log= @@global.general_log; -SET @start_general_log_file= @@global.general_log_file; +#SET @start_general_log_file= @@global.general_log_file; +LET $start_general_log_file= `SELECT @@global.general_log_file`; --echo '#--------------------FN_DYNVARS_065_01-------------------------#' ################################################################## @@ -113,7 +114,8 @@ file_exists $MYSQLTEST_VARDIR/run/mytest.log ; --echo connection default; connection default; SET @@global.general_log= 'OFF'; -SET @@global.general_log_file= @start_general_log_file; +#SET @@global.general_log_file= @start_general_log_file; +eval SET @@global.general_log_file= '$start_general_log_file'; SET @@global.log_output= @start_value; SET @@global.general_log= @start_general_log; SET @@global.general_log= 'ON'; diff --git a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func-master.opt b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func-master.opt new file mode 100644 index 00000000000..d392e2e4262 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func-master.opt @@ -0,0 +1 @@ +--log-error='dummy.log' diff --git a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test index 37dd3a5a297..441e9c72982 100644 --- a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test +++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test @@ -19,6 +19,9 @@ # # ################################################################################ +# due to bug#56486 +--source include/not_windows.inc + --echo '#--------------------FN_DYNVARS_093_01-------------------------#' ############################################################################### # Check if setting myisam_data_pointer_size is changed in every new connection# diff --git a/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test index f2c66eb3a0a..d4607dc6bf1 100644 --- a/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test +++ b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test @@ -55,7 +55,7 @@ DROP TABLE t1; eval SELECT @@global.init_slave = $my_init_slave; --echo Expect 1 # wait for the slave threads have set the global variable. -let $wait_timeout= 90; +let $wait_timeout= 240; let $wait_condition= SELECT @@global.max_connections = @start_max_connections; --source include/wait_condition_sp.inc # check that the action in init_slave does not happen immediately @@ -100,3 +100,4 @@ SET @@global.init_slave= @start_init_slave; # End of functionality Testing for init_slave # ################################################## +--source include/rpl_end.inc diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt b/mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt new file mode 100644 index 00000000000..1d9a49c8f75 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt @@ -0,0 +1 @@ +--secure_file_priv=$SECURE_LOAD_PATH diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv2.test b/mysql-test/suite/sys_vars/t/secure_file_priv2.test new file mode 100644 index 00000000000..0ca0a1839e1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/secure_file_priv2.test @@ -0,0 +1,23 @@ +# +# Bug58747 breaks secure_file_priv+not secure yet+still accesses other folders +# +CREATE TABLE t1 (c1 INT); +# +# Before the patch this statement failed with +# Linux: +# -> errno 13: 'Can't get stat of ' +# Windows: +# -> Warning 1366 Incorrect integer value: '■■☺' for +# -> column 'c1' at row 1 +# Now it should consistently fail with ER_OPTION_PREVENTS_STATEMENT +# on all platforms. +--error ER_OPTION_PREVENTS_STATEMENT +LOAD DATA INFILE "t1.MYI" into table t1; + +# +# The following test makes the assuption that /test isn't a valid path in any +# operating system running the test suite. +--error ER_OPTION_PREVENTS_STATEMENT +LOAD DATA INFILE "/test" into table t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test index 9125b686cad..810588b8f4e 100644 --- a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test @@ -35,7 +35,9 @@ # Saving initial value of slow_query_log_file in a temporary variable # ########################################################################### -SET @start_value = @@global.slow_query_log_file; +#SET @start_value = @@global.slow_query_log_file; +LET $start_value = `SELECT @@global.slow_query_log_file`; +--echo $start_value --echo '#---------------------FN_DYNVARS_004_01-------------------------#' ############################################### @@ -65,7 +67,9 @@ SELECT @@global.slow_query_log_file = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slow_query_log_file'; -SET @@global.slow_query_log_file= @start_value; +#SET @@global.slow_query_log_file= @start_value; +eval SET @@global.slow_query_log_file= '$start_value'; +#SELECT @start_value; ##################################################### # END OF slow_query_log_file TESTS # ##################################################### diff --git a/mysql-test/suite/sys_vars/t/sql_log_off_func-master.opt b/mysql-test/suite/sys_vars/t/sql_log_off_func-master.opt new file mode 100644 index 00000000000..875ecc54b55 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_log_off_func-master.opt @@ -0,0 +1 @@ +--general-log --log-output=TABLE,FILE diff --git a/mysql-test/suite/sys_vars/t/timestamp_basic_32.test b/mysql-test/suite/sys_vars/t/timestamp_basic_32.test index a2b6139aef9..11b7535d9ef 100644 --- a/mysql-test/suite/sys_vars/t/timestamp_basic_32.test +++ b/mysql-test/suite/sys_vars/t/timestamp_basic_32.test @@ -7,3 +7,7 @@ --source include/have_32bit.inc --source suite/sys_vars/inc/timestamp_basic.inc +--error ER_UNKNOWN_ERROR +SET @@timestamp = 123456789123456; +--error ER_UNKNOWN_ERROR +SET @@timestamp = 60*60*60*60*365; diff --git a/mysql-test/suite/sys_vars/t/timestamp_basic_64.test b/mysql-test/suite/sys_vars/t/timestamp_basic_64.test index fbc86316ed9..5180c86392a 100644 --- a/mysql-test/suite/sys_vars/t/timestamp_basic_64.test +++ b/mysql-test/suite/sys_vars/t/timestamp_basic_64.test @@ -7,3 +7,8 @@ --source include/have_64bit.inc --source suite/sys_vars/inc/timestamp_basic.inc +SET @@timestamp = 123456789123456; +SELECT @@timestamp; +SET @@timestamp = 60*60*60*60*365; +SELECT @@timestamp; + diff --git a/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test b/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test index c2ff51d50ca..116196ddb07 100644 --- a/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test +++ b/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test @@ -133,8 +133,9 @@ SELECT @@session.tmp_table_size; --Error ER_WRONG_TYPE_FOR_VAR SET @@session.tmp_table_size = "Test"; +--disable_warnings SET @@session.tmp_table_size = 12345678901; - +--enable_warnings # With a 64 bit mysqld:12345678901,with a 32 bit mysqld: 4294967295 SELECT @@session.tmp_table_size IN (12345678901,4294967295); diff --git a/mysql-test/suite/vcol/r/rpl_vcol.result b/mysql-test/suite/vcol/r/rpl_vcol.result index f552d16d1c0..120ce38031f 100644 --- a/mysql-test/suite/vcol/r/rpl_vcol.result +++ b/mysql-test/suite/vcol/r/rpl_vcol.result @@ -1,10 +1,6 @@ SET @@session.storage_engine = 'InnoDB'; -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; +include/master-slave.inc +[connection master] create table t1 (a int, b int as (a+1)); show create table t1; Table Create Table @@ -23,3 +19,4 @@ a b 1 2 2 3 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/vcol/t/rpl_vcol.test b/mysql-test/suite/vcol/t/rpl_vcol.test index df07b3aed2d..43003f80ee9 100644 --- a/mysql-test/suite/vcol/t/rpl_vcol.test +++ b/mysql-test/suite/vcol/t/rpl_vcol.test @@ -67,3 +67,4 @@ sync_with_master; #------------------------------------------------------------------------------# # Cleanup --source suite/vcol/inc/vcol_cleanup.inc +--source include/rpl_end.inc diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index c966b51d861..5b819620e29 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -5,6 +5,8 @@ -- source include/have_archive.inc -- source include/have_binlog_format_mixed_or_statement.inc +call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); + --disable_warnings DROP TABLE if exists t1,t2,t3,t4,t5,t6; --enable_warnings diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index 076e32eb22c..2a621250480 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -342,3 +342,41 @@ SELECT a FROM t2; DROP TABLE t1, t2; +--echo # +--echo # Bug#39828 autoinc wraps around when offset and increment > 1 +--echo # + +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) engine=MyISAM; +INSERT INTO t1 VALUES(1); +INSERT INTO t1 VALUES (18446744073709551601); + +SET @@SESSION.AUTO_INCREMENT_INCREMENT=10; + +SELECT @@SESSION.AUTO_INCREMENT_OFFSET; +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SELECT * FROM t1; + +SET @@SESSION.AUTO_INCREMENT_INCREMENT=default; +SET @@SESSION.AUTO_INCREMENT_OFFSET=default; + +DROP TABLE t1; + +--echo End of 5.1 tests + +--echo # +--echo # Bug#50619 assert in handler::update_auto_increment +--echo # + +CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk)); +# This triggered the assert +INSERT INTO t1 VALUES (NULL), (-1), (NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Check that that true overflow still gives error +CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk)); +--error ER_AUTOINC_READ_FAILED +INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test index 5639e013de8..b4ac526a80e 100644 --- a/mysql-test/t/change_user.test +++ b/mysql-test/t/change_user.test @@ -78,7 +78,7 @@ SET @@session.max_join_size = default; SELECT @@session.sql_big_selects; # On some machines the following will result into a warning --disable_warnings -SET @@global.max_join_size = -1; +SET @@global.max_join_size = 18446744073709551615; --enable_warnings SET @@session.max_join_size = default; --echo change_user diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 8fbdd709364..e5c6e8371bf 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -320,6 +320,31 @@ if ($error) --echo # -- Success: more than --extra-max-connections + 1 normal connections not possible } +########################################################################### + +--echo # +--echo # -- Bug#49752: 2469.126.2 unintentionally breaks authentication +--echo # against MySQL 5.1 server +--echo # + +GRANT ALL ON test.* TO 'Azundris12345678'@'localhost' IDENTIFIED BY 'test123'; + +FLUSH PRIVILEGES; + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +connect (con1,localhost,Azundris123456789,test123,test); +disconnect con1; + +connection default; + +DROP USER 'Azundris12345678'@'localhost'; + +FLUSH PRIVILEGES; + +--echo # +--echo # -- End of Bug#49752 +--echo # + --echo # ------------------------------------------------------------------ --echo # -- End of 5.1 tests --echo # ------------------------------------------------------------------ diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 4e337d54660..fd08f7c5a40 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -4,6 +4,9 @@ --source include/have_csv.inc +call mtr.add_suppression("Table 'test_repair_table2' is marked as crashed and should be repaired"); +call mtr.add_suppression("Table 'test_repair_table4' is marked as crashed and should be repaired"); + # # Simple select test # diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test index 463a9cea4bc..2331c731061 100644 --- a/mysql-test/t/ctype_cp1251.test +++ b/mysql-test/t/ctype_cp1251.test @@ -48,3 +48,13 @@ select * from t1 where a like 'we_%'; drop table t1; # End of 4.1 tests + +--echo # +--echo # Start of 5.1 tests +--echo # + +--source include/ctype_8bit.inc + +--echo # +--echo # End of 5.1 tests +--echo # diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index b12436f77ba..a7e6351161b 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -127,3 +127,8 @@ DROP TABLE `abcÿdef`; select hex(cast(_ascii 0x7f as char(1) character set latin1)); --echo End of 5.0 tests + +--echo # +--echo # Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings +--echo # +SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, ''); diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test index 400f1301dd3..4c29a2e11a0 100644 --- a/mysql-test/t/ctype_ujis.test +++ b/mysql-test/t/ctype_ujis.test @@ -1209,6 +1209,13 @@ DROP PROCEDURE sp1; DROP TABLE t1; DROP TABLE t2; +--echo # +--echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +--echo # +SET NAMES utf8; +SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis); + + set names default; set character_set_database=default; set character_set_server=default; diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index e5dc7ffa53e..2a5de8ca9ba 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -359,3 +359,19 @@ SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date; SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; --echo "End of 5.0 tests" + + +--echo # +--echo # Start of 5.1 tests +--echo # + +--echo # +--echo # Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr' +--echo # +SET NAMES utf8; +SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))); +SET NAMES latin1; + +--echo # +--echo # End of 5.1 tests +--echo # diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index a1456246e94..962cec95add 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -303,4 +303,15 @@ SELECT 0 FROM (SELECT 0) t56, (SELECT 0) t57, (SELECT 0) t58, (SELECT 0) t59, (SELECT 0) t60, (SELECT 0) t61; # 61 == MAX_TABLES +--echo # +--echo # A nested materialized derived table is used before being populated. +--echo # (addon for bug#19077) +--echo # + +CREATE TABLE t1 (i INT, j BIGINT); +INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2); +SELECT * FROM (SELECT MIN(i) FROM t1 +WHERE j = SUBSTRING('12', (SELECT * FROM (SELECT MIN(j) FROM t1) t2))) t3; +DROP TABLE t1; + --echo # End of 5.0 tests diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index f76058abae4..2c54131e08a 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -17,3 +17,5 @@ main.mysqlhotcopy_archive: bug#54129 2010-06-04 Horst main.events_time_zone : Test is not predictable as it depends on precise timing. main.mysqlhotcopy_myisam : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails main.mysqlhotcopy_archive: Bug#56817 2010-10-21 anitha mysqlhotcopy* fails +log_tables-big : Bug#48646 2010-11-15 mattiasj report already exists +read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index a7072362759..1475ca082a5 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -746,4 +746,15 @@ SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t G --enable_ps_protocol DROP TABLE t1; +--echo # +--echo # Bug#58396 group_concat and explain extended are still crashy +--echo # + +CREATE TABLE t1(a INT); +--error ER_UNKNOWN_ERROR +EXPLAIN EXTENDED SELECT UPDATEXML('1', a, '1') +FROM t1 ORDER BY (SELECT GROUP_CONCAT(1) FROM t1); +SHOW WARNINGS; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 72a78f612a2..8839a28b9dd 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1097,5 +1097,26 @@ SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1 DROP TABLE t1; --echo # +--echo # Bug#58030 crash in Item_func_geometry_from_text::val_str +--echo # + +--disable_result_log + +SELECT MAX(TIMESTAMP(RAND(0))); +SELECT MIN(TIMESTAMP(RAND(0))); + +--echo # +--echo # Bug#58177 crash and valgrind warnings in decimal and protocol sending functions... +--echo # + +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa'); + +--enable_result_log + +--echo # --echo End of 5.1 tests diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index b0c92c9d6ab..c8ea11c7490 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -315,4 +315,13 @@ SELECT -9223372036854775808 DIV -1; SELECT -9223372036854775808 MOD -1; SELECT -9223372036854775808999 MOD -1; +--echo # +--echo # Bug#57810 case/when/then : Assertion failed: length || !scale +--echo # + +SELECT CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END; +CREATE TABLE t1 SELECT CAST((CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END) AS CHAR) as C; +SHOW CREATE TABLE t1; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 3392a41519b..fdcfbcf519e 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1362,4 +1362,11 @@ SELECT 1 FROM t1, t1 t2 ORDER BY QUOTE(t1.a); DROP TABLE t1; +--echo # +--echo # Bug#57913 large negative number to string conversion functions crash +--echo # Bug#57810 case/when/then : Assertion failed: length || !scale +--echo # +SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1)); +SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)); + --echo End of 5.1 tests diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 57eee43d75e..6190c2f42fa 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -849,4 +849,14 @@ INSERT INTO t1 VALUES (0),(9.216e-096); SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); DROP TABLE t1; +--echo # +--echo # Bug #52160: crash and inconsistent results when grouping +--echo # by a function and column +--echo # + +CREATE TABLE t1(a CHAR(10) NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index fd0a18ab4dd..97fc6f94b6a 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -744,4 +744,14 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000 SET @a=POLYFROMWKB(@a); +# +# Bug #57321 crashes and valgrind errors from spatial types +# + +create table t1(a polygon NOT NULL)engine=myisam; +insert into t1 values (geomfromtext("point(0 1)")); +insert into t1 values (geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +drop table t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 97c4aaf71b6..f021e46f4ae 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1295,6 +1295,107 @@ SELECT CURRENT_USER(); SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); +# +# Bug#57952: privilege change is not taken into account by EXECUTE. +# + +--echo +--echo # Bug#57952 +--echo + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1; +DROP DATABASE IF EXISTS mysqltest2; +--enable_warnings + +CREATE DATABASE mysqltest1; +CREATE DATABASE mysqltest2; + +use mysqltest1; +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1, 1); + +CREATE TABLE t2(a INT); +INSERT INTO t2 VALUES (2); + +CREATE TABLE mysqltest2.t3(a INT); +INSERT INTO mysqltest2.t3 VALUES (4); + +CREATE USER testuser@localhost; +GRANT CREATE ROUTINE, EXECUTE ON mysqltest1.* TO testuser@localhost; +GRANT SELECT(b) ON t1 TO testuser@localhost; +GRANT SELECT ON t2 TO testuser@localhost; +GRANT SELECT ON mysqltest2.* TO testuser@localhost; + +--echo +--echo # Connection: bug57952_con1 (testuser@localhost, db: mysqltest1) +--connect (bug57952_con1,localhost,testuser,,mysqltest1) +PREPARE s1 FROM 'SELECT b FROM t1'; +PREPARE s2 FROM 'SELECT a FROM t2'; +PREPARE s3 FROM 'SHOW TABLES FROM mysqltest2'; + +CREATE PROCEDURE p1() SELECT b FROM t1; +CREATE PROCEDURE p2() SELECT a FROM t2; +CREATE PROCEDURE p3() SHOW TABLES FROM mysqltest2; + +CALL p1; +CALL p2; +CALL p3; + +--echo +--echo # Connection: default +--connection default +REVOKE SELECT ON t1 FROM testuser@localhost; +GRANT SELECT(a) ON t1 TO testuser@localhost; +REVOKE SELECT ON t2 FROM testuser@localhost; +REVOKE SELECT ON mysqltest2.* FROM testuser@localhost; + +--echo +--echo # Connection: bug57952_con1 (testuser@localhost, db: mysqltest1) +--connection bug57952_con1 +--echo # - Check column-level privileges... +--error ER_COLUMNACCESS_DENIED_ERROR +EXECUTE s1; + +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT b FROM t1; + +--error ER_COLUMNACCESS_DENIED_ERROR +EXECUTE s1; + +--error ER_COLUMNACCESS_DENIED_ERROR +CALL p1; + +--echo # - Check table-level privileges... +--error ER_TABLEACCESS_DENIED_ERROR +SELECT a FROM t2; + +--error ER_TABLEACCESS_DENIED_ERROR +EXECUTE s2; + +--error ER_TABLEACCESS_DENIED_ERROR +CALL p2; + +--echo # - Check database-level privileges... +--error ER_DBACCESS_DENIED_ERROR +SHOW TABLES FROM mysqltest2; + +--error ER_DBACCESS_DENIED_ERROR +EXECUTE s3; + +--error ER_DBACCESS_DENIED_ERROR +CALL p3; + +--echo +--echo # Connection: default +--connection default +--disconnect bug57952_con1 +DROP DATABASE mysqltest1; +DROP DATABASE mysqltest2; +DROP USER testuser@localhost; +use test; +--echo + --echo End of 5.0 tests # diff --git a/mysql-test/t/handler_innodb.test b/mysql-test/t/handler_innodb.test deleted file mode 100644 index 02982716f78..00000000000 --- a/mysql-test/t/handler_innodb.test +++ /dev/null @@ -1,20 +0,0 @@ -# t/handler_innodb.test -# -# test of HANDLER ... -# -# Last update: -# 2006-07-31 ML test refactored (MySQL 5.1) -# code of t/handler.test and t/innodb_handler.test united -# main testing code put into include/handler.inc -# rename t/innodb_handler.test to t/handler_innodb.test -# - -# should work in embedded server after mysqltest is fixed ---source include/not_embedded.inc - ---source include/have_innodb.inc -let $engine_type= InnoDB; -let $other_engine_type= MEMORY; -let $other_handler_engine_type= MyISAM; - ---source include/handler.inc diff --git a/mysql-test/t/init_file.test b/mysql-test/t/init_file.test index 343f320550c..573396f625d 100644 --- a/mysql-test/t/init_file.test +++ b/mysql-test/t/init_file.test @@ -33,4 +33,4 @@ drop table t1, t2; # MTR will restart server anyway, but by forcing it we avoid being warned # about the apparent side effect -call mtr.force_restart(); +--source include/force_restart.inc diff --git a/mysql-test/t/innodb-zip.test b/mysql-test/t/innodb-zip.test deleted file mode 100644 index 7514da087eb..00000000000 --- a/mysql-test/t/innodb-zip.test +++ /dev/null @@ -1,347 +0,0 @@ --- source include/have_innodb.inc - -let $per_table=`select @@innodb_file_per_table`; -let $format=`select @@innodb_file_format`; -let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; -set global innodb_file_per_table=off; -set global innodb_file_format=`0`; - -create table t0(a int primary key) engine=innodb row_format=compressed; -create table t00(a int primary key) engine=innodb -key_block_size=4 row_format=compressed; -create table t1(a int primary key) engine=innodb row_format=dynamic; -create table t2(a int primary key) engine=innodb row_format=redundant; -create table t3(a int primary key) engine=innodb row_format=compact; -create table t4(a int primary key) engine=innodb key_block_size=9; -create table t5(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; - -set global innodb_file_per_table=on; -create table t6(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -set global innodb_file_format=`1`; -create table t7(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -create table t8(a int primary key) engine=innodb -key_block_size=1 row_format=fixed; -create table t9(a int primary key) engine=innodb -key_block_size=1 row_format=compact; -create table t10(a int primary key) engine=innodb -key_block_size=1 row_format=dynamic; -create table t11(a int primary key) engine=innodb -key_block_size=1 row_format=compressed; -create table t12(a int primary key) engine=innodb -key_block_size=1; -create table t13(a int primary key) engine=innodb -row_format=compressed; -create table t14(a int primary key) engine=innodb key_block_size=9; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; - -drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14; -alter table t1 key_block_size=0; -alter table t1 row_format=dynamic; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -alter table t1 row_format=compact; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -alter table t1 row_format=redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t1; - -create table t1(a int not null, b text, index(b(10))) engine=innodb -key_block_size=1; - -create table t2(b text)engine=innodb; -insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000))); - -insert into t1 select 1, b from t2; -commit; - -connect (a,localhost,root,,); -connect (b,localhost,root,,); - -connection a; -begin; -update t1 set b=repeat('B',100); - -connection b; -select a,left(b,40) from t1 natural join t2; - -connection a; -rollback; - -connection b; -select a,left(b,40) from t1 natural join t2; - -connection default; -disconnect a; -disconnect b; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t1,t2; - -# The following should fail even in non-strict mode. -SET SESSION innodb_strict_mode = off; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE t1( - c TEXT NOT NULL, d TEXT NOT NULL, - PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE t1( - c TEXT NOT NULL, d TEXT NOT NULL, - PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII; -CREATE TABLE t1( - c TEXT NOT NULL, d TEXT NOT NULL, - PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII; -drop table t1; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -# The maximum key size for a compressed row actually depends on the -# version of libz used, as account must be taken for the maximum -# compressed size of a key, and this differs between libz -# versions. Some libz versions allow a size of 439, some only 438. -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); -DROP TABLE t1; - -# -# Test blob column inheritance (mantis issue#36) -# - -create table t1( c1 int not null, c2 blob, c3 blob, c4 blob, - primary key(c1, c2(22), c3(22))) - engine = innodb row_format = dynamic; -begin; -insert into t1 values(1, repeat('A', 20000), repeat('B', 20000), - repeat('C', 20000)); - -update t1 set c3 = repeat('D', 20000) where c1 = 1; -commit; - -# one blob column which is unchanged in update and part of PK -# one blob column which is changed and part of of PK -# one blob column which is not part of PK and is unchanged -select count(*) from t1 where c2 = repeat('A', 20000); -select count(*) from t1 where c3 = repeat('D', 20000); -select count(*) from t1 where c4 = repeat('C', 20000); - -update t1 set c3 = repeat('E', 20000) where c1 = 1; -drop table t1; - -# -# -# Test innodb_file_format -# -set global innodb_file_format=`0`; -select @@innodb_file_format; -set global innodb_file_format=`1`; -select @@innodb_file_format; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`2`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`-1`; -set global innodb_file_format=`Antelope`; -set global innodb_file_format=`Barracuda`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`Cheetah`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`abc`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`1a`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=``; - -#test strict mode. -# this does not work anymore, has been removed from mysqltest -# -- enable_errors -set global innodb_file_per_table = on; -set global innodb_file_format = `1`; - -set innodb_strict_mode = off; -create table t1 (id int primary key) engine = innodb key_block_size = 0; -drop table t1; - -#set strict_mode -set innodb_strict_mode = on; - -#Test different values of KEY_BLOCK_SIZE - ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb key_block_size = 0; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb key_block_size = 9; -show warnings; - - -create table t3 (id int primary key) engine = innodb key_block_size = 1; -create table t4 (id int primary key) engine = innodb key_block_size = 2; -create table t5 (id int primary key) engine = innodb key_block_size = 4; -create table t6 (id int primary key) engine = innodb key_block_size = 8; -create table t7 (id int primary key) engine = innodb key_block_size = 16; - -#check various ROW_FORMAT values. -create table t8 (id int primary key) engine = innodb row_format = compressed; -create table t9 (id int primary key) engine = innodb row_format = dynamic; -create table t10(id int primary key) engine = innodb row_format = compact; -create table t11(id int primary key) engine = innodb row_format = redundant; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t3, t4, t5, t6, t7, t8, t9, t10, t11; - -#test different values of ROW_FORMAT with KEY_BLOCK_SIZE -create table t1 (id int primary key) engine = innodb -key_block_size = 8 row_format = compressed; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb -key_block_size = 8 row_format = redundant; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t3 (id int primary key) engine = innodb -key_block_size = 8 row_format = compact; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t4 (id int primary key) engine = innodb -key_block_size = 8 row_format = dynamic; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t5 (id int primary key) engine = innodb -key_block_size = 8 row_format = default; -show warnings; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t1; - -#test multiple errors ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb -key_block_size = 9 row_format = redundant; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = compact; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = dynamic; -show warnings; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; - -#test valid values with innodb_file_per_table unset -set global innodb_file_per_table = off; - ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb key_block_size = 1; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb key_block_size = 2; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t3 (id int primary key) engine = innodb key_block_size = 4; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t4 (id int primary key) engine = innodb key_block_size = 8; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t5 (id int primary key) engine = innodb key_block_size = 16; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t6 (id int primary key) engine = innodb row_format = compressed; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t7 (id int primary key) engine = innodb row_format = dynamic; -show warnings; -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t8, t9; - -#test valid values with innodb_file_format unset -set global innodb_file_per_table = on; -set global innodb_file_format = `0`; - ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb key_block_size = 1; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb key_block_size = 2; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t3 (id int primary key) engine = innodb key_block_size = 4; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t4 (id int primary key) engine = innodb key_block_size = 8; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t5 (id int primary key) engine = innodb key_block_size = 16; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t6 (id int primary key) engine = innodb row_format = compressed; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t7 (id int primary key) engine = innodb row_format = dynamic; -show warnings; -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t8, t9; - -eval set global innodb_file_per_table=$per_table; -eval set global innodb_file_format=$format; -# -# Testing of tablespace tagging -# --- disable_info -set global innodb_file_per_table=on; -set global innodb_file_format=`Barracuda`; -set global innodb_file_format_check=`Antelope`; -create table normal_table ( - c1 int -) engine = innodb; -select @@innodb_file_format_check; -create table zip_table ( - c1 int -) engine = innodb key_block_size = 8; -select @@innodb_file_format_check; -set global innodb_file_format_check=`Antelope`; -select @@innodb_file_format_check; --- disable_result_log -show table status; --- enable_result_log -select @@innodb_file_format_check; -drop table normal_table, zip_table; --- disable_result_log - -# -# restore environment to the state it was before this test execution -# - --- disable_query_log -eval set global innodb_file_format=$format; -eval set global innodb_file_per_table=$per_table; -eval set global innodb_file_format_check=$innodb_file_format_check_orig; diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index a957c715bda..c8fa2a35538 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -1,3 +1,5 @@ +--source include/long_test.inc + # # test of left outer join # diff --git a/mysql-test/t/key_cache-master.opt b/mysql-test/t/key_cache-master.opt index 66e19c18a8a..6398e3e0a26 100644 --- a/mysql-test/t/key_cache-master.opt +++ b/mysql-test/t/key_cache-master.opt @@ -1 +1,2 @@ --key_buffer_size=2M --small.key_buffer_size=256K --small.key_buffer_size=128K +--force-restart diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index d77ce243e32..f415d670bf1 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -218,6 +218,7 @@ set global key_cache_block_size= @my_key_cache_block_size; # Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO # (One cannot drop the default key cache.) # +--error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE set @@global.key_buffer_size=0; select @@global.key_buffer_size; diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index 4df1a0f3478..742a83f7bad 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -484,22 +484,6 @@ unlock tables; connection default; drop table t1; -# -# Bug#25856 HANDLER table OPEN in one connection lock DROP TABLE in another one -# ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1 (a int) ENGINE=MEMORY; ---echo --> client 2 -connection locker; ---error ER_ILLEGAL_HA -handler t1 open; ---echo --> client 1 -connection default; -drop table t1; - - # Disconnect sessions used in many subtests above disconnect locker; disconnect reader; diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test index 076f2e8bc3b..af6c34dec37 100644 --- a/mysql-test/t/log_tables.test +++ b/mysql-test/t/log_tables.test @@ -1027,6 +1027,25 @@ DROP TABLE t1; TRUNCATE TABLE mysql.slow_log; +# +# Bug #47924 main.log_tables times out sporadically +# + +use mysql; +# Should result in error +--disable_warnings +drop table if exists renamed_general_log; +drop table if exists renamed_slow_log; +--enable_warnings +--error ER_CANT_RENAME_LOG_TABLE +RENAME TABLE general_log TO renamed_general_log; +--error ER_CANT_RENAME_LOG_TABLE +RENAME TABLE slow_log TO renamed_slow_log; + +use test; +flush tables with read lock; +unlock tables; + SET @@session.long_query_time= @old_long_query_time; SET @@global.log_output= @old_log_output; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index d405e4e5e3a..09efdb74995 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -677,4 +677,15 @@ SET t3.a = 0; DROP TABLE t1, t2, t3; SET SESSION sql_safe_updates = DEFAULT; +--echo # +--echo # Bug#52157 various crashes and assertions with multi-table update, stored function +--echo # + +CREATE FUNCTION f1 () RETURNS BLOB RETURN 1; +CREATE TABLE t1 (f1 DATE); +INSERT INTO t1 VALUES('2001-01-01'); +UPDATE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1; +DROP FUNCTION f1; +DROP TABLE t1; + --echo end of tests diff --git a/mysql-test/t/multi_update2.test b/mysql-test/t/multi_update2.test index 9c5078efb6f..a0f17fabec4 100644 --- a/mysql-test/t/multi_update2.test +++ b/mysql-test/t/multi_update2.test @@ -1,3 +1,5 @@ +--source include/long_test.inc + # # Test of update statement that uses many tables. # diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 9df25d8e084..4f634cdda05 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -414,4 +414,147 @@ drop table t1; --exec $MYSQL --skip-column-names --vertical test -e "select 1 as a" --echo + +--echo # +--echo # Bug #54899: --one-database option cannot handle DROP/CREATE DATABASE +--echo # commands. +--echo # +--write_file $MYSQLTEST_VARDIR/tmp/bug54899.sql +DROP DATABASE connected_db; +CREATE DATABASE connected_db; +USE connected_db; +CREATE TABLE `table_in_connected_db`(a INT); +EOF + +CREATE DATABASE connected_db; +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/bug54899.sql +USE connected_db; +SHOW TABLES; +DROP DATABASE connected_db; +--remove_file $MYSQLTEST_VARDIR/tmp/bug54899.sql + +--echo + +--echo # +--echo # Testing --one-database option +--echo # +--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql +CREATE TABLE t1 (i INT); +CREATE TABLE test.t1 (i INT); +USE test; +# Following statements should be filtered. +CREATE TABLE connected_db.t2 (i INT); +CREATE TABLE t2 (i INT); +EOF + +CREATE DATABASE connected_db; +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql +SHOW TABLES IN connected_db; +SHOW TABLES IN test; +USE test; +DROP TABLE t1; +DROP DATABASE connected_db; +--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql + +--echo +--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql +CREATE DATABASE test1; +USE test1; +USE test1; +# Following statements should be filtered. +CREATE TABLE connected_db.t1 (i INT); +EOF + +--exec $MYSQL --one-database test < $MYSQLTEST_VARDIR/tmp/one_db.sql +SHOW TABLES IN test; +SHOW TABLES IN test1; +DROP DATABASE test1; +--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql + +--echo + +--echo # +--echo # Checking --one-database option followed by the execution of +--echo # connect command. +--echo # +--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql +CREATE TABLE t1 (i INT); +CREATE TABLE test.t1 (i INT); +CONNECT test; +CREATE TABLE connected_db.t2 (i INT); +CREATE TABLE t2 (i INT); +USE connected_db; +# Following statements should be filtered. +CREATE TABLE connected_db.t3 (i INT); +CREATE TABLE t3 (i INT); +EOF + +CREATE DATABASE connected_db; +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql +SHOW TABLES IN connected_db; +SHOW TABLES IN test; +DROP TABLE test.t1; +DROP TABLE test.t2; +DROP DATABASE connected_db; +--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql + +--echo + +--echo # +--echo # Checking --one-database option with no database specified +--echo # at command-line. +--echo # +--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql +# All following statements should be filtered. +CREATE TABLE t1 (i INT); +CREATE TABLE test.t1 (i INT); +USE test; +CREATE TABLE test.t2 (i INT); +CREATE TABLE t2 (i INT); +EOF + +--exec $MYSQL --one-database < $MYSQLTEST_VARDIR/tmp/one_db.sql +SHOW TABLES IN test; +--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql + +--echo + +--echo # +--echo # Checking --one-database option with non_existent_db +--echo # specified with USE command +--echo # + +# CASE 1 : When 'connected_db' database exists and passed at commandline. +--write_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql +CREATE TABLE `table_in_connected_db`(i INT); +USE non_existent_db; +# Following statement should be filtered out. +CREATE TABLE `table_in_non_existent_db`(i INT); +EOF + +# CASE 2 : When 'connected_db' database exists but dropped and recreated in +# load file. +--write_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql +DROP DATABASE connected_db; +CREATE DATABASE connected_db; +USE non_existent_db; +# Following statements should be filtered out. +CREATE TABLE `table_in_non_existent_db`(i INT); +USE connected_db; +# Following statements should not be filtered out. +CREATE TABLE `table_in_connected_db`(i INT); +EOF + +CREATE DATABASE connected_db; +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db_1.sql +SHOW TABLES IN connected_db; +--echo +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db_2.sql +SHOW TABLES IN connected_db; +DROP DATABASE connected_db; + +--remove_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql +--remove_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql + +--echo --echo End of tests diff --git a/mysql-test/t/mysqlbinlog-innodb.test b/mysql-test/t/mysqlbinlog-innodb.test new file mode 100644 index 00000000000..49702e8db38 --- /dev/null +++ b/mysql-test/t/mysqlbinlog-innodb.test @@ -0,0 +1,31 @@ +-- source include/have_binlog_format_statement.inc +-- source include/have_log_bin.inc +-- source include/have_innodb.inc + +# +# MBug#702303: Spurious `use` statements in output from mysqlbinlog --rewrite-db="a->b" +# +let $MYSQLD_DATADIR= `select @@datadir`; +SET TIMESTAMP=1000000000; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; +CREATE DATABASE test2; + +RESET MASTER; +USE test2; +BEGIN; +USE test; +INSERT INTO t1 VALUES (1); +USE test2; +COMMIT; +BEGIN; +USE test; +INSERT INTO t1 VALUES (2); +USE test2; +COMMIT; +USE test; +SELECT * FROM t1 ORDER BY a; +FLUSH LOGS; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 --short-form +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 --short-form --rewrite-db="test->foo" --rewrite-db="test2->bar" +DROP DATABASE test2; +DROP TABLE t1; diff --git a/mysql-test/t/mysqlbinlog-master.opt b/mysql-test/t/mysqlbinlog-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/t/mysqlbinlog-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 3c58affa0f3..bf371443779 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -531,3 +531,30 @@ diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbin # Cleanup for this part of test remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty; remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn; + +# +# BUG#50914 +# This test verifies if the approach of the mysqlbinlog prints +# "use $database" statements to its output stream will cause +# "No Database Selected" error when dropping and recreating +# that database. +# +RESET MASTER; +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1(id int); +DROP DATABASE test1; +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1(id int); +DROP TABLE t1; +DROP DATABASE test1; +let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1); +FLUSH LOGS; + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +exec $MYSQL_BINLOG $MYSQLD_DATADIR/$master_binlog | $MYSQL test 2>&1; + +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +source include/show_binlog_events.inc; + diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 760391f5bab..2e04d96aaab 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -862,6 +862,13 @@ let $var2= `failing query`; echo $var2; EOF +create table t1 (a varchar(100)); +insert into t1 values ('`select 42`'); +let $a= `select * from t1`; +# This should output `select 42`, not evaluate it again to 42 +echo $a; +drop table t1; + --error 1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1 @@ -1139,6 +1146,11 @@ if (!$counter) { echo Counter is not 0, (counter=10); } +if (! $counter) +{ + let $counter=5; +} +echo Counter should still be 10, is $counter; let $counter=0; if($counter) { @@ -1148,6 +1160,10 @@ if (!$counter) { echo Counter is not 0, (counter=0); } +if (! $counter) +{ + echo Not space var works; +} # ---------------------------------------------------------------------------- # Test if with some non-numerics @@ -1932,6 +1948,7 @@ EOF cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; +--replace_regex /my_errno=[0-9]*/(my_errno)/ --error 1 --exec echo "cat_file non_existing_file;" | $MYSQL_TEST 2>&1 @@ -2512,6 +2529,8 @@ write_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt; hello EOF +# Verify that --replace_result also work on list_files +--replace_result file REPLACED_FILE list_files $MYSQLTEST_VARDIR/tmp/testdir; # list_files gets the directory list before creating the new file list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir *; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index e0e3f2af396..e0d420f2558 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1823,15 +1823,16 @@ commit; drop table t1; # -# BUG#32272: partition crash 1: enum column +# BUG#32772: partition crash 1: enum column # +# Note that month(int_col) is disallowed after bug#54483. create table t1 ( c0 int, c1 bigint, c2 set('sweet'), key (c2,c1,c0), key(c0) -) engine=myisam partition by hash (month(c0)) partitions 5; +) engine=myisam partition by hash (c0) partitions 5; --disable_warnings insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019; diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index d3f10628254..b222b02252b 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -11,6 +11,670 @@ drop table if exists t1; let $MYSQLD_DATADIR= `SELECT @@datadir`; --echo # +--echo # Bug#54483: valgrind errors when making warnings for multiline inserts +--echo # into partition +--echo # +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARBINARY(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a CHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIMESTAMP) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +CREATE TABLE t1 (a DATE) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +SHOW WARNINGS; +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +SHOW WARNINGS; +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +SHOW WARNINGS; + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_DAYS(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFMONTH(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFMONTH(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFMONTH(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MONTH(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MONTH(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MONTH(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFYEAR(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFYEAR(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFYEAR(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (HOUR(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (HOUR(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (HOUR(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MINUTE(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MINUTE(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MINUTE(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (QUARTER(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (QUARTER(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (QUARTER(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (SECOND(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (SECOND(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (SECOND(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (YEARWEEK(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (YEARWEEK(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (YEARWEEK(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (WEEKDAY(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (WEEKDAY(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (WEEKDAY(a)); +--echo # TO_SECONDS() is added in 5.5. + +--error ER_PARSE_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_SECONDS(a)); +#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +#CREATE TABLE t1 (a TIME) +#PARTITION BY HASH (TO_SECONDS(a)); +#CREATE TABLE t1 (a DATE) +#PARTITION BY HASH (TO_SECONDS(a)); +#DROP TABLE t1; +#CREATE TABLE t1 (a DATETIME) +#PARTITION BY HASH (TO_SECONDS(a)); +#DROP TABLE t1; +#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +#CREATE TABLE t1 (a VARCHAR(10)) +#PARTITION BY HASH (TO_SECONDS(a)); +#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +#CREATE TABLE t1 (a INT) +#PARTITION BY HASH (TO_SECONDS(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (FROM_DAYS(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MICROSECOND(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MICROSECOND(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MICROSECOND(a)); +--echo # Bug#57071 +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 +(`date` date, + `extracted_week` int, + `yearweek` int, + `week` int, + `default_week_format` int) +PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3) +(PARTITION p0 VALUES IN (0), + PARTITION p1 VALUES IN (1), + PARTITION p2 VALUES IN (2)); +CREATE TABLE t1 +(`date` date, + `extracted_week` int, + `yearweek` int, + `week` int, + `default_week_format` int); +SET @old_default_week_format := @@default_week_format; +SET default_week_format = 0; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 1; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 2; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 3; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 4; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 5; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 6; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 7; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SELECT * FROM t1; +SET default_week_format = @old_default_week_format; +DROP TABLE t1; + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); + +--echo # EXTRACT(WEEK...) is disallowed, see bug#57071. +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +CREATE TABLE t1 (a DATE, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE, b VARCHAR(10)) +PARTITION BY HASH (DATEDIFF(a, b)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); + + +--echo # --echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) --echo # CREATE TABLE t1 (a INT) PARTITION BY HASH (a); diff --git a/mysql-test/t/partition_federated.test b/mysql-test/t/partition_federated.test deleted file mode 100644 index 0fe692ecd01..00000000000 --- a/mysql-test/t/partition_federated.test +++ /dev/null @@ -1,21 +0,0 @@ -# -# Tests for partitioned FEDERATED -# --- source include/have_partition.inc --- source include/not_embedded.inc --- source suite/federated/have_federated_db.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Bug #22451 Partitions: duplicate results with engine=federated -# - ---error ER_PARTITION_MERGE_ERROR -create table t1 (s1 int) engine=federated -connection='mysql://root@localhost/federated/t1' partition by list (s1) -(partition p1 values in (1), partition p2 values in (2)); - ---echo End of 5.1 tests diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test index 04c72127394..626e5d19b99 100644 --- a/mysql-test/t/partition_innodb_plugin.test +++ b/mysql-test/t/partition_innodb_plugin.test @@ -1,5 +1,74 @@ --source include/have_partition.inc ---source include/have_innodb.inc +--source include/have_innodb_plugin.inc +# Remove the line below when bug#53307 is solved. +--source include/not_valgrind.inc + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal"); +--echo # +--echo # Bug#55091: Server crashes on ADD PARTITION after a failed attempt +--echo # +SET @old_innodb_file_format_check = @@global.innodb_file_format_check; +SET @old_innodb_file_format = @@global.innodb_file_format; +SET @old_innodb_file_per_table = @@global.innodb_file_per_table; +SET @old_innodb_strict_mode = @@global.innodb_strict_mode; +SET @@global.innodb_file_format = Barracuda, +@@global.innodb_file_per_table = ON, +@@global.innodb_strict_mode = ON; + +--echo # Connection con1 +--connect(con1,localhost,root,,) + +CREATE TABLE t1 (id INT NOT NULL +PRIMARY KEY, +user_num CHAR(10) +) ENGINE = InnoDB +KEY_BLOCK_SIZE=4 +PARTITION BY HASH(id) PARTITIONS 1; + +--replace_result #p# #P# +--list_files $MYSQLD_DATADIR/test +SHOW CREATE TABLE t1; + +SET GLOBAL innodb_file_per_table = OFF; + +--disconnect con1 +--connect(con2,localhost,root,,) +--echo # Connection con2 + +LOCK TABLE t1 WRITE; + +--echo # ALTER fails because COMPRESSED/KEY_BLOCK_SIZE +--echo # are incompatible with innodb_file_per_table = OFF; + +--error ER_GET_ERRNO +ALTER TABLE t1 ADD PARTITION PARTITIONS 1; + +--replace_result #p# #P# +--list_files $MYSQLD_DATADIR/test +--echo # This SET is not needed to reproduce the bug, +--echo # it is here just to make the test case more realistic +SET innodb_strict_mode = OFF; + +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +--replace_result #p# #P# +--list_files $MYSQLD_DATADIR/test + +# really bug#56172 +ALTER TABLE t1 REBUILD PARTITION p0; + +UNLOCK TABLES; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--disconnect con2 +--connection default +--echo # Connection default +SET @@global.innodb_strict_mode = @old_innodb_strict_mode; +SET @@global.innodb_file_format = @old_innodb_file_format; +SET @@global.innodb_file_per_table = @old_innodb_file_per_table; +SET @@global.innodb_file_format_check = @old_innodb_file_format_check; # # Bug#32430 - show engine innodb status causes errors diff --git a/mysql-test/t/plugin_not_embedded.test b/mysql-test/t/plugin_not_embedded.test index 11350e8c896..3e3bd6e86ca 100644 --- a/mysql-test/t/plugin_not_embedded.test +++ b/mysql-test/t/plugin_not_embedded.test @@ -18,3 +18,15 @@ UNINSTALL PLUGIN example; disconnect con1; connection default; DROP USER bug51770@localhost; + +# +# BUG#58246: INSTALL PLUGIN not secure & crashable +# +# The bug consisted of not recognizing / on Windows, so checking / on +# all platforms should cover this case. + +let $path = `select CONCAT_WS('/', '..', '$HA_EXAMPLE_SO')`; +--replace_regex /\.dll/.so/ +--error ER_UDF_NO_PATHS +eval INSTALL PLUGIN example SONAME '$path'; + diff --git a/mysql-test/t/pool_of_threads.test b/mysql-test/t/pool_of_threads.test index e71b16e1f89..530038cee91 100644 --- a/mysql-test/t/pool_of_threads.test +++ b/mysql-test/t/pool_of_threads.test @@ -4,6 +4,7 @@ -- source include/have_pool_of_threads.inc # Slow test, don't run during staging part -- source include/not_staging.inc +-- source include/long_test.inc -- source include/common-tests.inc diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index de8467b509d..24487db826a 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -1,4 +1,5 @@ -- source include/have_query_cache.inc +-- source include/long_test.inc # # Tests with query cache diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index db08aad0df0..1139e7acc60 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4087,5 +4087,38 @@ EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; DROP TABLE t1; +--echo # +--echo # Bug #702310: usage of 2 join buffers after ref access to an empty table +--echo # + +CREATE TABLE t1 (f1 int) ; +INSERT INTO t1 VALUES (9); + +CREATE TABLE t2 (f1 int); +INSERT INTO t2 VALUES (3),(7),(18); +INSERT INTO t2 VALUES (3),(7),(18); +INSERT INTO t2 VALUES (3),(7),(18); +INSERT INTO t2 VALUES (3),(7),(18); + +CREATE TABLE t3 (f1 int); +INSERT INTO t3 VALUES (17); + +CREATE TABLE t4 (f1 int PRIMARY KEY, f2 varchar(1024)) ; + +CREATE TABLE t5 (f1 int) ; +INSERT INTO t5 VALUES (20),(5); + +CREATE TABLE t6(f1 int); +INSERT INTO t6 VALUES (9),(7); + +SET SESSION join_buffer_size = 9000; + +EXPLAIN +SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; +SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; + +SET SESSION join_buffer_size = DEFAULT; + +DROP TABLE t1,t2,t3,t4,t5,t6; --echo End of 5.1 tests diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test index 8aa0791e265..fe52632c784 100644 --- a/mysql-test/t/sp-bugs.test +++ b/mysql-test/t/sp-bugs.test @@ -101,4 +101,41 @@ CALL p1 (); DROP TABLE t1; DROP PROCEDURE p1; +--echo # +--echo # Bug#54375: Error in stored procedure leaves connection +--echo # in different default schema +--echo # + +--disable_warnings +SET @@SQL_MODE = 'STRICT_ALL_TABLES'; +DROP DATABASE IF EXISTS db1; +CREATE DATABASE db1; +USE db1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES (1); +DELIMITER $$; +CREATE FUNCTION f1 ( + some_value int +) +RETURNS smallint +DETERMINISTIC +BEGIN + INSERT INTO t1 SET c1 = some_value; + RETURN(LAST_INSERT_ID()); +END$$ +DELIMITER ;$$ +DROP DATABASE IF EXISTS db2; +CREATE DATABASE db2; +--enable_warnings +USE db2; +SELECT DATABASE(); +--error ER_DUP_ENTRY +SELECT db1.f1(1); +SELECT DATABASE(); +USE test; +DROP FUNCTION db1.f1; +DROP TABLE db1.t1; +DROP DATABASE db1; +DROP DATABASE db2; --echo End of 5.1 tests diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index bd333d5a649..9bacaaaf6ec 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3759,4 +3759,19 @@ deallocate prepare stmt1; drop table t1,t2; +--echo # +--echo # Bug LP#693935/#58727: Assertion failure with +--echo # a single row subquery returning more than one row +--echo # + +create table t1 (a char(1) charset utf8); +insert into t1 values ('a'), ('b'); +create table t2 (a binary(1)); +insert into t2 values ('x'), ('y'); + +-- error ER_SUBQUERY_NO_1_ROW +select * from t2 where a=(select a from t1) and a='x'; + +drop table t1,t2; + --echo End of 5.1 tests diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index 41edd7f1216..bb97f246488 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -161,5 +161,15 @@ SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 ); DROP TABLE t1, t2, t3, t4, t5; --echo # +--echo # Bug#58207: invalid memory reads when using default column value and +--echo # tmptable needed +--echo # +CREATE TABLE t(a VARCHAR(245) DEFAULT +'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),(''); +SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d; +DROP TABLE t; + +--echo # --echo # End of 5.1 tests. --echo # diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test index 7ad69d5bf37..5576362b396 100644 --- a/mysql-test/t/table_elim.test +++ b/mysql-test/t/table_elim.test @@ -467,3 +467,35 @@ HAVING field4 != 6; drop table t0,t1,t2,t3,t4,t5,t6; + +--echo # +--echo # BUG#675118: Elimination of a table results in an invalid execution plan +--echo # +CREATE TABLE t1 (f1 int(11), PRIMARY KEY (f1)) ; + +CREATE TABLE t2 (f4 varchar(1024), KEY (f4)) ; +INSERT IGNORE INTO t2 VALUES ('xcddwntkbxyorzdv'), + ('cnxxcddwntkbxyor'),('r'),('r'), ('did'),('I'),('when'), + ('hczkfqjeggivdvac'),('e'),('okay'),('up'); + +CREATE TABLE t3 (f4 varchar(1024), f1 int(11), f2 int(11)) ; +INSERT IGNORE INTO t3 VALUES ('f','4','0'),('n','5','-996540416'); + +CREATE TABLE t4 (f1 int(11), f3 varchar(10)) ; +INSERT IGNORE INTO t4 VALUES ('8','n'),('9','nwzcerzsgx'),('10','c'); + +CREATE TABLE t5 (f5 int(11), KEY (f5)) ; + +EXPLAIN +SELECT t3.f2 +FROM t2 +LEFT JOIN t3 +LEFT JOIN t4 +LEFT JOIN t1 ON t4.f1 = t1.f1 +JOIN t5 ON t4.f3 ON t3.f1 = t5.f5 ON t2.f4 = t3.f4 +WHERE t3.f2 ; +--echo # ^^ The above must not produce a QEP of t3,t5,t2,t4 +--echo # as that violates the "no interleaving of outer join nests" rule. + +DROP TABLE t1,t2,t3,t4,t5; + diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 460da1c1614..4e097edf73d 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -612,3 +612,19 @@ explain select convert(1, binary(4294967296)); explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); --echo End of 5.0 tests + +--echo # Bug #52160: crash and inconsistent results when grouping +--echo # by a function and column + +CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1; + +CREATE TABLE t1(a CHAR(1)); +INSERT INTO t1 VALUES ('0'), ('0'); + +SELECT COUNT(*) FROM t1 GROUP BY f1(), a; + +DROP FUNCTION f1; +DROP TABLE t1; + +--echo End of 5.1 tests + diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test index d8da4ccc82c..1a9e66478e1 100644 --- a/mysql-test/t/type_year.test +++ b/mysql-test/t/type_year.test @@ -150,5 +150,15 @@ SELECT ta.y AS ta_y, ta.s, tb.y AS tb_y, tb.s FROM t1 ta, t1 tb HAVING ta_y = tb DROP TABLE t1; --echo # +--echo # Bug #59211: Select Returns Different Value for min(year) Function +--echo # + +CREATE TABLE t1(c1 YEAR(4)); +INSERT INTO t1 VALUES (1901),(2155),(0000); +SELECT * FROM t1; +SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1; +DROP TABLE t1; + +--echo # --echo End of 5.1 tests diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 4f27866de23..efaf8afd91e 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -346,4 +346,23 @@ FROM t1 GROUP BY a LIMIT 1; DROP TABLE t1; +# +# BUG#56138 "valgrind errors about overlapping memory when +# double-assigning same variable" +# + +select @v:=@v:=sum(1) from dual; + +# +# Bug #57187: more user variable fun with multiple assignments and +# comparison in query +# + +CREATE TABLE t1(a DECIMAL(31,21)); +INSERT INTO t1 VALUES (0); + +SELECT (@v:=a) <> (@v:=1) FROM t1; + +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/variables-big.test b/mysql-test/t/variables-big.test index 67a8d9fe86d..85121fd8f6d 100644 --- a/mysql-test/t/variables-big.test +++ b/mysql-test/t/variables-big.test @@ -3,6 +3,10 @@ # --source include/big_test.inc +# The test would allocate and initialize 5GB of memory +# if compiled with debug. It can take a lot of time +# of for paging/swapping. +--source include/not_debug.inc # # Bug#27322 failure to allocate transaction_prealloc_size causes crash @@ -37,24 +41,24 @@ --disable_warnings SET SESSION transaction_prealloc_size=1024*1024*1024*1; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> # Embedded server is hardcoded to show "Writing to net" as STATE. --replace_result "Writing to net" "NULL" SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*2; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> --replace_result "Writing to net" "NULL" SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*3; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> --replace_result "Writing to net" "NULL" SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*4; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> --replace_result "Writing to net" "NULL" SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*5; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> --replace_result "Writing to net" "NULL" SHOW PROCESSLIST; --enable_warnings diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 3e9dc5e39d3..a6c2fe3152b 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1247,4 +1247,48 @@ SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size; SELECT @@skip_name_resolve; SHOW VARIABLES LIKE 'skip_name_resolve'; +--echo # +--echo # Bug #43233 : Some server variables are clipped during "update," +--echo # not "check" stage +--echo # + +SET @kbs=@@global.key_buffer_size; +SET @kcbs=@@global.key_cache_block_size; + +--echo throw errors in STRICT mode +SET SQL_MODE=STRICT_ALL_TABLES; + +# sys_var_ulonglong_ptr: sys_max_binlog_cache_size +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.max_binlog_cache_size=-1; + +# sys_var_thd_ha_rows: "max_join_size" et al. +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.max_join_size=0; + +# sys_var_key_buffer_size: "key_buffer_size" +--error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE +SET @@global.key_buffer_size=0; + +# sys_var_key_cache_long: "key_cache_block_size" et al. +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.key_cache_block_size=0; + +--echo throw warnings in default mode +SET SQL_MODE=DEFAULT; + +SET @@global.max_binlog_cache_size=-1; +SET @@global.max_join_size=0; +# this is an exception. since this is a new error/warning, let's stay +# compatible with the upcoming 5.6. +--error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE +SET @@global.key_buffer_size=0; +SET @@global.key_cache_block_size=0; + +# cleanup +SET @@global.max_binlog_cache_size=DEFAULT; +SET @@global.max_join_size=DEFAULT; +SET @@global.key_buffer_size=@kbs; +SET @@global.key_cache_block_size=@kcbs; + --echo End of 5.1 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 4fb397fe142..e3a303df0f0 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3925,6 +3925,22 @@ WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # Bug#57703 create view cause Assertion failed: 0, file .\item_subselect.cc, line 846 +--echo # + +CREATE TABLE t1(a int); +CREATE VIEW v1 AS SELECT 1 FROM t1 GROUP BY +SUBSTRING(1 FROM (SELECT 3 FROM t1 WHERE a >= ANY(SELECT 1))); +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # Bug#57352 valgrind warnings when creating view +--echo # +CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f; +DROP VIEW v1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.1 tests. --echo # ----------------------------------------------------------------- diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index ba603bde7f8..21c6f376f8a 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -1503,8 +1503,6 @@ SHOW CREATE VIEW v1; DROP TABLE t1; DROP VIEW v1; -# Wait till we reached the initial number of concurrent sessions ---source include/wait_until_count_sessions.inc --echo # --echo # Bug #46019: ERROR 1356 When selecting from within another @@ -1546,3 +1544,145 @@ CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1; --error ER_NO_SUCH_USER LOCK TABLES v1 READ; DROP VIEW v1; + + +--echo # +--echo # Bug #58499 "DEFINER-security view selecting from INVOKER-security view +--echo # access check wrong". +--echo # +--echo # Check that we correctly handle privileges for various combinations +--echo # of INVOKER and DEFINER-security views using each other. +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1; +--enable_warnings +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE TABLE t1 (i INT); +CREATE TABLE t2 (j INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (2); +--echo # +--echo # 1) DEFINER-security view uses INVOKER-security view (covers +--echo # scenario originally described in the bug report). +CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2; +CREATE USER 'mysqluser1'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%'; +GRANT SELECT ON t1 TO 'mysqluser1'@'%'; +--echo # To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser1'. +--connect (mysqluser1, localhost, mysqluser1,,mysqltest1) +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +--echo # +--echo # Connection 'default'. +--connection default +CREATE USER 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%'; +GRANT SELECT ON t2 TO 'mysqluser2'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%'; +--echo # Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connect (mysqluser2, localhost, mysqluser2,,mysqltest1) +--echo # The below statement should succeed thanks to suid nature of v2_uses_t1. +SELECT * FROM v2_uses_t1; +--echo # The below statement should fail due to suid nature of v2_uses_t2. +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; +--echo # +--echo # 2) INVOKER-security view uses INVOKER-security view. +--echo # +--echo # Connection 'default'. +--connection default +DROP VIEW v2_uses_t1, v2_uses_t2; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%'; +--echo # +--echo # Connection 'mysqluser1'. +--connection mysqluser1 +--echo # For both versions of 'v2' 'mysqluser1' privileges should be used. +SELECT * FROM v2_uses_t1; +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +--echo # And now for both versions of 'v2' 'mysqluser2' privileges should +--echo # be used. +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t1; +SELECT * FROM v2_uses_t2; +--echo # +--echo # 3) INVOKER-security view uses DEFINER-security view. +--echo # +--echo # Connection 'default'. +--connection default +DROP VIEW v1_uses_t1, v1_uses_t2; +--echo # To be able create 'v1_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser1'. +--connection mysqluser1 +CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2; +--echo # +--echo # Connection 'default'. +--connection default +--echo # Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +--echo # Due to suid nature of v1_uses_t1 and v1_uses_t2 the first +--echo # select should succeed and the second select should fail. +SELECT * FROM v2_uses_t1; +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; +--echo # +--echo # 4) DEFINER-security view uses DEFINER-security view. +--echo # +--echo # Connection 'default'. +--connection default +DROP VIEW v2_uses_t1, v2_uses_t2; +--echo # To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +--echo # +--echo # Connection 'default'. +--connection default +--echo # Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +--echo # Again privileges of creator of innermost views should apply. +SELECT * FROM v2_uses_t1; +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; + +--disconnect mysqluser1 +--disconnect mysqluser2 +--connection default +USE test; +DROP DATABASE mysqltest1; +DROP USER 'mysqluser1'@'%'; +DROP USER 'mysqluser2'@'%'; + + +# Wait till we reached the initial number of concurrent sessions +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 6e7d38cdfca..416f1fef0c5 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -617,4 +617,28 @@ FROM t1 ORDER BY t1.id; DROP TABLE t1; + +--echo # +--echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +--echo # +SET NAMES utf8; +SELECT REPLACE(EXTRACTVALUE('1', '/a'),'ds',''); + + +--echo # +--echo # Bug #57820 extractvalue crashes +--echo # +SELECT AVG(DISTINCT EXTRACTVALUE((''),('$@k'))); + + +--echo # +--echo # Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0 +--echo # + +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1); +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1)); + + --echo End of 5.1 tests diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 1919b79461d..244e52a0629 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -489,6 +489,37 @@ } { + dlsym memory loss from plugin on SuSE 11.1 x64 + Memcheck:Leak + fun:*alloc + obj:/lib*/ld-*.so + obj:/lib*/ld-*.so + obj:/lib*/ld-*.so + obj:/lib*/libc-*.so + obj:/lib*/libdl-*.so + obj:/lib*/ld-*.so + obj:/lib*/libdl-*.so + fun:dlsym + fun:*plugin_dl_add* +} + +{ + dlsym memory loss from plugin on SuSE 11.3 x64 when using oqgraph + Memcheck:Leak + fun:*calloc + fun:do_lookup_x + fun:_dl_lookup_symbol_x + fun:_dl_relocate_object + fun:dl_open_worker + fun:_dl_catch_error + fun:_dl_open + fun:dlopen_doit + fun:_dl_catch_error + fun:_dlerror_run + fun:dlopen@@GLIBC_2.2.5 +} + +{ dlopen / ptread_cancel_init memory loss on Suse Linux 10.3 32/64 bit ver 1 Memcheck:Leak fun:*alloc @@ -546,6 +577,19 @@ fun:_dl_signal_error } +{ + dlsym memory loss from plugin + Memcheck:Leak + obj:/lib*/ld-*.so + obj:/lib*/ld-*.so + obj:/lib*/ld-*.so + obj:/lib*/libc-*.so + obj:/lib*/libdl-*.so + obj:/lib*/ld-*.so + obj:/lib*/libdl-*.so + fun:dlsym +} + # # Reading wrong addresses on SuSe Linux 10.3 32 bit # |