diff options
author | Michael Widenius <monty@askmonty.org> | 2009-02-15 12:58:34 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2009-02-15 12:58:34 +0200 |
commit | a8fdaa6f2c5b2e302bffb069be3475772ca20f48 (patch) | |
tree | b5c9560ec7346f7af6a5904ad344fdbb8020849c /mysql-test/include | |
parent | 115efe100dbc1393bce964fa1370e50cfef71d18 (diff) | |
parent | f7a24d72dc7a86341da4634f6d1a71f1ea77000b (diff) | |
download | mariadb-git-a8fdaa6f2c5b2e302bffb069be3475772ca20f48.tar.gz |
Merge with base MySQL 5.1
Contains fixes for test cases
Changed release tag to beta
configure.in:
change release tag to beta
Diffstat (limited to 'mysql-test/include')
76 files changed, 1637 insertions, 949 deletions
diff --git a/mysql-test/include/analyze-sync_with_master.test b/mysql-test/include/analyze-sync_with_master.test new file mode 100644 index 00000000000..684c0dbbab7 --- /dev/null +++ b/mysql-test/include/analyze-sync_with_master.test @@ -0,0 +1,6 @@ +SHOW PROCESSLIST; + +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 diff --git a/mysql-test/include/analyze-timeout.test b/mysql-test/include/analyze-timeout.test new file mode 100644 index 00000000000..179ad8f748a --- /dev/null +++ b/mysql-test/include/analyze-timeout.test @@ -0,0 +1,3 @@ +SHOW PROCESSLIST; + +exit; diff --git a/mysql-test/include/analyze_failure_sync_with_master.test b/mysql-test/include/analyze_failure_sync_with_master.test deleted file mode 100644 index e6fd32d2f46..00000000000 --- a/mysql-test/include/analyze_failure_sync_with_master.test +++ /dev/null @@ -1,15 +0,0 @@ -# Connect to both master and slave -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); - -vertical_results; - -echo == MASTER ===========================================================; -connection master; -show master status; -show slave status; - -echo == SLAVE ===========================================================; -connection slave; -show master status; -show slave status; diff --git a/mysql-test/include/charset_basic.inc b/mysql-test/include/charset_basic.inc deleted file mode 100644 index e3331697f2c..00000000000 --- a/mysql-test/include/charset_basic.inc +++ /dev/null @@ -1,81 +0,0 @@ -# -# This auxiliary script is used by character set test cases. -# - - - ---Error 0,ER_UNKNOWN_CHARACTER_SET -eval SET $charset_variable = big5; -eval SELECT $charset_variable; -eval SET $charset_variable = dec8; -eval SELECT $charset_variable; -eval SET $charset_variable = cp850; -eval SELECT $charset_variable; -eval SET $charset_variable = hp8; -eval SELECT $charset_variable; -eval SET $charset_variable = koi8r; -eval SELECT $charset_variable; -eval SET $charset_variable = latin1; -eval SELECT $charset_variable; -eval SET $charset_variable = latin2; -eval SELECT $charset_variable; -eval SET $charset_variable = swe7; -eval SELECT $charset_variable; -eval SET $charset_variable = ascii; -eval SELECT $charset_variable; -eval SET $charset_variable = ujis; -eval SELECT $charset_variable; -eval SET $charset_variable = sjis; -eval SELECT $charset_variable; -eval SET $charset_variable = hebrew; -eval SELECT $charset_variable; -eval SET $charset_variable = tis620; -eval SELECT $charset_variable; -eval SET $charset_variable = euckr; -eval SELECT $charset_variable; -eval SET $charset_variable = koi8u; -eval SELECT $charset_variable; -eval SET $charset_variable = gb2312; -eval SELECT $charset_variable; -eval SET $charset_variable = greek; -eval SELECT $charset_variable; -eval SET $charset_variable = cp1250; -eval SELECT $charset_variable; -eval SET $charset_variable = gbk; -eval SELECT $charset_variable; -eval SET $charset_variable = latin5; -eval SELECT $charset_variable; -eval SET $charset_variable = armscii8; -eval SELECT $charset_variable; -eval SET $charset_variable = utf8; -eval SELECT $charset_variable; -# Error with Linux ---error 0,ER_WRONG_VALUE_FOR_VAR -eval SET $charset_variable = ucs2; -eval SELECT $charset_variable; -eval SET $charset_variable = cp866; -eval SELECT $charset_variable; -eval SET $charset_variable = keybcs2; -eval SELECT $charset_variable; -eval SET $charset_variable = macce; -eval SELECT $charset_variable; -eval SET $charset_variable = macroman; -eval SELECT $charset_variable; -eval SET $charset_variable = cp852; -eval SELECT $charset_variable; -eval SET $charset_variable = latin7; -eval SELECT $charset_variable; -eval SET $charset_variable = cp1251; -eval SELECT $charset_variable; -eval SET $charset_variable = cp1256; -eval SELECT $charset_variable; -eval SET $charset_variable = cp1257; -eval SELECT $charset_variable; -eval SET $charset_variable = binary; -eval SELECT $charset_variable; -eval SET $charset_variable = geostd8; -eval SELECT $charset_variable; -eval SET $charset_variable = cp932; -eval SELECT $charset_variable; -eval SET $charset_variable = eucjpms; -eval SELECT $charset_variable; diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index bf70b66e5df..6dcb01c13cf 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -1,51 +1,15 @@ + # # This test is executed twice for each test case if mysql-test-run is passed -# the flag --check-testcase. -# Before every testcase it's run with mysqltest in record mode and will -# thus produce an output file -# that can be compared to output from after the tescase. -# In that way it's possible to check that a testcase does not have +# the flag --check-testcase. Before every testcase it is run with mysqltest +# in record mode and will thus produce an output file that can be compared +# to output from after the tescase. +# In that way its possible to check that a testcase does not have # any unwanted side affects. # - -# -# Dump all global variables -# -SHOW GLOBAL VARIABLES WHERE variable_name != 'timestamp'; - -# -# Dump all databases -# -SHOW DATABASES; - -# -# Dump the "test" database, all it's tables and their data -# ---exec $MYSQL_DUMP --skip-comments --skip-lock-tables test - -# -# Dump the "mysql" database and it's tables -# Select data separately to add "order by" -# ---exec $MYSQL_DUMP --skip-comments --skip-lock-tables --no-data mysql -use mysql; -SELECT * FROM columns_priv; -SELECT * FROM db ORDER BY host, db, user; -SELECT * FROM func; -SELECT * FROM help_category; -SELECT * FROM help_keyword; -SELECT * FROM help_relation; -SELECT * FROM help_relation; -SELECT * FROM host; -SELECT * FROM proc; -SELECT * FROM procs_priv; -SELECT * FROM tables_priv; -SELECT * FROM time_zone; -SELECT * FROM time_zone_leap_second; -SELECT * FROM time_zone_name; -SELECT * FROM time_zone_transition; -SELECT * FROM time_zone_transition_type; -SELECT * FROM user; +--disable_query_log +call mtr.check_testcase(); +--enable_query_log diff --git a/mysql-test/include/check-warnings.test b/mysql-test/include/check-warnings.test new file mode 100644 index 00000000000..2144957f742 --- /dev/null +++ b/mysql-test/include/check-warnings.test @@ -0,0 +1,61 @@ +# +# This test is executed once after each test to check the servers +# for unexpected warnings found in the servers error log +# +# NOTE! mysql-test-run.pl has already done a rough filtering +# of the file and written any suspicious lines +# to $error_log.warnings file +# +--disable_query_log + +# Don't write these queries to binlog +set SQL_LOG_BIN=0; + +# Turn off any debug crashes, allow the variable to be +# non existent in release builds +--error 0,1193 +set debug=""; + +use mtr; + +create temporary table error_log ( + row int auto_increment primary key, + suspicious int default 1, + file_name varchar(255), + line varchar(1024) default null +) engine=myisam; + +# Get the name of servers error log +let $log_error= query_get_value(show variables like 'log_error', Value, 1); +let $log_warning= $log_error.warnings; + +# Try tload the warnings into a temporary table, +# it might fail with error saying "The MySQL server is +# running with the --secure-file-priv" in which case +# an attempt to load the file using LOAD DATA LOCAL is made +--error 0,1290 +eval load data infile '$log_warning' into table error_log + fields terminated by 'xykls37' escaped by '' + ignore 1 lines + (line) + set file_name='$log_error'; + +if ($mysql_errno) +{ + # Try LOAD DATA LOCAL + eval load data local infile '$log_warning' into table error_log + fields terminated by 'xykls37' escaped by '' + ignore 1 lines + (line) + set file_name='$log_error'; +} + +# Call check_warnings to filter out any warning in +# the error_log table +call mtr.check_warnings(@result); +if (`select @result = 0`){ + skip OK; +} +--enable_query_log +echo ^ Found warnings!!; +exit; diff --git a/mysql-test/include/check_events_off.inc b/mysql-test/include/check_events_off.inc new file mode 100644 index 00000000000..599a4b9e504 --- /dev/null +++ b/mysql-test/include/check_events_off.inc @@ -0,0 +1,31 @@ +########## include/check_events_off.inc #################################### +# # +# Purpose: # +# Wait till we can expect that we have no event activity till the scheduler is # +# switched on again. # +# = There will be no modifications of user tables by existing events # +# except they use "INSERT DELAYED" or the server system variable # +# "concurrent_inserts" is not switched off. # +# Only some storage engines support concurrent_inserts" or "INSERT DELAYED". # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for bug fixes in tests # +# # +################################################################################ + +# 1. Check that the server system variable shows the state needed +if (`SELECT @@global.event_scheduler <> 'OFF'`) +{ + --echo # Error: We expect here that the event scheduler is switched off. + SELECT @@global.event_scheduler; + --echo # Thinkable reasons: + --echo # 1. SET GLOBAL event_scheduler = OFF had not the expected effect. + --echo # 2. Use of the current routine (include/check_events_off.inc) + --echo # within the wrong situation + --die +} +# 2. Wait till we have no event_scheduler session within the processlist +--source include/no_running_event_scheduler.inc +# 3. Wait till we have no event executor sessions within the processlist +--source include/no_running_events.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 new file mode 100644 index 00000000000..ac6654777db --- /dev/null +++ b/mysql-test/include/circular_rpl_for_4_hosts_init.inc @@ -0,0 +1,130 @@ +############################################################# +# +# 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 new file mode 100644 index 00000000000..68aede76913 --- /dev/null +++ b/mysql-test/include/circular_rpl_for_4_hosts_sync.inc @@ -0,0 +1,23 @@ +############################################################# +# +# 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 new file mode 100644 index 00000000000..43aa46cb657 --- /dev/null +++ b/mysql-test/include/cleanup_fake_relay_log.inc @@ -0,0 +1,16 @@ +# ==== Purpose ==== +# +# Clean up files create by setup_fake_relay_log.inc. +# +# ==== Usage ==== +# +# See setup_fake_relay_log.inc + +--echo Cleaning up after setup_fake_relay_log.inc + +# Remove files. +remove_file $_fake_relay_log; +remove_file $_fake_relay_index; +--disable_query_log +eval SET @@global.relay_log_purge= $_fake_relay_log_purge; +--enable_query_log diff --git a/mysql-test/include/collation_basic.inc b/mysql-test/include/collation_basic.inc deleted file mode 100644 index be8ae36eeb8..00000000000 --- a/mysql-test/include/collation_basic.inc +++ /dev/null @@ -1,258 +0,0 @@ -# -# This auxiliary file is used by collation variables -# ---Error 0,ER_UNKNOWN_CHARACTER_SET -eval SET $collation_variable = big5_chinese_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = big5_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = dec8_swedish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = dec8_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = cp850_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp850_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = hp8_english_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = hp8_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = koi8r_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = koi8r_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = latin1_german1_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin1_swedish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin1_danish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin1_german2_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin1_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = latin1_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin1_general_cs; -eval SELECT $collation_variable; -eval SET $collation_variable = latin1_spanish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin2_czech_cs; -eval SELECT $collation_variable; -eval SET $collation_variable = latin2_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin2_hungarian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin2_croatian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin2_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = swe7_swedish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = swe7_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = ascii_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ascii_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = ujis_japanese_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ujis_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = sjis_japanese_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = sjis_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = hebrew_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = hebrew_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = tis620_thai_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = tis620_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = euckr_korean_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = euckr_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = koi8u_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = koi8u_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = gb2312_chinese_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = gb2312_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = greek_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = greek_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1250_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1250_czech_cs; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1250_croatian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1250_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1250_polish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = gbk_chinese_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = gbk_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = latin5_turkish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin5_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = armscii8_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = armscii8_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_unicode_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_icelandic_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_latvian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_romanian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_slovenian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_polish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_estonian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_spanish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_swedish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_turkish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_czech_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_danish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_lithuanian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_slovak_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_spanish2_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_roman_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_persian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_esperanto_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = utf8_hungarian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_unicode_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_icelandic_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_latvian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_romanian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_slovenian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_polish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_estonian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_spanish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_swedish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_turkish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_czech_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_danish_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_lithuanian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_slovak_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_spanish2_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_roman_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_persian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_esperanto_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = ucs2_hungarian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp866_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp866_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = keybcs2_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = keybcs2_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = macce_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = macce_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = macroman_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = macroman_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = cp852_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp852_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = latin7_estonian_cs; -eval SELECT $collation_variable; -eval SET $collation_variable = latin7_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = latin7_general_cs; -eval SELECT $collation_variable; -eval SET $collation_variable = latin7_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1251_bulgarian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1251_ukrainian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1251_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1251_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1251_general_cs; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1256_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1256_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1257_lithuanian_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1257_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = cp1257_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = binary; -eval SELECT $collation_variable; -eval SET $collation_variable = geostd8_general_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = geostd8_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = cp932_japanese_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = cp932_bin; -eval SELECT $collation_variable; -eval SET $collation_variable = eucjpms_japanese_ci; -eval SELECT $collation_variable; -eval SET $collation_variable = eucjpms_bin; -eval SELECT $collation_variable; diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index 98f9c93b25a..a4e7d9ae601 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -267,7 +267,7 @@ select * from t2; insert into t2 (a) values (1026); --replace_result $MYSQLTEST_VARDIR .. --error ER_DUP_ENTRY -eval load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26); +eval load data infile "../../std_data/words.dat" into table t1 (a) set a:=f2(26); select * from t2; rollback; @@ -617,10 +617,10 @@ call p_verify_status_increment(0, 0, 0, 0); --echo --echo # No test because of Bug#8729 "rename table fails on temporary table" ---echo # 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction +--echo # 24. DDL: TRUNCATE TEMPORARY TABLE --echo truncate table t2; -call p_verify_status_increment(2, 0, 2, 0); +call p_verify_status_increment(4, 0, 4, 0); commit; --echo # There is nothing left to commit call p_verify_status_increment(0, 0, 0, 0); @@ -671,8 +671,11 @@ call p_verify_status_increment(2, 2, 2, 2); savepoint a; call p_verify_status_increment(0, 0, 0, 0); insert t1 set a=4; ---echo # Sic: a bug. Binlog did not register itself this time. -call p_verify_status_increment(1, 0, 1, 0); +--echo # Binlog does not register itself this time for other than the 1st +--echo # statement of the transaction with MIXED/STATEMENT binlog_format. +--echo # It needs registering with the ROW format. Therefore 1,0,2,2 are +--echo # the correct arguments to this test after bug#40221 fixed. +call p_verify_status_increment(1, 0, 2, 2); release savepoint a; rollback; call p_verify_status_increment(0, 0, 0, 0); @@ -730,7 +733,7 @@ call p_verify_status_increment(1, 0, 1, 0); rename table t4 to t3; call p_verify_status_increment(1, 0, 1, 0); truncate table t3; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(4, 4, 4, 4); create view v1 as select * from t2; call p_verify_status_increment(1, 0, 1, 0); check table t1; diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc index febab1eceb4..26d18edd8ce 100644 --- a/mysql-test/include/concurrent.inc +++ b/mysql-test/include/concurrent.inc @@ -638,7 +638,7 @@ drop table t1; connection default; drop table t1; +DROP user mysqltest@localhost; disconnect thread1; disconnect thread2; - diff --git a/mysql-test/include/default_my.cnf b/mysql-test/include/default_my.cnf new file mode 100644 index 00000000000..d77fee0e200 --- /dev/null +++ b/mysql-test/include/default_my.cnf @@ -0,0 +1,25 @@ +# Use default setting for mysqld processes +!include default_mysqld.cnf + +[mysqld.1] + +# Run the master.sh script before starting this process +#!run-master-sh + +log-bin= master-bin + + +[mysqlbinlog] +disable-force-if-open + +# mysql_fix_privilege_tables.sh does not read from [client] so it +# need its own section +[mysql_fix_privilege_tables] +socket= @client.socket +port= @client.port +user= @client.user +password= @client.password + +[ENV] +MASTER_MYPORT= @mysqld.1.port +MASTER_MYSOCK= @mysqld.1.socket diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf new file mode 100644 index 00000000000..ad0090aaf36 --- /dev/null +++ b/mysql-test/include/default_mysqld.cnf @@ -0,0 +1,21 @@ +# Default values that applies to all MySQL Servers +[mysqld] +open-files-limit= 1024 +local-infile +default-character-set= latin1 + +# Increase default connect_timeout to avoid intermittent +# disconnects when test servers are put under load see BUG#28359 +connect-timeout= 60 + +log-bin-trust-function-creators=1 +key_buffer_size= 1M +sort_buffer= 256K +max_heap_table_size= 1M + +loose-innodb_data_file_path= ibdata1:10M:autoextend + +slave-net-timeout=120 + +log-bin=mysqld-bin + diff --git a/mysql-test/include/default_ndbd.cnf b/mysql-test/include/default_ndbd.cnf new file mode 100644 index 00000000000..9a88a5936aa --- /dev/null +++ b/mysql-test/include/default_ndbd.cnf @@ -0,0 +1,27 @@ + +[cluster_config] +MaxNoOfSavedMessages= 1000 +MaxNoOfConcurrentTransactions= 128 +MaxNoOfConcurrentOperations= 10000 +DataMemory= 20M +IndexMemory= 1M +Diskless= 0 +TimeBetweenWatchDogCheck= 30000 +MaxNoOfOrderedIndexes= 32 +MaxNoOfAttributes= 2048 +TimeBetweenGlobalCheckpoints= 500 +NoOfFragmentLogFiles= 4 +FragmentLogFileSize= 12M +DiskPageBufferMemory= 4M + +# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612 +#ODirect= 1 +# the following parametes just function as a small regression +# test that the parameter exists +InitialNoOfOpenFiles= 27 + +# Increase timeouts for slow test-machines +HeartbeatIntervalDbDb= 30000 +HeartbeatIntervalDbApi= 30000 + +#TransactionDeadlockDetectionTimeout= 7500 diff --git a/mysql-test/include/federated.inc b/mysql-test/include/federated.inc deleted file mode 100644 index 925ecdd9682..00000000000 --- a/mysql-test/include/federated.inc +++ /dev/null @@ -1,28 +0,0 @@ ---source include/have_log_bin.inc ---source include/not_embedded.inc ---source ./include/have_federated_db.inc - -source ./include/master-slave.inc; - -# remote table creation - -# 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. -connection master; -sync_slave_with_master; - -connection slave; -#--replicate-ignore-db=federated -stop slave; - ---disable_warnings -# at this point, we are connected to master -DROP DATABASE IF EXISTS federated; ---enable_warnings -CREATE DATABASE federated; - -connection master; ---disable_warnings -DROP DATABASE IF EXISTS federated; ---enable_warnings -CREATE DATABASE federated; diff --git a/mysql-test/include/federated_cleanup.inc b/mysql-test/include/federated_cleanup.inc deleted file mode 100644 index 06fd7f6737a..00000000000 --- a/mysql-test/include/federated_cleanup.inc +++ /dev/null @@ -1,9 +0,0 @@ -connection master; ---disable_warnings -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; - -connection slave; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; ---enable_warnings diff --git a/mysql-test/include/have_32bit.inc b/mysql-test/include/have_32bit.inc index b09a813967d..66684fb5325 100644 --- a/mysql-test/include/have_32bit.inc +++ b/mysql-test/include/have_32bit.inc @@ -11,6 +11,6 @@ eval SET @@global.sort_buffer_size = $save; --enable_query_log if (!$mach32) { - skip Need a 32 bit machine; + skip Need a 32 bit machine/binary; } diff --git a/mysql-test/include/have_64bit.inc b/mysql-test/include/have_64bit.inc index 31529a0c9d4..cbba5e1d338 100644 --- a/mysql-test/include/have_64bit.inc +++ b/mysql-test/include/have_64bit.inc @@ -9,6 +9,6 @@ eval SET @@session.sort_buffer_size = $save; --enable_query_log if (!$mach64) { - skip Need a 64 bit machine; + skip Need a 64 binary ; } diff --git a/mysql-test/include/have_blackhole.inc b/mysql-test/include/have_blackhole.inc index 6c4da01d61d..146f5afb0d5 100644 --- a/mysql-test/include/have_blackhole.inc +++ b/mysql-test/include/have_blackhole.inc @@ -1,4 +1,5 @@ -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'blackhole'; -enable_query_log; +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'blackhole'`){ + skip Need blackhole engine; +} diff --git a/mysql-test/include/have_bug25714.inc b/mysql-test/include/have_bug25714.inc deleted file mode 100644 index 1d957bec2ec..00000000000 --- a/mysql-test/include/have_bug25714.inc +++ /dev/null @@ -1,7 +0,0 @@ -# -# Check if the variable MYSQL_BUG25714 is set -# ---require r/have_bug25714.require -disable_query_log; -eval select LENGTH('$MYSQL_BUG25714') > 0 as 'have_bug25714_exe'; -enable_query_log; diff --git a/mysql-test/include/have_federated_db.inc b/mysql-test/include/have_federated_db.inc deleted file mode 100644 index 041a29f460b..00000000000 --- a/mysql-test/include/have_federated_db.inc +++ /dev/null @@ -1,4 +0,0 @@ -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'federated'; -enable_query_log; diff --git a/mysql-test/include/have_log_bin.inc b/mysql-test/include/have_log_bin.inc index 5bcdb30b3e0..369af9b8e1d 100644 --- a/mysql-test/include/have_log_bin.inc +++ b/mysql-test/include/have_log_bin.inc @@ -1,3 +1,11 @@ +# ==== Purpose ==== +# +# Ensure that the server is running with binlogging on +# +# ==== Usage ==== +# +# source include/have_log_bin.inc; + -- require r/have_log_bin.require disable_query_log; show variables like 'log_bin'; diff --git a/mysql-test/include/have_ndbapi_examples.inc b/mysql-test/include/have_ndbapi_examples.inc index df7aa41ec5d..88499d555c0 100644 --- a/mysql-test/include/have_ndbapi_examples.inc +++ b/mysql-test/include/have_ndbapi_examples.inc @@ -1,4 +1,4 @@ --require r/have_ndbapi_examples.require disable_query_log; -eval select LENGTH('$MY_NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example'; +eval select LENGTH('$NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example'; enable_query_log; diff --git a/mysql-test/include/have_simple_parser.inc b/mysql-test/include/have_simple_parser.inc new file mode 100644 index 00000000000..c85786bd524 --- /dev/null +++ b/mysql-test/include/have_simple_parser.inc @@ -0,0 +1,16 @@ +# +# Check if server has support for loading udf's +# i.e it will support dlopen +# +--require r/have_dynamic_loading.require +disable_query_log; +show variables like 'have_dynamic_loading'; +enable_query_log; + +# +# Check if the variable SIMPLE_PARSER is set +# +--require r/have_simple_parser.require +disable_query_log; +eval select LENGTH('$SIMPLE_PARSER') > 0 as 'have_simple_parser'; +enable_query_log; diff --git a/mysql-test/include/index_merge1.inc b/mysql-test/include/index_merge1.inc index 023d582065e..5837df67a75 100644 --- a/mysql-test/include/index_merge1.inc +++ b/mysql-test/include/index_merge1.inc @@ -501,4 +501,30 @@ SELECT b,a from t1 WHERE (b!='c' AND b!='f' && b!='h') OR DROP TABLE t1; +--echo # +--echo # BUG#40974: Incorrect query results when using clause evaluated using range check +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 (a int); +insert into t1 values (1),(2); +create table t2(a int, b int); +insert into t2 values (1,1), (2, 1000); +create table t3 (a int, b int, filler char(100), key(a), key(b)); + +insert into t3 select 1000, 1000,'filler' from t0 A, t0 B, t0 C; +insert into t3 values (1,1,'data'); +insert into t3 values (1,1,'data'); +-- echo The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3) +explain select * from t1 +where exists (select 1 from t2, t3 + where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); + +select * from t1 +where exists (select 1 from t2, t3 + where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); + +drop table t0, t1, t2, t3; + --echo End of 5.0 tests diff --git a/mysql-test/include/linux_sys_vars.inc b/mysql-test/include/linux_sys_vars.inc index 4401a1e057a..85d7c6df7dc 100644 --- a/mysql-test/include/linux_sys_vars.inc +++ b/mysql-test/include/linux_sys_vars.inc @@ -9,7 +9,6 @@ SET @min_flush_time = 0; #SET @max_flush_time = 0; SET @default_key_buffer_size = 131072; -SET @min_key_buffer_size = 36; #SET @default_join_buffer_size = 131072; #SET @min_join_buffer_size = 8200; diff --git a/mysql-test/include/loaddata_autocom.inc b/mysql-test/include/loaddata_autocom.inc index cca56709331..bb286fb4169 100644 --- a/mysql-test/include/loaddata_autocom.inc +++ b/mysql-test/include/loaddata_autocom.inc @@ -7,16 +7,20 @@ eval SET SESSION STORAGE_ENGINE = $engine_type; drop table if exists t1; --enable_warnings +let $load_file= $MYSQLTEST_VARDIR/std_data/loaddata2.dat; + # NDB does not support the create option 'Binlog of table with BLOB attribute and no PK' # So use a dummy PK here. create table t1 (id int unsigned not null auto_increment primary key, a text, b text); start transaction; -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b); +--replace_result $load_file LOAD_FILE +eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b); commit; select count(*) from t1; truncate table t1; start transaction; -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b); +--replace_result $load_file LOAD_FILE +eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b); rollback; select count(*) from t1; diff --git a/mysql-test/include/maria_empty_logs.inc b/mysql-test/include/maria_empty_logs.inc index 0783020c443..6d80c4b134a 100644 --- a/mysql-test/include/maria_empty_logs.inc +++ b/mysql-test/include/maria_empty_logs.inc @@ -9,7 +9,7 @@ let $default_db=`select database()`; connection admin; -- echo * shut down mysqld, removed logs, restarted it -append_file $MYSQLTEST_VARDIR/tmp/master0.expect; +append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; wait-maria_empty_logs.inc EOF @@ -17,54 +17,54 @@ EOF if (!$mel_keep_control_file) { - remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control; + remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log_control; } -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000001; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000001; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000002; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000002; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000003; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000003; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000004; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000004; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000005; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000005; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000006; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000006; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000007; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000007; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000008; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000008; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000009; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000009; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000010; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000010; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000011; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000011; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000012; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000012; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000013; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000013; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000014; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000014; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000015; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000015; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000016; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000016; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000017; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000017; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000018; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000018; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000019; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000019; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000020; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000020; # hope there are not more than these logs... -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/maria_recovery.trace; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/maria_recovery.trace; -append_file $MYSQLTEST_VARDIR/tmp/master0.expect; +append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; restart-maria_empty_logs.inc EOF diff --git a/mysql-test/include/maria_make_snapshot.inc b/mysql-test/include/maria_make_snapshot.inc index 679a65552c1..e7f1236f022 100644 --- a/mysql-test/include/maria_make_snapshot.inc +++ b/mysql-test/include/maria_make_snapshot.inc @@ -18,9 +18,9 @@ if ($mms_copy) { --echo * copied $mms_tname$mms_table_to_use for $mms_purpose - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.frm $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.frm; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.frm $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.frm; } if ($mms_reverse_copy) @@ -28,11 +28,11 @@ if ($mms_reverse_copy) # do not call this without flushing target table first! --echo * copied $mms_tname$mms_table_to_use back for $mms_purpose -- error 0,1 - remove_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD; - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD; + remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAD; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAD; -- error 0,1 - remove_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI; - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI; + remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAI; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAI; } if ($mms_compare_physically) @@ -43,7 +43,7 @@ if ($mms_compare_physically) # If UNDO phase, we nevertheless compare checksums # (see maria_verify_recovery.inc). --echo * compared $mms_tname$mms_table_to_use to old version - diff_files $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; + diff_files $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; # index file not yet recovered -# diff_files $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; +# diff_files $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; } diff --git a/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc b/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc index 879aa3ef182..64777f9c9c8 100644 --- a/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc +++ b/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc @@ -32,6 +32,6 @@ let $mms_copy=0; -- error 0,1 remove_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control; -copy_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control; +copy_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log_control $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control; connection default; diff --git a/mysql-test/include/maria_verify_recovery.inc b/mysql-test/include/maria_verify_recovery.inc index becdfb5df86..1ca19e59286 100644 --- a/mysql-test/include/maria_verify_recovery.inc +++ b/mysql-test/include/maria_verify_recovery.inc @@ -20,11 +20,11 @@ let $mms_compare_physically_save=$mms_compare_physically; let $mms_compare_physically=0; # warn mtr that mysqld is going to die and should not be restarted immediately -#append_file $MYSQLTEST_VARDIR/tmp/master0.expect; +#append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; #wait-maria_verify_recovery.inc #EOF # todo: remove this "system" and uncomment above when BUG#32296 is fixed -system echo wait-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/master0.expect; +system echo wait-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; # flush page cache and log, only log, or nothing, and kill mysqld with # abort(). @@ -56,16 +56,16 @@ if ($mvr_restore_old_snapshot) # also copy back control file, to force recovery to start from an early # point, ignoring further checkpoints. -- error 0,1 - remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control; - copy_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control; + remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log_control; + copy_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log_control; } --echo * recovery happens # let mtr restart mysqld (and thus execute the maria log) -#append_file $MYSQLTEST_VARDIR/tmp/master0.expect; +#append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; #restart-maria_verify_recovery.inc #EOF -system echo restart-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/master0.expect; +system echo restart-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; --source include/wait_until_connected_again.inc diff --git a/mysql-test/include/master-slave-reset.inc b/mysql-test/include/master-slave-reset.inc index 1363fab236a..938eb2c074a 100644 --- a/mysql-test/include/master-slave-reset.inc +++ b/mysql-test/include/master-slave-reset.inc @@ -1,6 +1,13 @@ +# 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; -#we expect STOP SLAVE to produce a warning as the slave is stopped -#(the server was started with skip-slave-start) --disable_warnings stop slave; source include/wait_for_slave_to_stop.inc; @@ -13,11 +20,17 @@ use test; 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/mix1.inc b/mysql-test/include/mix1.inc index d2332edd5dc..cc9183205be 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -623,7 +623,8 @@ DROP TABLE t1,t2,t3; # create table t1 (a int) engine=innodb; -copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/bug29807.frm; +let $MYSQLD_DATADIR= `select @@datadir`; +copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/bug29807.frm; --error 1146 select * from bug29807; drop table t1; diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc index b4c4a9b8836..24e958e810f 100644 --- a/mysql-test/include/mix2.inc +++ b/mysql-test/include/mix2.inc @@ -1222,7 +1222,7 @@ drop table t2; # Clean up filename -- embedded server reports whole path without .frm, # regular server reports relative path with .frm (argh!) ---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t2.frm t2 +--replace_result \\ / $MYSQL_TEST_DIR . /var/mysqld.1/data/ / t2.frm t2 --error 1005 eval create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = $engine_type; @@ -1467,7 +1467,7 @@ source include/varchar.inc; # Clean up filename -- embedded server reports whole path without .frm, # regular server reports relative path with .frm (argh!) ---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t1.frm t1 +--replace_result \\ / $MYSQL_TEST_DIR . /var/mysqld.1/data/ / t1.frm t1 create table t1 (v varchar(65530), key(v)); drop table t1; create table t1 (v varchar(65536)); @@ -1778,7 +1778,7 @@ if ($test_foreign_keys) set foreign_key_checks=0; eval create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = $engine_type; ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 eval create table t1(a char(10) primary key, b varchar(20)) engine = $engine_type; set foreign_key_checks=1; @@ -1789,7 +1789,7 @@ drop table t2; set foreign_key_checks=0; eval create table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1; ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=utf8; set foreign_key_checks=1; @@ -1819,7 +1819,7 @@ drop table t2,t1; set foreign_key_checks=0; eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1; eval create table t3(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=utf8; ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1025 rename table t3 to t1; set foreign_key_checks=1; diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql new file mode 100644 index 00000000000..b54e21b6075 --- /dev/null +++ b/mysql-test/include/mtr_check.sql @@ -0,0 +1,59 @@ +delimiter ||; + +use mtr|| + +-- +-- Procedure used to check if server has been properly +-- restored after testcase has been run +-- +CREATE DEFINER=root@localhost PROCEDURE check_testcase() +BEGIN + + -- Dump all global variables except those + -- that are supposed to change + SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE variable_name != 'timestamp' and variable_name != "debug" order by variable_name; + + -- Dump all databases, there should be none + -- except those that was created during bootstrap + SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; + + -- The test database should not contain any tables + SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES + WHERE table_schema='test'; + + -- Show "mysql" database, tables and columns + SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql + FROM INFORMATION_SCHEMA.TABLES + WHERE table_schema='mysql' AND table_name != 'ndb_apply_status' + ORDER BY tables_in_mysql; + SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, + column_name, ordinal_position, column_default, is_nullable, + data_type, character_maximum_length, character_octet_length, + numeric_precision, numeric_scale, character_set_name, + collation_name, column_type, column_key, extra, column_comment + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_schema='mysql' AND table_name != 'ndb_apply_status' + ORDER BY columns_in_mysql; + + -- Checksum system tables to make sure they have been properly + -- restored after test + checksum table + mysql.columns_priv, + mysql.db, + mysql.func, + mysql.help_category, + mysql.help_keyword, + mysql.help_relation, + mysql.host, + mysql.proc, + mysql.procs_priv, + mysql.tables_priv, + mysql.time_zone, + mysql.time_zone_leap_second, + mysql.time_zone_name, + mysql.time_zone_transition, + mysql.time_zone_transition_type, + mysql.user; + +END|| diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql new file mode 100644 index 00000000000..bcf9fd4a4ff --- /dev/null +++ b/mysql-test/include/mtr_warnings.sql @@ -0,0 +1,248 @@ +delimiter ||; + +use mtr|| + +-- +-- Create table where testcases can insert patterns to +-- be suppressed +-- +CREATE TABLE test_suppressions ( + pattern VARCHAR(255) +) ENGINE=MyISAM|| + + +-- +-- Declare a trigger that makes sure +-- no invalid patterns can be inserted +-- into test_suppressions +-- +/*!50002 +CREATE DEFINER=root@localhost TRIGGER ts_insert +BEFORE INSERT ON test_suppressions +FOR EACH ROW BEGIN + DECLARE dummy INT; + SELECT "" REGEXP NEW.pattern INTO dummy; +END +*/|| + + +-- +-- Load table with patterns that will be suppressed globally(always) +-- +CREATE TABLE global_suppressions ( + pattern VARCHAR(255) +) ENGINE=MyISAM|| + + +-- Declare a trigger that makes sure +-- no invalid patterns can be inserted +-- into global_suppressions +-- +/*!50002 +CREATE DEFINER=root@localhost TRIGGER gs_insert +BEFORE INSERT ON global_suppressions +FOR EACH ROW BEGIN + DECLARE dummy INT; + SELECT "" REGEXP NEW.pattern INTO dummy; +END +*/|| + + + +-- +-- Insert patterns that should always be suppressed +-- +INSERT INTO global_suppressions VALUES + ("'SELECT UNIX_TIMESTAMP\\(\\)' failed on master"), + ("Aborted connection"), + ("Client requested master to start replication from impossible position"), + ("Could not find first log file name in binary log"), + ("Enabling keys got errno"), + ("Error reading master configuration"), + ("Error reading packet"), + ("Event Scheduler"), + ("Failed to open log"), + ("Failed to open the existing master info file"), + ("Forcing shutdown of [0-9]* plugins"), + ("Forcing close of thread"), + + /* + Due to timing issues, it might be that this warning + is printed when the server shuts down and the + computer is loaded. + */ + + ("Got error [0-9]* when reading table"), + ("Incorrect definition of table"), + ("Incorrect information in file"), + ("InnoDB: Warning: we did not need to do crash recovery"), + ("Invalid \\(old\\?\\) table or database name"), + ("Lock wait timeout exceeded"), + ("Log entry on master is longer than max_allowed_packet"), + ("unknown option '--loose-"), + ("unknown variable 'loose-"), + ("You have forced lower_case_table_names to 0 through a command-line option"), + ("Setting lower_case_table_names=2"), + ("NDB Binlog:"), + ("NDB: failed to setup table"), + ("NDB: only row based binary logging"), + ("Neither --relay-log nor --relay-log-index were used"), + ("Query partially completed"), + ("Slave I.O thread aborted while waiting for relay log"), + ("Slave SQL thread is stopped because UNTIL condition"), + ("Slave SQL thread retried transaction"), + ("Slave \\(additional info\\)"), + ("Slave: .*Duplicate column name"), + ("Slave: .*master may suffer from"), + ("Slave: According to the master's version"), + ("Slave: Column [0-9]* type mismatch"), + ("Slave: Error .* doesn't exist"), + ("Slave: Error .*Unknown table"), + ("Slave: Error in Write_rows event: "), + ("Slave: Field .* of table .* has no default value"), + ("Slave: Field .* doesn't have a default value"), + ("Slave: Query caused different errors on master and slave"), + ("Slave: Table .* doesn't exist"), + ("Slave: Table width mismatch"), + ("Slave: The incident LOST_EVENTS occured on the master"), + ("Slave: Unknown error.* 1105"), + ("Slave: Can't drop database.* database doesn't exist"), + ("Slave SQL:.*(Error_code: \[\[:digit:\]\]+|Query:.*)"), + ("Sort aborted"), + ("Time-out in NDB"), + ("Warning:\s+One can only use the --user.*root"), + ("Warning:\s+Setting lower_case_table_names=2"), + ("Warning:\s+Table:.* on (delete|rename)"), + ("You have an error in your SQL syntax"), + ("deprecated"), + ("description of time zone"), + ("equal MySQL server ids"), + ("error .*connecting to master"), + ("error reading log entry"), + ("lower_case_table_names is set"), + ("skip-name-resolve mode"), + ("slave SQL thread aborted"), + ("Slave: .*Duplicate entry"), + + /* + Special case, made as specific as possible, for: + Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes + server coredump + */ + + ("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"), + + ("Statement is not safe to log in statement format"), + + /* test case for Bug#bug29807 copies a stray frm into database */ + ("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"), + ("Cannot find or open table test\/bug29807 from"), + + /* innodb foreign key tests that fail in ALTER or RENAME produce this */ + ("InnoDB: Error: in ALTER TABLE `test`.`t[12]`"), + ("InnoDB: Error: in RENAME TABLE table `test`.`t1`"), + ("InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal"), + + /* Test case for Bug#14233 produces the following warnings: */ + ("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"), + ("Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc"), + ("Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc"), + + /* + BUG#32080 - Excessive warnings on Solaris: setrlimit could not + change the size of core files + */ + ("setrlimit could not change the size of core files to 'infinity'"), + + /* + rpl_extrColmaster_*.test, the slave thread produces warnings + when it get updates to a table that has more columns on the + master + */ + ("Slave: Unknown column 'c7' in 't15' Error_code: 1054"), + ("Slave: Can't DROP 'c7'.* 1091"), + ("Slave: Key column 'c6'.* 1072"), + + /* Test case for Bug#31590 in order_by.test produces the following error */ + ("Out of sort memory; increase server sort buffer size"), + + /* Special case for Bug #26402 in show_check.test + - Question marks are not valid file name parts on Windows. Ignore + this error message. + */ + ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"), + + /* maria-recovery.test has warning about missing log file */ + ("File '.*maria_log.000.*' not found \\(Errcode: 2\\)"), + /* and about marked-corrupted table */ + ("Table '..mysqltest.t_corrupted1' is crashed, skipping it. Please repair"), + /* maria-recover.test corrupts tables on purpose */ + ("Checking table: '..mysqltest.t_corrupted2'"), + ("Table '..mysqltest.t_corrupted2' is marked as crashed and should be"), + ("Incorrect key file for table '..mysqltest.t_corrupted2.MAI'"), + + + ("THE_LAST_SUPPRESSION")|| + + +-- +-- Procedure that uses the above created tables to check +-- the servers error log for warnings +-- +CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT) +BEGIN + DECLARE `pos` bigint unsigned; + + -- Don't write these queries to binlog + SET SQL_LOG_BIN=0; + + -- + -- Remove mark from lines that are suppressed by global suppressions + -- + UPDATE error_log el, global_suppressions gs + SET suspicious=0 + WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; + + -- + -- Remove mark from lines that are suppressed by test specific suppressions + -- + UPDATE error_log el, test_suppressions ts + SET suspicious=0 + WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; + + -- + -- Get the number of marked lines and return result + -- + SELECT COUNT(*) INTO @num_warnings FROM error_log + WHERE suspicious=1; + + IF @num_warnings > 0 THEN + SELECT file_name, line + FROM error_log WHERE suspicious=1; + --SELECT * FROM test_suppressions; + -- Return 2 -> check failed + SELECT 2 INTO result; + ELSE + -- Return 0 -> OK + SELECT 0 INTO RESULT; + END IF; + + -- Cleanup for next test + TRUNCATE test_suppressions; + DROP TABLE error_log; + +END|| + +-- +-- Declare a procedure testcases can use to insert test +-- specific suppressions +-- +/*!50001 +CREATE DEFINER=root@localhost +PROCEDURE add_suppression(pattern VARCHAR(255)) +BEGIN + INSERT INTO test_suppressions (pattern) VALUES (pattern); +END +*/|| + + diff --git a/mysql-test/include/mysqlbinlog_row_engine.inc b/mysql-test/include/mysqlbinlog_row_engine.inc index 8211baea22c..95440ab04a0 100644 --- a/mysql-test/include/mysqlbinlog_row_engine.inc +++ b/mysql-test/include/mysqlbinlog_row_engine.inc @@ -1651,7 +1651,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # --echo # Cleanup. @@ -1731,7 +1731,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # --echo # Cleanup. @@ -1854,7 +1854,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # --echo # Cleanup. @@ -1887,7 +1887,7 @@ eval CREATE TABLE t1 ( --echo # --echo # Load data. --echo # -LOAD DATA INFILE '../std_data_ln/loaddata5.dat' +LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2) SET c3 = 'Wow'; @@ -1912,7 +1912,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # --echo # Cleanup. diff --git a/mysql-test/include/mysqltest-x.inc b/mysql-test/include/mysqltest-x.inc index dd1468aed07..797c5c39f3f 100644 --- a/mysql-test/include/mysqltest-x.inc +++ b/mysql-test/include/mysqltest-x.inc @@ -1,2 +1,3 @@ echo Output from mysqltest-x.inc; +exit; diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc index f0a883d4e11..e6780788fe9 100644 --- a/mysql-test/include/ndb_backup.inc +++ b/mysql-test/include/ndb_backup.inc @@ -2,23 +2,21 @@ # By JBM 2006-02-16 So that the code is not repeated # # in test cases and can be reused. # ###################################################### ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT # there is no neat way to find the backupid, this is a hack to find it... +let $dump_file= $MYSQLTEST_VARDIR/tmp/tmp.dat; +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $dump_file ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +--replace_result $dump_file DUMP_FILE +eval LOAD DATA INFILE '$dump_file' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -DELETE FROM test.backup_info; - -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; - ---replace_column 1 <the_backup_id> - -SELECT @the_backup_id:=backup_id FROM test.backup_info; +# Load backup id into environment variable +let the_backup_id=`SELECT backup_id from test.backup_info`; +DROP TABLE test.backup_info; -let the_backup_id=`select @the_backup_id`; +remove_file $dump_file; -DROP TABLE test.backup_info; diff --git a/mysql-test/include/ndb_master-slave_2ch.inc b/mysql-test/include/ndb_master-slave_2ch.inc new file mode 100644 index 00000000000..52a06c01d86 --- /dev/null +++ b/mysql-test/include/ndb_master-slave_2ch.inc @@ -0,0 +1,136 @@ +############################################################# +# Author: Serge Kozlov <skozlov@mysql.com> +# Date: 03/17/2008 +# Purpose: Set up circular cluster replication where each +# cluster has two mysqlds and replication directions are +# following: +# master ---> slave +# / \ +# cluster A cluster B +# \ / +# master1 <--- slave1 +############################################################# + +--source include/have_log_bin.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 + +--connection master1 +--disable_warnings +STOP SLAVE; +--wait_for_slave_to_stop +--enable_warnings + +--connection slave +--disable_warnings +STOP SLAVE; +--wait_for_slave_to_stop +--enable_warnings + +--connection slave1 +--disable_warnings +STOP SLAVE; +--wait_for_slave_to_stop +--enable_warnings + +# 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 + + +# 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 a87ba66f1ef..f50ca0cab66 100644 --- a/mysql-test/include/ndb_not_readonly.inc +++ b/mysql-test/include/ndb_not_readonly.inc @@ -17,7 +17,7 @@ while ($mysql_errno) { if (!$counter) { - die("Failed while waiting for mysqld to come out of readonly mode"); + die Failed while waiting for mysqld to come out of readonly mode; } dec $counter; --sleep 0.1 diff --git a/mysql-test/include/ndb_restore_master.inc b/mysql-test/include/ndb_restore_master.inc index b01a0b58ee9..ae5f055b442 100644 --- a/mysql-test/include/ndb_restore_master.inc +++ b/mysql-test/include/ndb_restore_master.inc @@ -3,6 +3,6 @@ # in test cases and can be reused. # ###################################################### ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT diff --git a/mysql-test/include/ndb_restore_slave_eoption.inc b/mysql-test/include/ndb_restore_slave_eoption.inc index f1f6cf96881..a8657f68c8d 100644 --- a/mysql-test/include/ndb_restore_slave_eoption.inc +++ b/mysql-test/include/ndb_restore_slave_eoption.inc @@ -3,9 +3,9 @@ # in test cases and can be reused. # ###################################################### ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT diff --git a/mysql-test/include/no_running_event_scheduler.inc b/mysql-test/include/no_running_event_scheduler.inc new file mode 100644 index 00000000000..92813df9f96 --- /dev/null +++ b/mysql-test/include/no_running_event_scheduler.inc @@ -0,0 +1,23 @@ +########## include/no_running_event_scheduler.inc ########################## +# # +# Wait till the event scheduler disappeared from processlist. # +# # +# The characteristics of the event_scheduler entry within the processlist is # +# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if # +# ther is no short phase with command <> 'Daemon'. # +# A query with WHERE user = 'event_scheduler' only will also catch events in # +# startup phase. This is no problem since this phase is very short. # +# # +# A wait_timeout of >= 3 seconds was within experiments sufficient even on a # +# testing box with heavy parallel load. Therefore 5 seconds should be enough. # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for test bug fixes # +# # +################################################################################ + +let $wait_timeout= 5; +let $wait_condition= + SELECT COUNT(*) = 0 FROM information_schema.processlist + WHERE user = 'event_scheduler'; +--source include/wait_condition.inc diff --git a/mysql-test/include/no_running_events.inc b/mysql-test/include/no_running_events.inc new file mode 100644 index 00000000000..8090b2706b8 --- /dev/null +++ b/mysql-test/include/no_running_events.inc @@ -0,0 +1,25 @@ +########## include/no_running_events.inc ################################### +# # +# Wait till all event executors have finished their work. # +# # +# Different event executors share the characteristics that their entry within # +# processlist contains command = 'Connect'. # +# Of course the corresponding query will also catch other connections being # +# within the connect phase. This is no problem since the connect phase is # +# usually very short. # +# # +# A wait_timeout of >= 3 seconds was during experiments in case of "simple" # +# SQL commands sufficient even on a testing box with heavy parallel load. # +# "simple" = no sleeps, no long running commands, no waiting for lock ... # +# We use here the default of 30 seconds because this wastes some time only in # +# case of unexpected situations. # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for test bug fixes # +# # +################################################################################ + +let $wait_condition= + SELECT COUNT(*) = 0 FROM information_schema.processlist + WHERE command = 'Connect'; +--source include/wait_condition.inc diff --git a/mysql-test/include/not_as_root.inc b/mysql-test/include/not_as_root.inc index e0277ea593e..6c88051d632 100644 --- a/mysql-test/include/not_as_root.inc +++ b/mysql-test/include/not_as_root.inc @@ -1,4 +1,3 @@ --- require r/not_as_root.require -disable_query_log; -eval select "$MYSQL_TEST_ROOT" as running_as_root; -enable_query_log; +if ($MYSQL_TEST_ROOT){ + skip Not as root; +} diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc index fdd6bc50eae..77ea0021a5d 100644 --- a/mysql-test/include/query_cache.inc +++ b/mysql-test/include/query_cache.inc @@ -176,6 +176,7 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; # Final cleanup +eval set GLOBAL query_cache_size=$save_query_cache_size; connection default; drop table t2; disconnect connection1; diff --git a/mysql-test/include/report-features.test b/mysql-test/include/report-features.test index df395f6e3f0..1e4ab232490 100644 --- a/mysql-test/include/report-features.test +++ b/mysql-test/include/report-features.test @@ -9,3 +9,4 @@ show engines; show variables; --echo ===== STOP ===== --enable_query_log +exit;
\ No newline at end of file diff --git a/mysql-test/include/reset_master_and_slave.inc b/mysql-test/include/reset_master_and_slave.inc index c2d4120ddc9..30ba1f07a40 100644 --- a/mysql-test/include/reset_master_and_slave.inc +++ b/mysql-test/include/reset_master_and_slave.inc @@ -1,10 +1,8 @@ --echo **** Resetting master and slave **** connection slave; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; +source include/stop_slave.inc; RESET SLAVE; connection master; RESET MASTER; connection slave; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; diff --git a/mysql-test/include/restart_mysqld.inc b/mysql-test/include/restart_mysqld.inc new file mode 100644 index 00000000000..0f363ff1ee3 --- /dev/null +++ b/mysql-test/include/restart_mysqld.inc @@ -0,0 +1,25 @@ + +# 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 + +# 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 + +# 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 + diff --git a/mysql-test/include/rpl_events.inc b/mysql-test/include/rpl_events.inc index 34ceba81a38..0effa8c4e5c 100644 --- a/mysql-test/include/rpl_events.inc +++ b/mysql-test/include/rpl_events.inc @@ -62,7 +62,9 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name DROP EVENT IF EXISTS test.slave_once; --enable_warnings -CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO +# Create an event on slave and check its state. An event shouldn't be executed +# so set start time in 1 hour. +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); --echo "Checking event status on the slave for originator value = slave's server_id" @@ -81,8 +83,11 @@ connection master; DROP EVENT IF EXISTS test.justonce; --enable_warnings +# Create an event on master and check its state on slave. An event shouldn't be executed +# so set start time in 1 hour. Check that changes of event statement replicated to slave + --echo "Creating event test.er on the master" -CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO +CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); --echo "Checking event status on the master" @@ -95,7 +100,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND connection master; --echo "Altering event test.er on the master" -ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); --echo "Checking event status on the master" @@ -123,8 +128,11 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; # test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status # on CREATE EVENT +# Create an event on slave and check its status. An event shouldn't be executed +# so set start time in 1 hour. + --echo "Creating event test.slave_terminate on the slave" -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); --echo "Checking event status on the slave" diff --git a/mysql-test/include/rpl_multi_engine.inc b/mysql-test/include/rpl_multi_engine.inc index f2c837ef90b..b2d1a9c1cef 100644 --- a/mysql-test/include/rpl_multi_engine.inc +++ b/mysql-test/include/rpl_multi_engine.inc @@ -9,7 +9,7 @@ select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; sync_slave_with_master; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; connection master; -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; sync_slave_with_master; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; diff --git a/mysql-test/include/running_event_scheduler.inc b/mysql-test/include/running_event_scheduler.inc new file mode 100644 index 00000000000..296bf842e82 --- /dev/null +++ b/mysql-test/include/running_event_scheduler.inc @@ -0,0 +1,30 @@ +############# include/running_event_scheduler.inc ########################## +# # +# Wait till the event scheduler reached its final state within the processlist.# +# # +# The characteristics of the event_scheduler entry within the processlist is # +# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if # +# ther is no short phase with command <> 'Daemon'. # +# A query with WHERE user = 'event_scheduler' only will also catch events in # +# startup phase. # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for test bug fixes # +# # +################################################################################ + +# 1. Check that the server system variable shows the state needed +if (`SELECT @@global.event_scheduler <> 'ON'`) +{ + --echo # Error: We expect here that the event scheduler is switched on. + SELECT @@global.event_scheduler; + --echo # Thinkable reasons: + --echo # 1. SET GLOBAL event_scheduler = ON had not the expected effect. + --echo # 2. Use of the current routine (include/running_event_scheduler.inc) + --echo # within the wrong situation + --die +} +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE user = 'event_scheduler' AND command = 'Daemon'; +--source include/wait_condition.inc diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc new file mode 100644 index 00000000000..8113ed6dc10 --- /dev/null +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -0,0 +1,78 @@ +# ==== Purpose ==== +# +# Setup replication from an existing relay log in the current +# connection. +# +# ==== Usage ==== +# +# Make sure the slave is not running and issue: +# +# let $fake_relay_log= /path/to/fake-relay-log-file.000001 +# source include/setup_fake_relay_log.inc; +# START SLAVE SQL_THREAD; # setup_fake_relay_log doesn't start slave +# ... +# source include/cleanup_fake_relay_log.inc +# +# You must run the server with --relay-log=FILE. You probably want to +# run with --replicate-same-server-id too. +# +# ==== Implementation ==== +# +# First makes a sanity check, ensuring that the slave threads are not +# running. Then copies the $fake_relay_log to RELAY_BIN-fake.000001, +# where RELAY_BIN is the basename of the relay log, and updates +# RELAY_BIN.index. Finally issues CHANGE MASTER so that it uses the +# given files. +# +# ==== Side effects ==== +# +# 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 + +# Print message. +let $_fake_relay_log_printable= `SELECT REPLACE('$fake_relay_log', '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`; +--echo Setting up fake replication from $_fake_relay_log_printable + +# Sanity check. +let $_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1); +let $_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); +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; +} + +# Read server variables. +let $MYSQLD_DATADIR= `SELECT @@datadir`; +let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1); +if (`SELECT '$_fake_filename' = ''`) { + --echo Badly written test case: relay_log variable is empty. Please use the + --echo server option --relay-log=FILE. +} +let $_fake_relay_log= $MYSQLD_DATADIR/$_fake_filename-fake.000001; +let $_fake_relay_index= $MYSQLD_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`; + +# Create relay log file. +copy_file $fake_relay_log $_fake_relay_log; + +# Create relay log index. +eval SELECT '$_fake_relay_log' INTO OUTFILE '$_fake_relay_index'; + +# Setup replication from existing relay log. +eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_relay_log', RELAY_LOG_POS=4; + +--enable_query_log diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc new file mode 100644 index 00000000000..252d63f1bf4 --- /dev/null +++ b/mysql-test/include/show_rpl_debug_info.inc @@ -0,0 +1,87 @@ +# ==== Purpose ==== +# +# Print status information for replication, typically used to debug +# test failures. +# +# First, the following is printed on slave: +# +# SHOW SLAVE 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> +# +# 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; +# +# 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'. + +let $_con= $CURRENT_CONNECTION; +--echo +--echo [on $_con] +--echo +--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 (`SELECT '$_master_con' = ''`) +{ + if (`SELECT '$_con' = 'slave'`) + { + let $_master_con= master; + } + if (`SELECT '$_master_con' = ''`) + { + --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. + } +} + +if (`SELECT '$_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 + --echo **** SHOW MASTER STATUS on $_master_con **** + query_vertical SHOW MASTER STATUS; + --echo + --echo **** SHOW PROCESSLIST on $_master_con **** + 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'`) + { + eval SHOW BINLOG EVENTS IN '$master_binlog_name_io'; + } + + connection $_con; +} diff --git a/mysql-test/include/start_slave.inc b/mysql-test/include/start_slave.inc new file mode 100644 index 00000000000..78a02736de8 --- /dev/null +++ b/mysql-test/include/start_slave.inc @@ -0,0 +1,21 @@ +# ==== Purpose ==== +# +# Issues START SLAVE on the current connection. Then waits until both +# the IO and SQL threads have started, or until a timeout is reached. +# +# Please use this instead of 'START SLAVE', to reduce the risk of test +# case bugs. +# +# ==== Usage ==== +# +# source include/wait_for_slave_to_start.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +--disable_query_log +START SLAVE; +--enable_query_log +--echo include/start_slave.inc +source include/wait_for_slave_to_start.inc; diff --git a/mysql-test/include/stop_slave.inc b/mysql-test/include/stop_slave.inc new file mode 100644 index 00000000000..7161e6fe739 --- /dev/null +++ b/mysql-test/include/stop_slave.inc @@ -0,0 +1,21 @@ +# ==== Purpose ==== +# +# 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. +# +# ==== Usage ==== +# +# source include/wait_for_slave_to_start.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +--disable_query_log +STOP SLAVE; +--enable_query_log +--echo include/stop_slave.inc +source include/wait_for_slave_to_stop.inc; diff --git a/mysql-test/include/sync_slave_io_with_master.inc b/mysql-test/include/sync_slave_io_with_master.inc new file mode 100644 index 00000000000..f7dd563039c --- /dev/null +++ b/mysql-test/include/sync_slave_io_with_master.inc @@ -0,0 +1,36 @@ +# ==== Purpose ==== +# +# 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. +# +# +# ==== Usage ==== +# +# source include/sync_slave_io_with_master.inc; +# +# Syncs 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. + +let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1); +let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1); + +connection slave; + +let $slave_error_message= Failed while waiting for slave IO thread to sync; + +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_message= ; diff --git a/mysql-test/include/testdb_only.inc b/mysql-test/include/testdb_only.inc index ddc3f123d45..528e2f3eb9d 100644 --- a/mysql-test/include/testdb_only.inc +++ b/mysql-test/include/testdb_only.inc @@ -19,12 +19,6 @@ # # ################################################################### ---disable_query_log -eval set @USE_RUNNING_SERVER= '$USE_RUNNING_SERVER'; ---require r/testdb_only.require -SELECT 'use extern server' - AS "Variable_name ", - IF(@USE_RUNNING_SERVER= '1','YES', - IF(@USE_RUNNING_SERVER= '0','NO','UNEXPECTED')) - AS "Value" ; ---enable_query_log +if ($USE_RUNNING_SERVER){ + skip Not with extern server; +} diff --git a/mysql-test/include/wait_condition_sp.inc b/mysql-test/include/wait_condition_sp.inc new file mode 100644 index 00000000000..66301da557c --- /dev/null +++ b/mysql-test/include/wait_condition_sp.inc @@ -0,0 +1,62 @@ +# include/wait_condition.inc +# +# SUMMARY +# +# Waits until the passed statement returns true, or the operation +# times out. +# +# USAGE +# +# let $wait_condition= +# SELECT c = 3 FROM t; +# --source include/wait_condition.inc +# +# OR +# +# let $wait_timeout= 60; # Override default 30 seconds with 60. +# let $wait_condition= +# SELECT c = 3 FROM t; +# --source include/wait_condition.inc +# --echo Executed the test condition $wait_condition_reps times +# +# EXAMPLE +# events_bugs.test, events_time_zone.test +# + +--disable_query_log + +let $wait_counter= 300; +if ($wait_timeout) +{ + let $wait_counter= `SELECT $wait_timeout * 10`; +} +# Reset $wait_timeout so that its value won't be used on subsequent +# calls, and default will be used instead. +let $wait_timeout= 0; + +# Keep track of how many times the wait condition is tested +# This is used by some tests (e.g., main.status) +let $wait_condition_reps= 0; +while ($wait_counter) +{ + let $success= `$wait_condition`; + inc $wait_condition_reps; + if ($success) + { + let $wait_counter= 0; + } + if (!$success) + { + real_sleep 0.1; + dec $wait_counter; + } +} +if (!$success) +{ + echo Timeout in wait_condition.inc for $wait_condition; + show master status; + show slave status; +} + +--enable_query_log + diff --git a/mysql-test/include/wait_for_slave_io_to_start.inc b/mysql-test/include/wait_for_slave_io_to_start.inc new file mode 100644 index 00000000000..abdc8339290 --- /dev/null +++ b/mysql-test/include/wait_for_slave_io_to_start.inc @@ -0,0 +1,19 @@ +# ==== Purpose ==== +# +# Waits until the IO thread of the current connection has started and +# 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; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +let $slave_param= Slave_IO_Running; +let $slave_param_value= Yes; +let $slave_error_message= Failed while waiting for slave IO thread to start; +source include/wait_for_slave_param.inc; +let $slave_error_message= ; 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 6e66d4e7521..f61b0db1ed7 100644 --- a/mysql-test/include/wait_for_slave_io_to_stop.inc +++ b/mysql-test/include/wait_for_slave_io_to_stop.inc @@ -1,33 +1,24 @@ -################################################### -#Author: Jeb -#Date: 2007-06-11 -#Purpose: used for io errors on the slave. If Slave gets an io -# error, the io trhead should stop -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for -# sql threads to stop -# 3) If loops too long die. -#################################################### -connection slave; -let $my_show= SHOW SLAVE STATUS; -let $sql_running= Slave_IO_Running; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits until the IO thread of the current connection has stopped, or +# until a timeout is reached. +# +# ==== Usage ==== +# +# 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. -while ($run) +# 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 $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); - if (`SELECT '$io_result' = 'No'`){ - let $run= 0; - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave IO thread to stop" - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; + 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= ; } - diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index fed97195aba..82e57922913 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -1,26 +1,82 @@ -# include/wait_for_slave_param.inc +# ==== Purpose ==== # -# SUMMARY +# Waits until SHOW SLAVE STATUS has returned a specified value, or +# until a timeout is reached. # -# Waits until SHOW SLAVE STATUS has returned a spicified value. +# ==== Usage ==== # -# 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; -# --source include/slave_wait_param.inc +# Parameters: +# +# $slave_param, $slave_param_value +# This macro will wait until the column of the output of SHOW SLAVE +# STATUS named $slave_param gets the value $slave_param_value. See +# the example above. +# +# $slave_param_comparison +# By default, this file waits until $slave_param becomes equal to +# $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= !=; +# +# $slave_timeout +# The default timeout is 5 minutes. You can change the timeout by +# setting $slave_timeout. The unit is tenths of 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_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.) + +let $_slave_timeout_counter= $slave_timeout; +if (!$_slave_timeout_counter) +{ + let $_slave_timeout_counter= 3000; +} + +let $_slave_param_comparison= $slave_param_comparison; +if (`SELECT '$_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`) +{ + 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); + } +} -let $slave_wait_param_counter= 300; -let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); -while (`select "$slave_value" != "$slave_param_value"`) +# This has to be outside the loop until BUG#41913 has been fixed +if (!$_slave_timeout_counter) { - dec $slave_wait_param_counter; - if (!$slave_wait_param_counter) + --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** + if (`SELECT '$slave_error_message' != ''`) { - --echo ERROR: failed while waiting for slave parameter $slave_param: $slave_param_value - query_vertical show slave status; - exit; + --echo Message: $slave_error_message } - sleep 0.1; - let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 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; + exit; } diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc index 6780edbe2f0..ad1d7a9e639 100644 --- a/mysql-test/include/wait_for_slave_sql_error.inc +++ b/mysql-test/include/wait_for_slave_sql_error.inc @@ -1,33 +1,39 @@ -################################################### -#Author: Sven -#Date: 2007-10-09 -#Purpose: Wait until the slave has an error in the -# sql thread, as indicated by -# "SHOW SLAVE STATUS", or at most 30 -# seconds. -#Details: -# 1) Fill in and setup variables -# 2) loop, looking for sql error on slave -# 3) If it loops too long, die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits until the SQL thread of the current connection has got an +# error, or until a timeout is reached. Also waits until the SQL +# thread has completely stopped. +# +# ==== Usage ==== +# +# 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_timeout +# See wait_for_slave_param.inc for description. +# +# $master_connection +# See wait_for_slave_param.inc for description. -while ($run) -{ - let $sql_result= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, $row_number); - let $run= `SELECT '$sql_result' = '0'`; - if ($run) { - real_sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave to produce an error in its sql thread" - --replace_result $MASTER_MYPORT MASTER_PORT - --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; - } +if (`SELECT '$slave_sql_errno' = ''`) { + --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_fro_slave_sql_error.inc + exit; +} + +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) + source include/show_rpl_debug_info.inc; + exit; } 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 4b4776d2923..247de3a41a1 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,8 +5,23 @@ # # ==== Usage ==== # -# let show_sql_error=0|1; +# let $slave_sql_error= <ERRNO>; # 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) +# +# $show_sql_error +# If set, will print the error to the query log. +# +# $slave_timeout +# See wait_for_slave_param.inc for description. +# +# $master_connection +# See wait_for_slave_param.inc for description. echo --source include/wait_for_slave_sql_error_and_skip.inc; connection slave; @@ -17,11 +32,7 @@ if ($show_sql_error) echo Last_SQL_Error = $error; } -# wait for SQL thread to stop after the error -source include/wait_for_slave_sql_to_stop.inc; - # skip the erroneous statement set global sql_slave_skip_counter=1; -start slave; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; connection master; 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 14134725da4..48744f5dd13 100644 --- a/mysql-test/include/wait_for_slave_sql_to_start.inc +++ b/mysql-test/include/wait_for_slave_sql_to_start.inc @@ -1,31 +1,17 @@ -################################################### -#Author: Mats (based on file written by Jeb) -#Date: 2008-05-06 -#Purpose: To wait for slave SQL thread to start -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for both -# io and sql threads to start -# 3) If loops too long die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; - -while ($run) -{ - let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); - if (`SELECT '$sql_result' = 'Yes'`){ - let $run= 0; - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave SQL to start" - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; -} - +# ==== Purpose ==== +# +# Waits the SQL thread of the current connection has started, or until +# a timeout is reached. +# +# ==== Usage ==== +# +# 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. +let $slave_param= Slave_SQL_Running; +let $slave_param_value= Yes; +let $slave_error_message= Failed while waiting for slave SQL to start; +source include/wait_for_slave_param.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 cb5c437a586..6992613b646 100644 --- a/mysql-test/include/wait_for_slave_sql_to_stop.inc +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -1,33 +1,24 @@ -################################################### -#Author: Jeb -#Date: 2007-06-11 -#Purpose: used for SQL errors on the slave. If Slave gets a sql -# error, the SQL trhead should stop -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for -# sql threads to stop -# 3) If loops too long die. -#################################################### -if (!$keep_connection) -{ - connection slave; -} -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits the SQL thread of the current connection has stopped, or until +# a timeout is reached. +# +# ==== Usage ==== +# +# 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. -while ($run) +# 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 $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); - if (`SELECT '$sql_result' = 'No'`){ - let $run= 0; - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave SQL thread to stop" - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; + 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= ; } diff --git a/mysql-test/include/wait_for_slave_to_start.inc b/mysql-test/include/wait_for_slave_to_start.inc index 29d87b58a3c..567950cc6d7 100644 --- a/mysql-test/include/wait_for_slave_to_start.inc +++ b/mysql-test/include/wait_for_slave_to_start.inc @@ -1,35 +1,24 @@ -################################################### -#Author: Jeb -#Date: 2007-06-11 -#Purpose: To wait a brief time for slave to start -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for both -# io and sql threads to start -# 3) If loops too long die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# 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; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. -while ($run) -{ - let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); - if (`SELECT '$io_result' = 'Yes'`){ +let $slave_error_message= Failed while waiting for slave to start; - let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); - if (`SELECT '$sql_result' = 'Yes'`){ - let $run= 0; - } - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave to start" - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; -} +let $slave_param= Slave_IO_Running; +let $slave_param_value= Yes; +source include/wait_for_slave_param.inc; +let $slave_param= Slave_SQL_Running; +let $slave_param_value= Yes; +source include/wait_for_slave_param.inc; +let $slave_error_message= ; diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc index 5bd2d0338f8..56d0e7b0c91 100644 --- a/mysql-test/include/wait_for_slave_to_stop.inc +++ b/mysql-test/include/wait_for_slave_to_stop.inc @@ -1,39 +1,30 @@ -################################################### -#Author: Jeb -#Date: 2007-06-11 -#Purpose: To replace the mysqltest.c executable -# wait_for_slave_to_stop function and -# return this to the test language. -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for both -# io and sql threads to stop -# 3) If loops too long die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits until both the IO and SQL threads of the current connection +# have stopped, or until a timeout is reached. +# +# ==== Usage ==== +# +# 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. -while ($run) +# 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 $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); - if (`SELECT '$io_result' = 'No'`){ + let $slave_error_message= Failed while waiting for slave to stop; - let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); - if (`SELECT '$sql_result' = 'No'`){ - let $run= 0; - } - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave to stop" - --replace_result $MASTER_MYPORT MASTER_PORT - --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; -} + let $slave_param= Slave_IO_Running; + let $slave_param_value= No; + source include/wait_for_slave_param.inc; + let $slave_param= Slave_SQL_Running; + let $slave_param_value= No; + source include/wait_for_slave_param.inc; + let $slave_error_message= ; +} diff --git a/mysql-test/include/wait_show_pattern.inc b/mysql-test/include/wait_show_pattern.inc deleted file mode 100644 index c9f84ce7f08..00000000000 --- a/mysql-test/include/wait_show_pattern.inc +++ /dev/null @@ -1,51 +0,0 @@ -# include/wait_show_pattern.inc -# -# SUMMARY -# -# Waits until output produced by SHOW statement which particular type is -# specified as parameter matches certain pattern or maximum time reached. -# -# NOTES -# -# Only the first row produced by the parameter statement is checked. -# -# USAGE -# -# let $show_type= <Tail of SHOW statement>; -# let $show_pattern= 'Pattern to be used for LIKE matching'; -# --source wait_show_pattern.inc -# -# EXAMPLES -# -# alter_table-big.test, wait_slave_status.inc -# -# SEE ALSO -# -# wait_slave_status.inc, wait_condition.inc (>=5.1) -# -############################################################################### - ---disable_query_log - -# We accept to wait maximum 30 seconds (0.2 sec/loop). -let $wait_counter= 150; -while ($wait_counter) -{ - let $result= `SHOW $show_type`; - let $success= `SELECT '$result' LIKE $show_pattern`; - if ($success) - { - let $wait_counter= 0; - } - if (!$success) - { - real_sleep 0.2; - dec $wait_counter; - } -} -if (!$success) -{ - echo Timeout in wait_show_pattern.inc \$show_type= $show_type \$show_pattern= $show_pattern (\$result= '$result'); -} - ---enable_query_log diff --git a/mysql-test/include/wait_slave_status.inc b/mysql-test/include/wait_slave_status.inc deleted file mode 100644 index d8d048527cf..00000000000 --- a/mysql-test/include/wait_slave_status.inc +++ /dev/null @@ -1,129 +0,0 @@ -# include/wait_slave_status.inc -# -# Created by Matthias Leich -# -# SUMMARY -# -# Waits until slave has reached certain state or maximum time reached. -# -# (This script will not work, when the SHOW command delivers more than one -# result record, because only the first record will be caught.) -# -# USAGE -# -# Set $result_pattern in test file and source this file: -# -# let $result_pattern= <pattern used for LIKE on the result of -# SHOW STATUS SLAVE> -# --include wait_slave_status.inc -# -# EXAMPLE -# -# The script rpl_until.test: -# ... -# --replace_result $MASTER_MYPORT MASTER_MYPORT -# --replace_column 1 # 9 # 23 # 33 # -# --vertical_results show slave status; -# -# outputs -# 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 776 -# 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 319 -# Relay_Log_Space # -# Until_Condition Master -# Until_Log_File master-bin.000001 -# Until_Log_Pos 319 -# Master_SSL_Allowed No -# Master_SSL_CA_File -# Master_SSL_CA_Path -# Master_SSL_Cert -# Master_SSL_Cipher -# Master_SSL_Key -# Seconds_Behind_Master # -# -# The main problem with the "show slave status;" in rpl_until is, that -# depending on the total test engine power and the current load caused by -# other processes, the expected slave status might be not reached though -# it will happen in maybe some seconds. -# -# The typical problem with rpl_until is that Slave_IO_Running is "No" -# instead of "Yes". -# -# The expected result follows the LIKE pattern: -# -# let $result_pattern= '%127.0.0.1%root%1%master-bin.000001%776%slave-relay-bin.000004%master-bin.000001%Yes%No%0%0%319%Master%master-bin.000001%319%No%'; -# -# The Slave_IO_Running value is the "Yes" just after the "master-bin.000001". -# -# How to get this pattern ? -# -# Any lines "--replace_result ..." and "--replace_colum ..." just before -# the SHOW TABLE STATUS and of course the expected result itself -# show us columns where the content must be unified, because it is non -# deterministic or it depends on the current test environment. -# -# Unfortunately "--replace_result ..." and "--replace_colum ..." do not -# affect the result of our assignment let $my_val= `SHOW SLAVE STATUS`; -# Therefore such content must be covered by '%'. -# -# Please be careful. A more simple pattern might be dangerous, because we -# might get "wrong" matches. Example: There might be several "Yes" and "No" -# within one result row. -# -############################################################################### - -# We do not want to print the auxiliary commands, because they are not of -# interest and their amount will vary depending how fast we get the -# desired state. ---disable_query_log - -# The protocol should show -# - the setting of $result_pattern and -# - that this file is sourced , -# because this increases the chance to use the protocol as replay script. -eval SELECT "let \$result_pattern= $result_pattern ;" AS ""; -SELECT '--source include/wait_slave_status.inc' AS ""; - -let $show_type= SLAVE STATUS; -let $show_pattern= $result_pattern; ---enable_query_log - ---source include/wait_show_pattern.inc - -if (!$success) -{ -let $message= ! Attention: Timeout in wait_slave_status.inc. - | Possible reasons with decreasing probability: - | - The LIKE pattern is wrong, because the - | testcase was altered or the layout of the - | SHOW SLAVE STATUS result set changed. - | - There is a new bug within the replication. - | - We met an extreme testing environment and timeout is - | too small.; ---source include/show_msg80.inc ---echo DEBUG INFO START (wait_slave_status.inc): ---echo $result_pattern ---vertical_results -show slave status; ---echo DEBUG INFO END -} diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc index 4379f4d3145..08c206befcd 100644 --- a/mysql-test/include/wait_until_connected_again.inc +++ b/mysql-test/include/wait_until_connected_again.inc @@ -11,7 +11,10 @@ let $counter= 5000; let $mysql_errno= 1; while ($mysql_errno) { - --error 0,2002,2003,2006,1053 + # Strangely enough, the server might return "Too many connections" + # while being shutdown, thus 1040 is an "allowed" error + # See BUG#36228 + --error 0,1040,1053,2002,2003,2006,2013 show status; dec $counter; diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc index cf4a574573f..4f7d5c49460 100644 --- a/mysql-test/include/wait_until_disconnected.inc +++ b/mysql-test/include/wait_until_disconnected.inc @@ -1,4 +1,3 @@ -# # Include this script after a shutdown to wait until the connection # to the server has been lost or timeout occurs. # When you change this file you may have to chance its cousin @@ -6,7 +5,7 @@ --disable_result_log --disable_query_log -let $counter= 5000; +let $counter= 500; let $mysql_errno= 0; while (!$mysql_errno) { @@ -16,7 +15,7 @@ while (!$mysql_errno) dec $counter; if (!$counter) { - --die Server failed to disconnect me + --die Server failed to dissapear } --sleep 0.1 } diff --git a/mysql-test/include/windows_sys_vars.inc b/mysql-test/include/windows_sys_vars.inc index 90ff86fefd1..1d51ddb52f9 100644 --- a/mysql-test/include/windows_sys_vars.inc +++ b/mysql-test/include/windows_sys_vars.inc @@ -9,7 +9,6 @@ SET @min_flush_time = 0; #SET @max_flush_time = 0; SET @default_key_buffer_size= 131072; -SET @min_key_buffer_size= 8; #SET @default_join_buffer_size = 131072; #SET @min_join_buffer_size = 8200; |