summaryrefslogtreecommitdiffstats
path: root/mysql-test/include
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/include')
-rw-r--r--mysql-test/include/delete_anonymous_users.inc2
-rw-r--r--mysql-test/include/explain_non_select.inc13
-rw-r--r--mysql-test/include/galera_sst_method.combinations5
-rw-r--r--mysql-test/include/galera_sst_method.inc4
-rw-r--r--mysql-test/include/have_normal_zlib.inc (renamed from mysql-test/include/have_normal_bzip.inc)4
-rw-r--r--mysql-test/include/innodb_stable_estimates.inc12
-rw-r--r--mysql-test/include/innodb_stable_estimates.opt1
-rw-r--r--mysql-test/include/read_head.inc30
-rw-r--r--mysql-test/include/search_pattern_in_file.inc40
-rw-r--r--mysql-test/include/wait_for_pattern_in_file.inc56
-rw-r--r--mysql-test/include/wait_for_slave_io_error.inc2
-rw-r--r--mysql-test/include/wait_for_slave_io_to_stop.inc21
-rw-r--r--mysql-test/include/wait_for_slave_param.inc9
-rw-r--r--mysql-test/include/wait_for_slave_sql_to_stop.inc13
14 files changed, 191 insertions, 21 deletions
diff --git a/mysql-test/include/delete_anonymous_users.inc b/mysql-test/include/delete_anonymous_users.inc
index 704e74ae..cc44a01f 100644
--- a/mysql-test/include/delete_anonymous_users.inc
+++ b/mysql-test/include/delete_anonymous_users.inc
@@ -1,7 +1,7 @@
# Remove anonymous users added by add_anonymous_users.inc
disable_warnings;
disable_query_log;
-DELETE FROM mysql.user where host='localhost' and user='';
+DELETE FROM mysql.global_priv where host='localhost' and user='';
FLUSH PRIVILEGES;
enable_query_log;
enable_warnings;
diff --git a/mysql-test/include/explain_non_select.inc b/mysql-test/include/explain_non_select.inc
index bd0962d3..bab76ffb 100644
--- a/mysql-test/include/explain_non_select.inc
+++ b/mysql-test/include/explain_non_select.inc
@@ -306,6 +306,19 @@ INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
--source include/explain_utils.inc
DROP TABLE t1;
+--echo #30a
+--echo #
+--echo # MDEV-32957 Unusable key notes report wrong predicates for > and >=
+--echo #
+CREATE TABLE t1(a INT, i CHAR(2), INDEX(i(1)));
+INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
+ (20),(21),(22),(23),(24),(25),(26),(27),(28),(29),
+ (30),(31),(32),(33),(34),(35);
+--let $query = DELETE FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
+--let $select = SELECT * FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
+--source include/explain_utils.inc
+DROP TABLE t1;
+
--echo #31
CREATE TABLE t1 (i INT);
INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
diff --git a/mysql-test/include/galera_sst_method.combinations b/mysql-test/include/galera_sst_method.combinations
new file mode 100644
index 00000000..14b6172e
--- /dev/null
+++ b/mysql-test/include/galera_sst_method.combinations
@@ -0,0 +1,5 @@
+[rsync]
+wsrep-sst-method=rsync
+
+[mariabackup]
+wsrep_sst_method=mariabackup
diff --git a/mysql-test/include/galera_sst_method.inc b/mysql-test/include/galera_sst_method.inc
new file mode 100644
index 00000000..99dd3453
--- /dev/null
+++ b/mysql-test/include/galera_sst_method.inc
@@ -0,0 +1,4 @@
+# The goal of including this file is to enable galera_sst_method combinations
+# (see include/galera_sst_method.combinations)
+
+--source include/have_innodb.inc
diff --git a/mysql-test/include/have_normal_bzip.inc b/mysql-test/include/have_normal_zlib.inc
index 36c06274..a4531e68 100644
--- a/mysql-test/include/have_normal_bzip.inc
+++ b/mysql-test/include/have_normal_zlib.inc
@@ -1,9 +1,9 @@
--source include/have_compress.inc
-# Test that the system is using the default/standard bzip library.
+# Test that the system is using the default/standard zlib library.
# If not, we have to skip the test as the compression lengths displayed
# in the test will not match the results from used compression library.
if (`select length(COMPRESS(space(5000))) != 33`) {
- skip Test skipped as standard bzip is needed;
+ skip Test skipped as standard zlib is needed;
}
diff --git a/mysql-test/include/innodb_stable_estimates.inc b/mysql-test/include/innodb_stable_estimates.inc
new file mode 100644
index 00000000..dc3bc4de
--- /dev/null
+++ b/mysql-test/include/innodb_stable_estimates.inc
@@ -0,0 +1,12 @@
+#
+# Include this file in your .test file if your testcase uses InnoDB tables
+# requiring stable query plans, which likely requires that InnoDB produces
+# stable estimates for #records in tables.
+#
+# How it works:
+# Unstable InnoDB estimates are caused by InnoDB's background statistics
+# collection. When you include this file, MTR will use server options from
+# include/innodb_stable_estimates.opt, which disables background statistics
+# collection.
+# (and no, InnoDB team objects to using this configuration for all MTR tests)
+#
diff --git a/mysql-test/include/innodb_stable_estimates.opt b/mysql-test/include/innodb_stable_estimates.opt
new file mode 100644
index 00000000..896950f4
--- /dev/null
+++ b/mysql-test/include/innodb_stable_estimates.opt
@@ -0,0 +1 @@
+--innodb_stats_auto_recalc=0
diff --git a/mysql-test/include/read_head.inc b/mysql-test/include/read_head.inc
new file mode 100644
index 00000000..98818d76
--- /dev/null
+++ b/mysql-test/include/read_head.inc
@@ -0,0 +1,30 @@
+# Purpose:
+# Print first LINES_TO_READ from a file.
+# The environment variables SEARCH_FILE and LINES_TO_READ must be set
+# before sourcing this routine.
+# Use:
+# When the test is slow ( example because of ASAN build) then it
+# may not flush the lines when 'cat' command is called and the
+# test could fail with missing lines. Hence this can be used to
+# to print first N lines.
+#
+
+perl;
+
+use strict;
+
+my $search_file = $ENV{SEARCH_FILE} or die "SEARCH_FILE not set";
+my $lines_to_read = $ENV{LINES_TO_READ} or die "LINES_TO_READ not set";
+
+open(FILE, '<', $search_file) or die "Can't open file $search_file: $!";
+
+my $line_count = 0;
+while ($line_count < $lines_to_read and my $line = <FILE>)
+{
+ print $line;
+ $line_count++;
+}
+
+close(FILE);
+
+EOF
diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc
index a899a929..3105f7f9 100644
--- a/mysql-test/include/search_pattern_in_file.inc
+++ b/mysql-test/include/search_pattern_in_file.inc
@@ -51,12 +51,15 @@
# Created: 2011-11-11 mleich
#
+--error 0,1
perl;
use strict;
die "SEARCH_FILE not set" unless $ENV{SEARCH_FILE};
my @search_files= glob($ENV{SEARCH_FILE});
my $search_pattern= $ENV{SEARCH_PATTERN} or die "SEARCH_PATTERN not set";
my $search_range= $ENV{SEARCH_RANGE};
+ my $silent= $ENV{SEARCH_SILENT};
+ my $search_result= 0;
my $content;
foreach my $search_file (@search_files) {
open(FILE, '<', $search_file) || die("Can't open file $search_file: $!");
@@ -89,16 +92,39 @@ perl;
{
@matches=($content =~ /$search_pattern/gm);
}
- my $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND";
+ my $res;
+ if (@matches)
+ {
+ $res="FOUND " . scalar(@matches);
+ $search_result= 1;
+ }
+ else
+ {
+ $res= "NOT FOUND";
+ }
$ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1};
- if ($ENV{SEARCH_OUTPUT} eq "matches") {
- foreach (@matches) {
- print $_ . "\n";
- }
- } else {
- print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n";
+ if (!$silent || $search_result)
+ {
+ if ($ENV{SEARCH_OUTPUT} eq "matches")
+ {
+ foreach (@matches)
+ {
+ print $_ . "\n";
+ }
+ }
+ else
+ {
+ print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n";
+ }
}
die "$ENV{SEARCH_ABORT}\n"
if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/;
+ exit($search_result != 1);
EOF
+
+let $SEARCH_RESULT= 1; # Found pattern
+if ($errno)
+{
+ let $SEARCH_RESULT= 0; # Did not find pattern
+}
diff --git a/mysql-test/include/wait_for_pattern_in_file.inc b/mysql-test/include/wait_for_pattern_in_file.inc
new file mode 100644
index 00000000..52226acd
--- /dev/null
+++ b/mysql-test/include/wait_for_pattern_in_file.inc
@@ -0,0 +1,56 @@
+# ==== Purpose ====
+#
+# Waits until pattern comes into log file or until a timeout is reached.
+# This is a timeout wrapper for search_pattern_in_file.inc
+#
+#
+# ==== Usage ====
+#
+# [--let $timeout= NUMBER in seconds]
+# For other parameters, check search_pattern_in_file.inc
+
+--let $wait_save_keep_include_silent=$keep_include_silent
+--let $include_filename= wait_for_pattern_in_file.inc
+--source include/begin_include_file.inc
+--let $keep_include_silent= 1
+
+let $_timeout= $timeout;
+if (!$_timeout)
+{
+ let $_timeout= 10;
+ if ($VALGRIND_TEST)
+ {
+ let $_timeout= 30;
+ }
+}
+
+let $_timeout_counter=`SELECT $_timeout * 10`;
+let SEARCH_SILENT=1;
+
+let $_continue= 1;
+while ($_continue)
+{
+ source include/search_pattern_in_file.inc;
+ if ($SEARCH_RESULT)
+ {
+ # Found match
+ let $_continue= 0;
+ }
+ if (!$SEARCH_RESULT)
+ {
+ dec $_timeout_counter;
+ if ($_timeout_counter == 1)
+ {
+ let $SEARCH_SILENT= 0;
+ }
+ if (!$_timeout_counter)
+ {
+ let $_continue= 0;
+ }
+ }
+}
+
+let SEARCH_SILENT=0;
+
+--source include/end_include_file.inc
+--let $keep_include_silent=$wait_save_keep_include_silent
diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc
index 96844106..15859430 100644
--- a/mysql-test/include/wait_for_slave_io_error.inc
+++ b/mysql-test/include/wait_for_slave_io_error.inc
@@ -59,7 +59,7 @@ let $_wfsie_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
if ($slave_io_errno == '') {
--echo !!!ERROR IN TEST: you must set \$slave_io_errno before you source
- --echo !!!wait_for_slave_sql_error.inc. The error we got this time was '$_wfsie_errno',
+ --echo !!!wait_for_slave_io_error.inc. The error we got this time was '$_wfsie_errno',
--echo !!!so you probably want to add the following line to your test case:
--echo !!! --let \$slave_io_errno= $_wfsie_errno
--die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
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 d25c2ac0..760e032e 100644
--- a/mysql-test/include/wait_for_slave_io_to_stop.inc
+++ b/mysql-test/include/wait_for_slave_io_to_stop.inc
@@ -21,6 +21,17 @@
# $slave_timeout
# See include/wait_for_slave_param.inc.
#
+# $rpl_allow_error
+# By default, this file fails if there is an error in the IO
+# thread. However, if an error in the IO thread is possible and allowed,
+# setting $rpl_allow_error=1 will prevent this file from failing if
+# there is an error in the IO thread.
+# (If an error is _always_ expected, a better alternative might be to
+# use wait_for_slave_io_error.inc instead of this file).
+# Note: This is currently always enabled, since a simple STOP SLAVE
+# IO_THREAD can cause an error if it interrupts the slave's initial
+# communication with the master (MDEV-32892).
+#
# $rpl_debug
# See include/rpl_init.inc
@@ -31,9 +42,15 @@
--let $slave_param= Slave_IO_Running
--let $slave_param_value= No
---let $slave_error_param= Last_IO_Errno
+--let $_io_stop_save_allow_error= $slave_error_param
+# Disabled, as IO errors are left behind when a normal STOP SLAVE interrupts
+# the initial communication between the IO thread and the master (MDEV-32892).
+#if (!$rpl_allow_error)
+#{
+# --let $slave_error_param= Last_IO_Errno
+#}
--source include/wait_for_slave_param.inc
---let $slave_error_param=
+--let $slave_error_param= $_io_stop_save_allow_error
--let $include_filename= wait_for_slave_io_to_stop.inc
diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc
index b06dee3c..ed81c559 100644
--- a/mysql-test/include/wait_for_slave_param.inc
+++ b/mysql-test/include/wait_for_slave_param.inc
@@ -35,7 +35,7 @@
# $slave_error_param
# If set, this script will check if the column of the output from
# SHOW SLAVE STATUS named $slave_error_param is nonzero. If it is,
-# this script will faile immediately. Typically, this should be set
+# this script will fail immediately. Typically, this should be set
# to Last_IO_Errno or Last_SQL_Errno.
#
# $rpl_debug
@@ -56,11 +56,6 @@ if (!$_slave_timeout)
}
}
-if ($slave_error_param == '')
-{
- --let $slave_error_param= 1
-}
-
let $_slave_param_comparison= $slave_param_comparison;
if (!$_slave_param_comparison)
{
@@ -90,7 +85,7 @@ while ($_slave_continue)
--let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1)
# Check if an error condition is reached.
- if (!$slave_error_param)
+ if ($slave_error_param)
{
--let $_show_slave_status_error_value= query_get_value("SHOW SLAVE STATUS", $slave_error_param, 1)
if ($_show_slave_status_error_value)
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 492b3237..0a05464c 100644
--- a/mysql-test/include/wait_for_slave_sql_to_stop.inc
+++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc
@@ -21,6 +21,14 @@
# $slave_timeout
# See include/wait_for_slave_param.inc
#
+# $rpl_allow_error
+# By default, this file fails if there is an error in the SQL
+# thread. However, if an error in the SQL thread is possible and allowed,
+# setting $rpl_allow_error=1 will prevent this file from failing if
+# there is an error in the SQL thread.
+# (If an error is _always_ expected, a better alternative might be to
+# use wait_for_slave_sql_error.inc instead of this file).
+#
# $rpl_debug
# See include/rpl_init.inc
@@ -31,7 +39,10 @@
--let $slave_param= Slave_SQL_Running
--let $slave_param_value= No
---let $slave_error_param= Last_SQL_Errno
+if (!$rpl_allow_error)
+{
+ --let $slave_error_param= Last_SQL_Errno
+}
--source include/wait_for_slave_param.inc
--let $slave_error_param=