diff options
Diffstat (limited to 'mysql-test')
75 files changed, 1495 insertions, 1504 deletions
diff --git a/mysql-test/lib/My/Debugger.pm b/mysql-test/lib/My/Debugger.pm new file mode 100644 index 00000000000..2bbffc89f1a --- /dev/null +++ b/mysql-test/lib/My/Debugger.pm @@ -0,0 +1,265 @@ +package My::Debugger; + +use strict; +use warnings; +use Text::Wrap; +use Cwd; +use My::Platform; + +# 1. options to support: +# --xxx[=ARGS] +# --manual-xxx[=ARGS] +# --client-xxx[=ARGS] +# --boot-xxx[=ARGS] +# TODO --manual-client-xxx[=ARGS] +# TODO --manual-boot-xxx[=ARGS] +# TODO --exec-xxx[=ARGS] (for $ENV{MYSQL}, etc) +# +# ARGS is a semicolon-separated list of commands for the +# command file. If the first command starts from '-' it'll +# be for a command line, not for a command file. +# +# 2. terminal to use: xterm +# TODO MTR_TERM="xterm -title {title} -e {command}" +# +# 3. debugger combinations are *not allowed* +# (thus no --valgrind --gdb) +# +# 4. variables for the command line / file templates: +# {vardir} -> vardir +# {exe} -> /path/to/binary/to/execute +# {args} -> command-line arguments, "-quoted +# {input} +# {type} -> client, mysqld.1, etc +# {script} -> vardir/tmp/{debugger}init.$type +# {log} -> vardir/log/$type.{debugger} +# {options} -> user options for the debugger. +# +# if {options} isn't used, they're auto-placed before {exe} +# or at the end if no {exe} + +my %debuggers = ( + gdb => { + term => 1, + options => '-x {script} {exe}', + script => 'set args {args} < {input}', + }, + ddd => { + options => '--command {script} {exe}', + script => 'set args {args} < {input}', + }, + dbx => { + term => 1, + options => '-c "stop in main; run {exe} {args} < {input}"', + }, + devenv => { + options => '/debugexe {exe} {args}', + }, + windbg => { + options => '{exe} {args}', + }, + lldb => { + term => 1, + options => '-s {script} {exe}', + script => 'process launch --stop-at-entry {args}', + }, + valgrind => { + options => '--tool=memcheck --show-reachable=yes --leak-check=yes --num-callers=16 --quiet --suppressions='.cwd().'/valgrind.supp {exe} {args} --loose-wait-for-pos-timeout=1500', + pre => sub { + my $debug_libraries_path= "/usr/lib/debug"; + $ENV{LD_LIBRARY_PATH} .= ":$debug_libraries_path" if -d $debug_libraries_path; + } + }, + strace => { + options => '-f -o {log} {exe} {args}', + }, + rr => { + options => 'record -o {log} {exe} {args}', + pre => sub { + ::mtr_error('rr requires kernel.perf_event_paranoid <= 1') + if ::mtr_grab_file('/proc/sys/kernel/perf_event_paranoid') > 1; + } + }, + valgdb => { + term => 1, + run => 'gdb', + options => '-x {script} {exe}', + script => <<EEE, +py +import subprocess,shlex,time +valg=subprocess.Popen(shlex.split("""valgrind --tool=memcheck --show-reachable=yes --leak-check=yes --num-callers=16 --quiet --suppressions=valgrind.supp --vgdb-error=0 {exe} {args} --loose-wait-for-pos-timeout=1500""")) +time.sleep(2) +gdb.execute("target remote | /usr/lib64/valgrind/../../bin/vgdb --pid=" + str(valg.pid)) +EEE + pre => sub { + my $debug_libraries_path= "/usr/lib/debug"; + $ENV{LD_LIBRARY_PATH} .= ":$debug_libraries_path" if -d $debug_libraries_path; + } + }, + + # aliases + vsjitdebugger => 'windbg', + ktrace => 'strace', +); + +my %opts; +my %opt_vals; +my $help = "\n\nOptions for running debuggers\n\n"; + +for my $k (sort keys %debuggers) { + my $v = $debuggers{$k}; + $v = $debuggers{$k} = $debuggers{$v} if not ref $v; # resolve aliases + + sub register_opt($$) { + my ($name, $msg) = @_; + $opts{"$name=s"} = \$opt_vals{$name}; + $help .= wrap(sprintf(" %-23s", $name), ' 'x25, "$msg under $name\n"); + } + + $v->{script} = '' unless $v->{script}; + $v->{options} =~ s/(\{exe\}|$)/ {options} $&/ unless $v->{options} =~ /\{options\}/; + + register_opt "$k" => "Start mariadbd"; + register_opt "client-$k" => "Start mariadb-test client"; + register_opt "boot-$k" => "Start bootstrap server"; + register_opt "manual-$k" => "Before running test(s) let user manually start mariadbd"; +} + +sub subst($%) { + use warnings FATAL => 'uninitialized'; + my ($templ, %vars) = @_; + $templ =~ s/\{(\w+)\}/$vars{$1}/g; + $templ; +} + +sub do_args($$$$$) { + my ($args, $exe, $input, $type, $opt) = @_; + my $k = $opt =~ /^(?:client|boot|manual)-(.*)$/ ? $1 : $opt; + my $v = $debuggers{$k}; + + # on windows mtr args are quoted (for system), otherwise not (for exec) + sub quote($) { $_[0] =~ / / ? "\"$_[0]\"" : $_[0] } + sub unquote($) { $_[0] =~ s/^"(.*)"$/$1/; $_[0] } + sub quote_from_mtr($) { IS_WINDOWS() ? $_[0] : quote($_[0]) } + sub unquote_for_mtr($) { IS_WINDOWS() ? $_[0] : unquote($_[0]) } + + my %vars = ( + vardir => $::opt_vardir, + exe => $$exe, + args => join(' ', map { quote_from_mtr $_ } @$$args, '--gdb'), + input => $input, + script => "$::opt_vardir/tmp/${k}init.$type", + log => "$::opt_vardir/log/$type.$k", + options => '', + ); + my @params = split /;/, $opt_vals{$opt}; + $vars{options} = shift @params if @params and $params[0] =~ /^-/; + + my $script = join "\n", @params; + if ($v->{script}) { + ::mtr_tofile($vars{script}, subst($v->{script}, %vars)."\n".$script); + } elsif ($script) { + die "$k is not using a script file, nowhere to write the script \n---\n$script\n---\n"; + } + + my $options = subst($v->{options}, %vars); + @$$args = map { unquote_for_mtr $_ } $options =~ /("[^"]+"|\S+)/g; + my $run = $v->{run} || $k; + + if ($opt =~ /^manual-/) { + print "\nTo start $k for $type, type in another window:\n"; + print "$run $options\n"; + $$exe= undef; # Indicate the exe should not be started + } elsif ($v->{term}) { + unshift @$$args, '-title', $type, '-e', $run; + $$exe = 'xterm'; + } else { + $$exe = $run; + } +} + +sub options() { %opts } +sub help() { $help } + +sub fix_options(@) { + my $re=join '|', keys %opts; + $re =~ s/=s//g; + map { $_ . (/^--($re)$/ and '=;') } @_; +} + +sub pre_setup() { + my $used; + for my $k (keys %debuggers) { + for my $opt ($k, "manual-$k", "boot-$k", "client-$k") { + if ($opt_vals{$opt}) + { + $used = 1; + if ($debuggers{$k}->{pre}) { + $debuggers{$k}->{pre}->(); + delete $debuggers{$k}->{pre}; + } + } + } + } + + if ($used) { + $ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || ''); + ::mtr_error("Can't use --extern when using debugger") if $ENV{USE_RUNNING_SERVER}; + + $::opt_retry= 1; + $::opt_retry_failure= 1; + $::opt_testcase_timeout= 7 * 24 * 60; # in minutes + $::opt_suite_timeout= 7 * 24 * 60; # in minutes + $::opt_shutdown_timeout= 24 * 60 *60; # in seconds + $::opt_start_timeout= 24 * 60 * 60; # in seconds + } +} + +sub setup_boot_args($$$) { + my ($args, $exe, $input) = @_; + my $found; + + for my $k (keys %debuggers) { + if ($opt_vals{"boot-$k"}) { + die "--boot-$k and --$found cannot be used at the same time\n" if $found; + + $found="boot-$k"; + do_args($args, $exe, $input, 'bootstrap', $found); + } + } +} + +sub setup_client_args($$) { + my ($args, $exe) = @_; + my $found; + my $embedded = $::opt_embedded_server ? ' with --embedded' : ''; + + for my $k (keys %debuggers) { + my @opt_names=("client-$k"); + push @opt_names, $k if $embedded; + for my $opt (@opt_names) { + if ($opt_vals{$opt}) { + die "--$opt and --$found cannot be used at the same time$embedded\n" if $found; + $found=$opt; + do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', 'client', $found); + } + } + } +} + +sub setup_args($$$) { + my ($args, $exe, $type) = @_; + my $found; + + for my $k (keys %debuggers) { + for my $opt ($k, "manual-$k") { + if ($opt_vals{$opt}) { + die "--$opt and --$found cannot be used at the same time\n" if $found; + $found=$opt; + do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', $type, $found); + } + } + } +} + +1; diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result index ca65c66ea41..0d2c2e6acbc 100644 --- a/mysql-test/main/default.result +++ b/mysql-test/main/default.result @@ -3388,3 +3388,18 @@ ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT' DROP TABLE t1; # end of 10.2 test +# +# MDEV-22703 DEFAULT() on a BLOB column can overwrite the default +# record, which can cause crashes when accessing already released +# memory. +# +CREATE TEMPORARY TABLE t1 (h POINT DEFAULT ST_GEOMFROMTEXT('Point(1 1)')) ENGINE=InnoDB; +INSERT INTO t1 () VALUES (),(); +ALTER TABLE t1 FORCE; +SELECT DEFAULT(h) FROM t1; +SELECT length(DEFAULT(h)) FROM t1; +length(DEFAULT(h)) +25 +25 +INSERT INTO t1 () VALUES (); +drop table t1; diff --git a/mysql-test/main/default.test b/mysql-test/main/default.test index 27e38eeeb49..c0561deac67 100644 --- a/mysql-test/main/default.test +++ b/mysql-test/main/default.test @@ -1,3 +1,5 @@ +--source include/have_innodb.inc + # # test of already fixed bugs # @@ -2107,5 +2109,20 @@ CREATE OR REPLACE TABLE t1(i int); ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`; DROP TABLE t1; - --echo # end of 10.2 test + +--echo # +--echo # MDEV-22703 DEFAULT() on a BLOB column can overwrite the default +--echo # record, which can cause crashes when accessing already released +--echo # memory. +--echo # + +CREATE TEMPORARY TABLE t1 (h POINT DEFAULT ST_GEOMFROMTEXT('Point(1 1)')) ENGINE=InnoDB; +INSERT INTO t1 () VALUES (),(); +ALTER TABLE t1 FORCE; +--disable_result_log +SELECT DEFAULT(h) FROM t1; +--enable_result_log +SELECT length(DEFAULT(h)) FROM t1; +INSERT INTO t1 () VALUES (); +drop table t1; diff --git a/mysql-test/main/flush_and_binlog.result b/mysql-test/main/flush_and_binlog.result new file mode 100644 index 00000000000..b9560964046 --- /dev/null +++ b/mysql-test/main/flush_and_binlog.result @@ -0,0 +1,22 @@ +# +# MDEV-23843 Assertions in Diagnostics_area upon table operations under +# FTWRL +# +CREATE TABLE t1 (a INT); +FLUSH TABLES WITH READ LOCK; +connect con1,localhost,root,,; +SET lock_wait_timeout= 1; +OPTIMIZE TABLE t1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +UNLOCK TABLES; +DROP TABLE t1; +FLUSH TABLES WITH READ LOCK; +connect con1,localhost,root,,test; +SET lock_wait_timeout= 1; +FLUSH TABLES; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +disconnect con1; +unlock tables; diff --git a/mysql-test/main/flush_and_binlog.test b/mysql-test/main/flush_and_binlog.test new file mode 100644 index 00000000000..373b900b451 --- /dev/null +++ b/mysql-test/main/flush_and_binlog.test @@ -0,0 +1,29 @@ +--source include/have_log_bin.inc + +--echo # +--echo # MDEV-23843 Assertions in Diagnostics_area upon table operations under +--echo # FTWRL +--echo # + +CREATE TABLE t1 (a INT); +FLUSH TABLES WITH READ LOCK; +--connect (con1,localhost,root,,) +SET lock_wait_timeout= 1; +--error ER_LOCK_WAIT_TIMEOUT +OPTIMIZE TABLE t1; +# Cleanup +--disconnect con1 +--connection default +UNLOCK TABLES; +DROP TABLE t1; +# +# Second test case from MDEV_23843 +# +FLUSH TABLES WITH READ LOCK; +--connect (con1,localhost,root,,test) +SET lock_wait_timeout= 1; +--error ER_LOCK_WAIT_TIMEOUT +FLUSH TABLES; +--connection default +--disconnect con1 +unlock tables; diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index 4b34fbed02c..fcaa0a921c9 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -2325,5 +2325,18 @@ group by f; f drop table t1; # +# MDEV-24929 Server crash in thr_multi_unlock or in +# get_schema_tables_result upon select from I_S with joins +# +CREATE TABLE t1 (a TIMESTAMP, KEY (a)); +INSERT INTO t1 VALUES ('2012-12-12'),('2021-11-11'); +SELECT count(*) FROM t1 AS t1a LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.ROUTINES) ON (t1b.a IS NULL); +count(*) +2 +SELECT count(*) FROM t1 AS t1a LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.PROFILING) ON (t1b.a IS NULL); +count(*) +2 +DROP TABLE t1; +# # End of 10.3 tests # diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test index 59704803175..5879f910e4d 100644 --- a/mysql-test/main/information_schema.test +++ b/mysql-test/main/information_schema.test @@ -2033,5 +2033,15 @@ group by f; drop table t1; --echo # +--echo # MDEV-24929 Server crash in thr_multi_unlock or in +--echo # get_schema_tables_result upon select from I_S with joins +--echo # + +CREATE TABLE t1 (a TIMESTAMP, KEY (a)); +INSERT INTO t1 VALUES ('2012-12-12'),('2021-11-11'); +SELECT count(*) FROM t1 AS t1a LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.ROUTINES) ON (t1b.a IS NULL); +SELECT count(*) FROM t1 AS t1a LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.PROFILING) ON (t1b.a IS NULL); +DROP TABLE t1; +--echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result index 5708cf88934..4c502a46981 100644 --- a/mysql-test/main/innodb_ext_key.result +++ b/mysql-test/main/innodb_ext_key.result @@ -799,6 +799,21 @@ EXPLAIN } drop table t1; SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +# +# MDEV-11172: EXPLAIN shows non-sensical value for key_len with type=index +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +CREATE TABLE t2 ( +pk VARCHAR(50), +a VARCHAR(20), +KEY k1(a), +PRIMARY KEY(pk) +)ENGINE=INNODB; +INSERT INTO t2 SELECT a,a FROM t1; +EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL k1 23 NULL 10 Using index +DROP TABLE t1,t2; set global innodb_stats_persistent= @innodb_stats_persistent_save; -set global innodb_stats_persistent_sample_pages= -@innodb_stats_persistent_sample_pages_save; +set global innodb_stats_persistent_sample_pages= @innodb_stats_persistent_sample_pages_save; diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index 5fcf6a309b9..70d0009af27 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -624,6 +624,25 @@ select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and drop table t1; SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; + +--echo # +--echo # MDEV-11172: EXPLAIN shows non-sensical value for key_len with type=index +--echo # + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +CREATE TABLE t2 ( + pk VARCHAR(50), + a VARCHAR(20), + KEY k1(a), + PRIMARY KEY(pk) +)ENGINE=INNODB; + +INSERT INTO t2 SELECT a,a FROM t1; +EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1); + +DROP TABLE t1,t2; + set global innodb_stats_persistent= @innodb_stats_persistent_save; -set global innodb_stats_persistent_sample_pages= - @innodb_stats_persistent_sample_pages_save; +set global innodb_stats_persistent_sample_pages= @innodb_stats_persistent_sample_pages_save; diff --git a/mysql-test/main/lock_user.result b/mysql-test/main/lock_user.result index 3ee8bbf2296..24fff2105ab 100644 --- a/mysql-test/main/lock_user.result +++ b/mysql-test/main/lock_user.result @@ -156,6 +156,7 @@ alter user user1@localhost PASSWORD EXPIRE NEVER ACCOUNT UNLOCK ; show create user user1@localhost; CREATE USER for user1@localhost CREATE USER `user1`@`localhost` PASSWORD EXPIRE +ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER alter user user1@localhost ACCOUNT LOCK PASSWORD EXPIRE DEFAULT; show create user user1@localhost; CREATE USER for user1@localhost @@ -167,5 +168,6 @@ localhost user1 {"access":0,"version_id":XXX,"plugin":"mysql_native_password","a show create user user1@localhost; CREATE USER for user1@localhost CREATE USER `user1`@`localhost` PASSWORD EXPIRE +ALTER USER `user1`@`localhost` PASSWORD EXPIRE INTERVAL 60 DAY drop user user1@localhost; drop user user2@localhost; diff --git a/mysql-test/main/password_expiration.result b/mysql-test/main/password_expiration.result index d05f6b3b5d0..897811bb4ad 100644 --- a/mysql-test/main/password_expiration.result +++ b/mysql-test/main/password_expiration.result @@ -125,6 +125,7 @@ alter user user1@localhost password expire; show create user user1@localhost; CREATE USER for user1@localhost CREATE USER `user1`@`localhost` PASSWORD EXPIRE +ALTER USER `user1`@`localhost` PASSWORD EXPIRE INTERVAL 123 DAY set password for user1@localhost= password(''); show create user user1@localhost; CREATE USER for user1@localhost @@ -151,10 +152,12 @@ alter user user1@localhost password expire; show create user user1@localhost; CREATE USER for user1@localhost CREATE USER `user1`@`localhost` PASSWORD EXPIRE +ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER flush privileges; show create user user1@localhost; CREATE USER for user1@localhost CREATE USER `user1`@`localhost` PASSWORD EXPIRE +ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER set password for user1@localhost= password(''); alter user user1@localhost password expire default; show create user user1@localhost; @@ -184,10 +187,12 @@ alter user user1@localhost password expire; show create user user1@localhost; CREATE USER for user1@localhost CREATE USER `user1`@`localhost` PASSWORD EXPIRE +ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER flush privileges; show create user user1@localhost; CREATE USER for user1@localhost CREATE USER `user1`@`localhost` PASSWORD EXPIRE +ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER set global disconnect_on_expired_password=ON; connect(localhost,user1,,test,MYSQL_PORT,MYSQL_SOCK); connect con1,localhost,user1; diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index d97720c2d41..b7e126e5061 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -5485,6 +5485,18 @@ ERROR HY000: Default/ignore value is not supported for such parameter usage EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0; Database # +# MDEV-24779: main.subselect fails in buildbot with --ps-protocol +# +CREATE TABLE t1(a INT); +PREPARE stmt FROM "SELECT EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))"; +EXECUTE stmt; +EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1)) +0 +EXECUTE stmt; +EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1)) +0 +DROP TABLE t1; +# # End of 10.2 tests # # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index e702cb76bbb..6a109951d0e 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -4932,6 +4932,16 @@ EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT; EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0; --echo # +--echo # MDEV-24779: main.subselect fails in buildbot with --ps-protocol +--echo # + +CREATE TABLE t1(a INT); +PREPARE stmt FROM "SELECT EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))"; +EXECUTE stmt; +EXECUTE stmt; +DROP TABLE t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/selectivity.result b/mysql-test/main/selectivity.result index 591294aff10..40ab309fffd 100644 --- a/mysql-test/main/selectivity.result +++ b/mysql-test/main/selectivity.result @@ -1882,4 +1882,62 @@ a b set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; drop table t1; # End of 10.1 tests +# +# MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect +# +SET optimizer_use_condition_selectivity=4; +SET histogram_size=255; +CREATE TABLE t1 (a BIT(32), b INT); +INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.41 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` >= 81 +SELECT HEX(a), b from t1 where t1.a >= 81; +HEX(a) b +51 81 +52 82 +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +DROP TABLE t1; +# +# MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3 +# +CREATE TABLE t1(a int); +INSERT INTO t1 values (1),(2),(2),(3),(4); +SET optimizer_use_condition_selectivity=4; +SET histogram_size= 255; +set use_stat_tables='preferably'; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 39.84 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +SET optimizer_use_condition_selectivity=3; +# filtered should show 25 % +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +FLUSH TABLES; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; +DROP TABLE t1; +# End of 10.2 tests set @@global.histogram_size=@save_histogram_size; diff --git a/mysql-test/main/selectivity.test b/mysql-test/main/selectivity.test index 2a0cc823eb4..1d96dc0bf80 100644 --- a/mysql-test/main/selectivity.test +++ b/mysql-test/main/selectivity.test @@ -1281,6 +1281,51 @@ drop table t1; --echo # End of 10.1 tests +--echo # +--echo # MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect +--echo # + +SET optimizer_use_condition_selectivity=4; +SET histogram_size=255; +CREATE TABLE t1 (a BIT(32), b INT); +INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81; +SELECT HEX(a), b from t1 where t1.a >= 81; + +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +DROP TABLE t1; + +--echo # +--echo # MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3 +--echo # + +CREATE TABLE t1(a int); +INSERT INTO t1 values (1),(2),(2),(3),(4); +SET optimizer_use_condition_selectivity=4; +SET histogram_size= 255; + +set use_stat_tables='preferably'; + +ANALYZE TABLE t1 PERSISTENT FOR ALL; + +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +SET optimizer_use_condition_selectivity=3; + +--echo # filtered should show 25 % +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +FLUSH TABLES; + +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; + +DROP TABLE t1; + +--echo # End of 10.2 tests + # # Clean up # diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result index 7a8f837d4e2..46723410b75 100644 --- a/mysql-test/main/selectivity_innodb.result +++ b/mysql-test/main/selectivity_innodb.result @@ -1892,6 +1892,64 @@ a b set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; drop table t1; # End of 10.1 tests +# +# MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect +# +SET optimizer_use_condition_selectivity=4; +SET histogram_size=255; +CREATE TABLE t1 (a BIT(32), b INT); +INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.41 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` >= 81 +SELECT HEX(a), b from t1 where t1.a >= 81; +HEX(a) b +51 81 +52 82 +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +DROP TABLE t1; +# +# MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3 +# +CREATE TABLE t1(a int); +INSERT INTO t1 values (1),(2),(2),(3),(4); +SET optimizer_use_condition_selectivity=4; +SET histogram_size= 255; +set use_stat_tables='preferably'; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 39.84 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +SET optimizer_use_condition_selectivity=3; +# filtered should show 25 % +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +FLUSH TABLES; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; +DROP TABLE t1; +# End of 10.2 tests set @@global.histogram_size=@save_histogram_size; set optimizer_switch=@save_optimizer_switch_for_selectivity_test; set @tmp_ust= @@use_stat_tables; diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index 44b879ae33b..90550058dd9 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -2687,6 +2687,15 @@ f bar DROP TABLE t1, t2; # +# MDEV-23449: alias do not exist and a query do not report an error +# +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); +SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id); +ERROR 42S22: Unknown column 's.id' in 'group statement' +DROP TABLE t1; +# End of 10.2 tests +# # MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init # CREATE TABLE t1 (i1 int,v1 varchar(1),KEY (v1,i1)); @@ -2717,7 +2726,6 @@ Warnings: Warning 1931 Query execution was interrupted. The query examined at least 3020 rows, which exceeds LIMIT ROWS EXAMINED (500). The query result may be incomplete SET join_cache_level= @save_join_cache_level; DROP TABLE t1,t2,t3,t4; -# End of 10.2 tests # # MDEV-21265: IN predicate conversion to IN subquery should be allowed for a broader set of datatype comparison # diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test index d46bb846a9e..423353fe677 100644 --- a/mysql-test/main/subselect4.test +++ b/mysql-test/main/subselect4.test @@ -2202,6 +2202,19 @@ SELECT * FROM t2; DROP TABLE t1, t2; --echo # +--echo # MDEV-23449: alias do not exist and a query do not report an error +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); + +--error ER_BAD_FIELD_ERROR +SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id); +DROP TABLE t1; + +--echo # End of 10.2 tests + +--echo # --echo # MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init --echo # @@ -2236,9 +2249,6 @@ from t2 join t1 on SET join_cache_level= @save_join_cache_level; DROP TABLE t1,t2,t3,t4; - ---echo # End of 10.2 tests - --echo # --echo # MDEV-21265: IN predicate conversion to IN subquery should be allowed for a broader set of datatype comparison --echo # diff --git a/mysql-test/main/system_mysql_db_507.result b/mysql-test/main/system_mysql_db_507.result index 2d68dc82529..8069405aa3a 100644 --- a/mysql-test/main/system_mysql_db_507.result +++ b/mysql-test/main/system_mysql_db_507.result @@ -214,6 +214,7 @@ alter user user@localhost password expire; show create user user@localhost; CREATE USER for user@localhost CREATE USER `user`@`localhost` PASSWORD EXPIRE +ALTER USER `user`@`localhost` PASSWORD EXPIRE INTERVAL 123 DAY set password for user@localhost= password(''); show create user user@localhost; CREATE USER for user@localhost diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result index c2269f0862b..7ab9666c373 100644 --- a/mysql-test/main/table_value_constr.result +++ b/mysql-test/main/table_value_constr.result @@ -2675,6 +2675,107 @@ values ((select min(a), max(b) from t1)); ERROR 21000: Operand should contain 1 column(s) drop table t1; # +# MDEV-24840: union of TVCs in IN subquery +# +create table t1 (a int) engine=myisam; +insert into t1 values (3), (7), (1); +select a from t1 where a in (values (7) union values (8)); +a +7 +explain extended select a from t1 where a in (values (7) union values (8)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +4 DEPENDENT SUBQUERY <derived2> ref key0 key0 4 func 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 DEPENDENT UNION <derived3> ref key0 key0 4 func 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`7` union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`8`))) +prepare stmt from "select a from t1 where a in (values (7) union values (8))"; +execute stmt; +a +7 +execute stmt; +a +7 +deallocate prepare stmt; +select a from t1 where a not in (values (7) union values (8)); +a +3 +1 +explain extended select a from t1 where a not in (values (7) union values (8)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +4 DEPENDENT SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 DEPENDENT UNION <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`7`) union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`8`)))) +select a from t1 where a < all(values (7) union values (8)); +a +3 +1 +explain extended select a from t1 where a < all(values (7) union values (8)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 UNION <derived3> ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <not>(<in_optimizer>(`test`.`t1`.`a`,<min>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0`) <= <cache>(`test`.`t1`.`a`))) +select a from t1 where a >= any(values (7) union values (8)); +a +7 +explain extended select a from t1 where a >= any(values (7) union values (8)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 UNION <derived3> ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <nop>(<in_optimizer>(`test`.`t1`.`a`,<min>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0`) <= <cache>(`test`.`t1`.`a`))) +drop table t1; +# +# MDEV-24934:EXPLAIN for queries based on TVC using subqueries +# +create table t1 (a int); +insert into t1 values (3), (7), (1); +values (8), ((select * from t1 where a between 2 and 4)); +8 +8 +3 +explain values (8), ((select * from t1 where a between 2 and 4)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +values ((select * from t1 where a between 2 and 4)), +((select * from t1 where a > 10)); +(select * from t1 where a between 2 and 4) +3 +NULL +explain values ((select * from t1 where a between 2 and 4)), +((select * from t1 where a > 10)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +values (10,11), ((select * from t1 where a = 7) + 1, 21); +10 11 +10 11 +8 21 +explain values (10,11), ((select * from t1 where a = 7) + 1, 21); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +drop table t1; +# # End of 10.3 tests # # diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index fc0288d3fa0..66463cb1f1a 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -1402,6 +1402,64 @@ values ((select min(a), max(b) from t1)); drop table t1; --echo # +--echo # MDEV-24840: union of TVCs in IN subquery +--echo # + +create table t1 (a int) engine=myisam; +insert into t1 values (3), (7), (1); + +let $q= +select a from t1 where a in (values (7) union values (8)); +eval $q; +eval explain extended $q; +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +let $q= +select a from t1 where a not in (values (7) union values (8)); +eval $q; +eval explain extended $q; + +let $q= +select a from t1 where a < all(values (7) union values (8)); +eval $q; +eval explain extended $q; + +let $q= +select a from t1 where a >= any(values (7) union values (8)); +eval $q; +eval explain extended $q; + +drop table t1; + +--echo # +--echo # MDEV-24934:EXPLAIN for queries based on TVC using subqueries +--echo # + +create table t1 (a int); +insert into t1 values (3), (7), (1); + +let $q1= +values (8), ((select * from t1 where a between 2 and 4)); +eval $q1; +eval explain $q1; + +let $q2= +values ((select * from t1 where a between 2 and 4)), + ((select * from t1 where a > 10)); +eval $q2; +eval explain $q2; + +let $q3= +values (10,11), ((select * from t1 where a = 7) + 1, 21); +eval $q3; +eval explain $q3; + +drop table t1; + +--echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/type_decimal.result b/mysql-test/main/type_decimal.result index 6e7d7c8b6fe..0228652f74c 100644 --- a/mysql-test/main/type_decimal.result +++ b/mysql-test/main/type_decimal.result @@ -176,9 +176,8 @@ Note 1265 Data truncated for column 'a' at row 2 insert ignore into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809"); Warnings: Warning 1264 Out of range value for column 'a' at row 1 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2 +Warning 1264 Out of range value for column 'a' at row 2 Note 1265 Data truncated for column 'a' at row 3 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4 insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: Warning 1265 Data truncated for column 'a' at row 1 @@ -209,7 +208,7 @@ a 99999999.99 0.00 99999999.99 -0.00 +99999999.99 0.00 0.00 123.40 @@ -1078,6 +1077,90 @@ t1 CREATE TABLE `t1` ( DROP TABLE t1; DROP TABLE t1dec102; # +# MDEV-24790 CAST('0e1111111111' AS DECIMAL(38,0)) returns a wrong result +# +SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a; +a +0 +SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a; +a +0 +SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a; +a +99999999999999999999999999999999999999 +Warnings: +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '.00000000000000000000000000000000000001e111111111111111111111' +Warning 1264 Out of range value for column 'a' at row 1 +CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128)); +INSERT INTO t1 VALUES +('0e111111111111111111111', 'Zero mantissa and a huge positive exponent'), +('1e111111111111111111111', 'Non-zero mantissa, huge positive exponent'), +('0e-111111111111111111111', 'Zero mantissa and a huge negative exponent'), +('1e-111111111111111111111', 'Non-zero mantissa and a huge negative exponent'); +BEGIN NOT ATOMIC +DECLARE done INT DEFAULT FALSE; +DECLARE vstr, vcomment VARCHAR(128); +DECLARE cur1 CURSOR FOR SELECT str, comment FROM t1 ORDER BY str; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; +OPEN cur1; +read_loop: +LOOP +FETCH cur1 INTO vstr, vcomment; +IF done THEN +LEAVE read_loop; +END IF; +SELECT vstr AS `--------`, vcomment AS `--------`; +SELECT CAST(str AS DECIMAL(38,0)) FROM t1 WHERE str=vstr; +SHOW WARNINGS; +SELECT CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) FROM t1 WHERE str=vstr; +SHOW WARNINGS; +END LOOP; +END; +$$ +-------- -------- +0e-111111111111111111111 Zero mantissa and a huge negative exponent +CAST(str AS DECIMAL(38,0)) +0 +Level Code Message +CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) +0 +Level Code Message +Warning 1292 Truncated incorrect DECIMAL value: '0e-111111111111111111111garbage' +-------- -------- +0e111111111111111111111 Zero mantissa and a huge positive exponent +CAST(str AS DECIMAL(38,0)) +0 +Level Code Message +CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) +0 +Level Code Message +Warning 1292 Truncated incorrect DECIMAL value: '0e111111111111111111111garbage' +-------- -------- +1e-111111111111111111111 Non-zero mantissa and a huge negative exponent +CAST(str AS DECIMAL(38,0)) +0 +Level Code Message +CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) +0 +Level Code Message +Warning 1292 Truncated incorrect DECIMAL value: '1e-111111111111111111111garbage' +-------- -------- +1e111111111111111111111 Non-zero mantissa, huge positive exponent +CAST(str AS DECIMAL(38,0)) +99999999999999999999999999999999999999 +Level Code Message +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111' +Warning 1264 Out of range value for column 'CAST(str AS DECIMAL(38,0))' at row 1 +CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) +99999999999999999999999999999999999999 +Level Code Message +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111garbage' +Warning 1264 Out of range value for column 'CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))' at row 1 +DROP TABLE t1; +# # End of 10.2 tests # # diff --git a/mysql-test/main/type_decimal.test b/mysql-test/main/type_decimal.test index 4ffbcbd3288..1076592fe62 100644 --- a/mysql-test/main/type_decimal.test +++ b/mysql-test/main/type_decimal.test @@ -670,6 +670,50 @@ DROP TABLE t1; DROP TABLE t1dec102; --echo # +--echo # MDEV-24790 CAST('0e1111111111' AS DECIMAL(38,0)) returns a wrong result +--echo # + +SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a; +SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a; +SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a; + +CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128)); +INSERT INTO t1 VALUES +('0e111111111111111111111', 'Zero mantissa and a huge positive exponent'), +('1e111111111111111111111', 'Non-zero mantissa, huge positive exponent'), +('0e-111111111111111111111', 'Zero mantissa and a huge negative exponent'), +('1e-111111111111111111111', 'Non-zero mantissa and a huge negative exponent'); + +# The loop below issues SHOW WARNINGS manually, disable automatic warnings +--disable_warnings +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE done INT DEFAULT FALSE; + DECLARE vstr, vcomment VARCHAR(128); + DECLARE cur1 CURSOR FOR SELECT str, comment FROM t1 ORDER BY str; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + OPEN cur1; +read_loop: + LOOP + FETCH cur1 INTO vstr, vcomment; + IF done THEN + LEAVE read_loop; + END IF; + SELECT vstr AS `--------`, vcomment AS `--------`; + SELECT CAST(str AS DECIMAL(38,0)) FROM t1 WHERE str=vstr; + SHOW WARNINGS; + SELECT CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) FROM t1 WHERE str=vstr; + SHOW WARNINGS; + END LOOP; +END; +$$ +DELIMITER ;$$ +--enable_warnings + + +DROP TABLE t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index e9be123baa6..4585f370c1d 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -6777,6 +6777,21 @@ DROP PROCEDURE sp1; DROP VIEW v1; DROP TABLE t1, t2; # +# MDEV-23291: SUM column from a derived table returns invalid values +# +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2); +CREATE view v1 AS +SELECT a as x, (select x) as y, (select y) as z FROM t1; +SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q; +sum(z) +3 +SELECT sum(z) FROM v1; +sum(z) +3 +DROP TABLE t1; +DROP VIEW v1; +# # End of 10.2 tests # # diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index b1074264bef..78ab6a98ebb 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -6485,6 +6485,22 @@ DROP VIEW v1; DROP TABLE t1, t2; --echo # +--echo # MDEV-23291: SUM column from a derived table returns invalid values +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2); + +CREATE view v1 AS +SELECT a as x, (select x) as y, (select y) as z FROM t1; + +SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q; +SELECT sum(z) FROM v1; + +DROP TABLE t1; +DROP VIEW v1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index afe36961b59..f8b349f3239 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -48,9 +48,7 @@ BEGIN { "Could not find the lib/ directory \n"; exit(1); } -} -BEGIN { # Check backward compatibility support # By setting the environment variable MTR_VERSION # it's possible to use a previous version of @@ -94,6 +92,7 @@ use My::Tee; use My::Find; use My::SysInfo; use My::CoreDump; +use My::Debugger; use mtr_cases; use mtr_report; use mtr_match; @@ -110,6 +109,9 @@ require "mtr_io.pl"; require "mtr_gprof.pl"; require "mtr_misc.pl"; +my $opt_valgrind; +my $valgrind_reports= 0; + $SIG{INT}= sub { mtr_error("Got ^C signal"); }; $SIG{HUP}= sub { mtr_error("Hangup detected on controlling terminal"); }; @@ -266,28 +268,6 @@ our $opt_gcov; our $opt_gprof; our %gprof_dirs; -our $glob_debugger= 0; -our $opt_gdb; -my $opt_rr; -my $opt_rr_dir; -my @rr_record_args; -our $opt_client_gdb; -my $opt_boot_gdb; -my $opt_boot_rr; -our $opt_dbx; -our $opt_client_dbx; -my $opt_boot_dbx; -our $opt_ddd; -our $opt_client_ddd; -my $opt_boot_ddd; -our $opt_manual_gdb; -our $opt_manual_lldb; -our $opt_manual_dbx; -our $opt_manual_ddd; -our $opt_manual_debug; -our $opt_debugger; -our $opt_client_debugger; - my $config; # The currently running config my $current_config_name; # The currently running config file template @@ -313,52 +293,30 @@ our $opt_report_times= 0; my $opt_sleep; -my $opt_testcase_timeout= $ENV{MTR_TESTCASE_TIMEOUT} || 15; # minutes -my $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 360; # minutes -my $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds -my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds +our $opt_retry= 1; +our $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2); +our $opt_testcase_timeout= $ENV{MTR_TESTCASE_TIMEOUT} || 15; # minutes +our $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 360; # minutes +our $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds +our $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds sub suite_timeout { return $opt_suite_timeout * 60; }; my $opt_wait_all; -my $opt_wait_for_pos_timeout; my $opt_user_args; my $opt_repeat= 1; -my $opt_retry= 1; -my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2); my $opt_reorder= 1; my $opt_force_restart= 0; our $opt_user = "root"; -our $opt_valgrind= 0; -my $opt_valgrind_mysqld= 0; -my $opt_valgrind_mysqltest= 0; -my @valgrind_args; -my $opt_strace= 0; -my $opt_stracer; -my $opt_client_strace = 0; -my @strace_args; -my $opt_valgrind_path; -my $valgrind_reports= 0; -my $opt_callgrind; my %mysqld_logs; my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions. my $warn_seconds = 60; my $rebootstrap_re= '--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)|data[-_]file[-_]path|force_rebootstrap'; -sub testcase_timeout ($) { - my ($tinfo)= @_; - if (exists $tinfo->{'case-timeout'}) { - # Return test specific timeout if *longer* that the general timeout - my $test_to= $tinfo->{'case-timeout'}; - $test_to*= 10 if $opt_valgrind; - return $test_to * 60 if $test_to > $opt_testcase_timeout; - } - return $opt_testcase_timeout * 60; -} - +sub testcase_timeout ($) { return $opt_testcase_timeout * 60; } sub check_timeout ($) { return testcase_timeout($_[0]); } our $opt_warnings= 1; @@ -1011,7 +969,7 @@ sub run_worker ($) { } mark_time_used('restart'); my $valgrind_reports= 0; - if ($opt_valgrind_mysqld) { + if ($opt_valgrind) { $valgrind_reports= valgrind_exit_reports(); print $server "VALGREP\n" if $valgrind_reports; } @@ -1073,8 +1031,6 @@ sub print_global_resfile { resfile_global("debug", $opt_debug ? 1 : 0); resfile_global("gcov", $opt_gcov ? 1 : 0); resfile_global("gprof", $opt_gprof ? 1 : 0); - resfile_global("valgrind", $opt_valgrind ? 1 : 0); - resfile_global("callgrind", $opt_callgrind ? 1 : 0); resfile_global("mem", $opt_mem); resfile_global("tmpdir", $opt_tmpdir); resfile_global("vardir", $opt_vardir); @@ -1164,30 +1120,6 @@ sub command_line_setup { 'debug' => \$opt_debug, 'debug-common' => \$opt_debug_common, 'debug-server' => \$opt_debug_server, - 'gdb=s' => \$opt_gdb, - 'rr' => \$opt_rr, - 'rr-arg=s' => \@rr_record_args, - 'rr-dir=s' => \$opt_rr_dir, - 'client-gdb=s' => \$opt_client_gdb, - 'manual-gdb' => \$opt_manual_gdb, - 'manual-lldb' => \$opt_manual_lldb, - 'boot-gdb' => \$opt_boot_gdb, - 'boot-rr' => \$opt_boot_rr, - 'manual-debug' => \$opt_manual_debug, - 'ddd' => \$opt_ddd, - 'client-ddd' => \$opt_client_ddd, - 'manual-ddd' => \$opt_manual_ddd, - 'boot-ddd' => \$opt_boot_ddd, - 'dbx' => \$opt_dbx, - 'client-dbx' => \$opt_client_dbx, - 'manual-dbx' => \$opt_manual_dbx, - 'debugger=s' => \$opt_debugger, - 'boot-dbx' => \$opt_boot_dbx, - 'client-debugger=s' => \$opt_client_debugger, - 'strace' => \$opt_strace, - 'strace-option=s' => \@strace_args, - 'client-strace' => \$opt_client_strace, - 'stracer=s' => \$opt_stracer, 'max-save-core=i' => \$opt_max_save_core, 'max-save-datadir=i' => \$opt_max_save_datadir, 'max-test-fail=i' => \$opt_max_test_fail, @@ -1196,23 +1128,6 @@ sub command_line_setup { # Coverage, profiling etc 'gcov' => \$opt_gcov, 'gprof' => \$opt_gprof, - 'valgrind|valgrind-all' => \$opt_valgrind, - 'valgrind-mysqltest' => \$opt_valgrind_mysqltest, - 'valgrind-mysqld' => \$opt_valgrind_mysqld, - 'valgrind-options=s' => sub { - my ($opt, $value)= @_; - # Deprecated option unless it's what we know pushbuild uses - if ($value eq "--gen-suppressions=all --show-reachable=yes") { - push(@valgrind_args, $_) for (split(' ', $value)); - return; - } - die("--valgrind-options=s is deprecated. Use ", - "--valgrind-option=s, to be specified several", - " times if necessary"); - }, - 'valgrind-option=s' => \@valgrind_args, - 'valgrind-path=s' => \$opt_valgrind_path, - 'callgrind' => \$opt_callgrind, 'debug-sync-timeout=i' => \$opt_debug_sync_timeout, # Directories @@ -1232,7 +1147,6 @@ sub command_line_setup { 'verbose+' => \$opt_verbose, 'verbose-restart' => \&report_option, 'sleep=i' => \$opt_sleep, - 'wait-for-pos-timeout=i' => \$opt_wait_for_pos_timeout, 'start-dirty' => \$opt_start_dirty, 'start-and-exit' => \$opt_start_exit, 'start' => \$opt_start, @@ -1263,12 +1177,13 @@ sub command_line_setup { # list-options is internal, not listed in help 'list-options' => \$opt_list_options, 'skip-test-list=s' => \@opt_skip_test_list, - 'xml-report=s' => \$opt_xml_report + 'xml-report=s' => \$opt_xml_report, + + My::Debugger::options() ); # fix options (that take an optional argument and *only* after = sign - my %fixopt = ( '--gdb' => '--gdb=#', '--client-gdb' => '--client-gdb=#' ); - @ARGV = map { $fixopt{$_} or $_ } @ARGV; + @ARGV = My::Debugger::fix_options(@ARGV); GetOptions(%options) or usage("Can't read options"); usage("") if $opt_usage; list_options(\%options) if $opt_list_options; @@ -1593,39 +1508,6 @@ sub command_line_setup { { mtr_error("Can't use --extern with --embedded-server"); } - - - if ($opt_gdb) - { - $opt_client_gdb= $opt_gdb; - $opt_gdb= undef; - } - - if ($opt_ddd) - { - $opt_client_ddd= $opt_ddd; - $opt_ddd= undef; - } - - if ($opt_dbx) { - mtr_warning("Silently converting --dbx to --client-dbx in embedded mode"); - $opt_client_dbx= $opt_dbx; - $opt_dbx= undef; - } - - if ($opt_debugger) - { - $opt_client_debugger= $opt_debugger; - $opt_debugger= undef; - } - - if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_lldb || - $opt_manual_ddd || $opt_manual_debug || $opt_debugger || $opt_dbx || - $opt_manual_dbx) - { - mtr_error("You need to use the client debug options for the", - "embedded server. Ex: --client-gdb"); - } } # -------------------------------------------------------------------------- @@ -1645,9 +1527,6 @@ sub command_line_setup { mtr_error("Coverage test needs the source - please use source dist"); } - # -------------------------------------------------------------------------- - # Check debug related options - # -------------------------------------------------------------------------- $ENV{ASAN_OPTIONS}= "abort_on_error=1:" . ($ENV{ASAN_OPTIONS} || ''); $ENV{ASAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/asan.supp:" . $ENV{ASAN_OPTIONS} @@ -1660,38 +1539,6 @@ sub command_line_setup { $ENV{LSAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/lsan.supp:print_suppressions=0" if -f "$glob_mysql_test_dir/lsan.supp" and not IS_WINDOWS; - if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || $opt_rr || - $opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd || - $opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx || - $opt_debugger || $opt_client_debugger ) - { - $ENV{ASAN_OPTIONS}= 'disable_coredump=0:'. $ENV{ASAN_OPTIONS}; - if ( using_extern() ) - { - mtr_error("Can't use --extern when using debugger"); - } - # Indicate that we are using debugger - $glob_debugger= 1; - $opt_retry= 1; - $opt_retry_failure= 1; - # Set one week timeout (check-testcase timeout will be 1/10th) - $opt_testcase_timeout= 7 * 24 * 60; - $opt_suite_timeout= 7 * 24 * 60; - # One day to shutdown - $opt_shutdown_timeout= 24 * 60; - # One day for PID file creation (this is given in seconds not minutes) - $opt_start_timeout= 24 * 60 * 60; - if ($opt_rr && open(my $fh, '<', '/proc/sys/kernel/perf_event_paranoid')) - { - my $perf_event_paranoid= <$fh>; - close $fh; - chomp $perf_event_paranoid; - if ($perf_event_paranoid == 0) - { - mtr_error("rr requires kernel.perf_event_paranoid set to 1"); - } - } - } mtr_verbose("ASAN_OPTIONS=$ENV{ASAN_OPTIONS}"); # -------------------------------------------------------------------------- @@ -1755,79 +1602,6 @@ sub command_line_setup { "for option --testsuite-timeout") if ($opt_suite_timeout <= 0); - # -------------------------------------------------------------------------- - # Check valgrind arguments - # -------------------------------------------------------------------------- - if ( $opt_valgrind or $opt_valgrind_path or @valgrind_args) - { - mtr_report("Turning on valgrind for all executables"); - $opt_valgrind= 1; - $opt_valgrind_mysqld= 1; - $opt_valgrind_mysqltest= 1; - } - elsif ( $opt_valgrind_mysqld ) - { - mtr_report("Turning on valgrind for mysqld(s) only"); - $opt_valgrind= 1; - } - elsif ( $opt_valgrind_mysqltest ) - { - mtr_report("Turning on valgrind for mysqltest and mysql_client_test only"); - $opt_valgrind= 1; - } - - if ($opt_valgrind) - { - # Increase the timeouts when running with valgrind - $opt_testcase_timeout*= 10; - $opt_suite_timeout*= 6; - $opt_start_timeout*= 10; - $warn_seconds*= 10; - } - - if ( $opt_callgrind ) - { - mtr_report("Turning on valgrind with callgrind for mysqld(s)"); - $opt_valgrind= 1; - $opt_valgrind_mysqld= 1; - - # Set special valgrind options unless options passed on command line - push(@valgrind_args, "--trace-children=yes") - unless @valgrind_args; - unshift(@valgrind_args, "--tool=callgrind"); - } - - # default to --tool=memcheck - if ($opt_valgrind && ! grep(/^--tool=/i, @valgrind_args)) - { - # Set valgrind_option unless already defined - if (!@valgrind_args) - { - push(@valgrind_args, ("--show-reachable=yes", "--leak-check=yes", - "--num-callers=20")); - push(@valgrind_args, ("--gen-suppressions=all")); - # push(@valgrind_args, ("--trace-signals=yes")); - } - unshift(@valgrind_args, "--tool=memcheck"); - } - - if ( $opt_valgrind ) - { - # Make valgrind run in quiet mode so it only print errors - push(@valgrind_args, "--quiet" ); - - push(@valgrind_args, "--suppressions=${glob_mysql_test_dir}/valgrind.supp") - if -f "$glob_mysql_test_dir/valgrind.supp"; - - mtr_report("Running valgrind with options \"", - join(" ", @valgrind_args), "\""); - } - - if (@strace_args || $opt_stracer) - { - $opt_strace=1; - } - if ($opt_debug_common) { $opt_debug= 1; @@ -2042,21 +1816,6 @@ sub executable_setup () { $exe_patch='patch' if `patch -v`; - # - # Check if libtool is available in this distribution/clone - # we need it when valgrinding or debugging non installed binary - # Otherwise valgrind will valgrind the libtool wrapper or bash - # and gdb will not find the real executable to debug - # - if ( -x "../libtool") - { - $exe_libtool= "../libtool"; - if ($opt_valgrind or $glob_debugger or $opt_strace) - { - mtr_report("Using \"$exe_libtool\" when running valgrind, strace or debugger"); - } - } - # Look for the client binaries $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); @@ -2182,9 +1941,6 @@ sub mysql_client_test_arguments(){ my $args; mtr_init_args(\$args); - if ( $opt_valgrind_mysqltest ) { - valgrind_arguments($args, \$exe); - } mtr_add_arg($args, "--defaults-file=%s", $path_config_file); mtr_add_arg($args, "--testcase"); mtr_add_arg($args, "--vardir=$opt_vardir"); @@ -2230,6 +1986,8 @@ sub environment_setup { umask(022); + $ENV{'USE_RUNNING_SERVER'}= using_extern(); + my @ld_library_paths; if ($path_client_libdir) @@ -2260,30 +2018,12 @@ sub environment_setup { } } - # -------------------------------------------------------------------------- - # Valgrind need to be run with debug libraries otherwise it's almost - # impossible to add correct supressions, that means if "/usr/lib/debug" - # is available, it should be added to - # LD_LIBRARY_PATH - # - # But pthread is broken in libc6-dbg on Debian <= 3.1 (see Debian - # bug 399035, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399035), - # so don't change LD_LIBRARY_PATH on that platform. - # -------------------------------------------------------------------------- - my $debug_libraries_path= "/usr/lib/debug"; - my $deb_version; - if ( $opt_valgrind and -d $debug_libraries_path and - (! -e '/etc/debian_version' or - ($deb_version= - mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or - $deb_version > 3.1 ) ) - { - push(@ld_library_paths, $debug_libraries_path); - } - $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths, $ENV{'LD_LIBRARY_PATH'} ? split(':', $ENV{'LD_LIBRARY_PATH'}) : ()); + + My::Debugger::pre_setup(); + mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}"); $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths, @@ -2321,7 +2061,6 @@ sub environment_setup { $ENV{'OPENSSL_CONF'}= $mysqld_variables{'version-ssl-library'} gt 'OpenSSL 1.1.1' ? "$glob_mysql_test_dir/lib/openssl.cnf" : '/dev/null'; - $ENV{'USE_RUNNING_SERVER'}= using_extern(); $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir; $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'port'}; $ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir; @@ -2492,10 +2231,6 @@ sub environment_setup { $ENV{INNOBACKUPEX}= "$exe_mariabackup --innobackupex"; - # Create an environment variable to make it possible - # to detect that valgrind is being used from test cases - $ENV{'VALGRIND_TEST'}= $opt_valgrind; - # Add dir of this perl to aid mysqltest in finding perl my $perldir= dirname($^X); my $pathsep= ":"; @@ -3310,25 +3045,7 @@ sub mysql_install_db { if (! -e $bootstrap_sql_file) { - if ($opt_boot_gdb) { - gdb_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(), - $bootstrap_sql_file); - } - if ($opt_boot_dbx) { - dbx_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(), - $bootstrap_sql_file); - } - if ($opt_boot_ddd) { - ddd_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(), - $bootstrap_sql_file); - } - if ($opt_boot_rr) { - $args= ["record", @rr_record_args, $exe_mysqld_bootstrap, @$args]; - $exe_mysqld_bootstrap= "rr"; - my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr.boot"; - $ENV{'_RR_TRACE_DIR'}= $rr_dir; - mkpath($rr_dir); - } + My::Debugger::setup_boot_args(\$args, \$exe_mysqld_bootstrap, $bootstrap_sql_file); my $path_sql= my_find_file($install_basedir, ["mysql", "sql/share", "share/mariadb", @@ -5074,7 +4791,7 @@ sub after_failure ($) { sub report_failure_and_restart ($) { my $tinfo= shift; - if ($opt_valgrind_mysqld && ($tinfo->{'warnings'} || $tinfo->{'timeout'}) && + if ($opt_valgrind && ($tinfo->{'warnings'} || $tinfo->{'timeout'}) && $opt_core_on_failure == 0) { # In these cases we may want valgrind report from normal termination @@ -5204,12 +4921,6 @@ sub mysqld_arguments ($$$) { # Check if "extra_opt" contains --log-bin my $skip_binlog= not grep /^--(loose-)?log-bin/, @$extra_opts; - # Indicate to mysqld it will be debugged in debugger - if ( $glob_debugger ) - { - mtr_add_arg($args, "--gdb"); - } - my $found_skip_core= 0; foreach my $arg ( @$extra_opts ) { @@ -5258,7 +4969,6 @@ sub mysqld_start ($$) { mtr_verbose(My::Options::toStr("mysqld_start", @$extra_opts)); my $exe= find_mysqld($mysqld->value('basedir')); - my $wait_for_pid_file= 1; mtr_error("Internal error: mysqld should never be started for embedded") if $opt_embedded_server; @@ -5266,15 +4976,6 @@ sub mysqld_start ($$) { my $args; mtr_init_args(\$args); - if ( $opt_valgrind_mysqld and not $opt_gdb and not $opt_manual_gdb ) - { - valgrind_arguments($args, \$exe); - } - if ( $opt_strace) - { - strace_arguments($args, \$exe, $mysqld->name()); - } - mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); # Add any additional options from an in-test restart @@ -5298,49 +4999,8 @@ sub mysqld_start ($$) { # options from *.opt and *.combination files. $ENV{'MYSQLD_LAST_CMD'}= "$exe @$args"; - if ( $opt_gdb || $opt_manual_gdb ) - { - gdb_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_manual_lldb ) - { - lldb_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_ddd || $opt_manual_ddd ) - { - ddd_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_dbx || $opt_manual_dbx ) { - dbx_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_debugger ) - { - debugger_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_manual_debug ) - { - print "\nStart " .$mysqld->name()." in your debugger\n" . - "dir: $glob_mysql_test_dir\n" . - "exe: $exe\n" . - "args: " . join(" ", @$args) . "\n\n" . - "Waiting ....\n"; - - # Indicate the exe should not be started - $exe= undef; - } - elsif ( $opt_rr ) - { - $args= ["record", @rr_record_args, "$exe", @$args]; - $exe= "rr"; - my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr". $mysqld->after('mysqld'); - $ENV{'_RR_TRACE_DIR'}= $rr_dir; - mkpath($rr_dir); - } - else - { - # Default to not wait until pid file has been created - $wait_for_pid_file= 0; - } + My::Debugger::setup_args(\$args, \$exe, $mysqld->name()); + $ENV{'VALGRIND_TEST'}= $opt_valgrind = int($exe && $exe eq 'valgrind'); # Remove the old pidfile if any unlink($mysqld->value('pid-file')); @@ -5389,11 +5049,8 @@ sub mysqld_start ($$) { mtr_verbose("Started $mysqld->{proc}"); } - if ( $wait_for_pid_file && - !sleep_until_file_created($mysqld->value('pid-file'), - $opt_start_timeout, - $mysqld->{'proc'}, - $warn_seconds)) + if (!sleep_until_file_created($mysqld->value('pid-file'), + $opt_start_timeout, $mysqld->{'proc'}, $warn_seconds)) { my $mname= $mysqld->name(); mtr_error("Failed to start mysqld $mname with command $exe"); @@ -5840,17 +5497,6 @@ sub start_mysqltest ($) { mtr_add_arg($args, "--sleep=%d", $opt_sleep); } - if ( $opt_valgrind || $opt_wait_for_pos_timeout) - { - if (! $opt_wait_for_pos_timeout) - { - # We are running server under valgrind, which causes some replication - # test to be much slower, notable rpl_mdev6020. Increase timeout. - $opt_wait_for_pos_timeout= 1500; - } - mtr_add_arg($args, "--wait-for-pos-timeout=$opt_wait_for_pos_timeout"); - } - if ( $opt_ssl ) { # Turn on SSL for _all_ test cases if option --ssl was used @@ -5883,31 +5529,6 @@ sub start_mysqltest ($) { # ---------------------------------------------------------------------- $ENV{'MYSQL_TEST'}= mtr_args2str($exe_mysqltest, @$args); - # ---------------------------------------------------------------------- - # Add arguments that should not go into the MYSQL_TEST env var - # ---------------------------------------------------------------------- - if ( $opt_valgrind_mysqltest ) - { - # Prefix the Valgrind options to the argument list. - # We do this here, since we do not want to Valgrind the nested invocations - # of mysqltest; that would mess up the stderr output causing test failure. - my @args_saved = @$args; - mtr_init_args(\$args); - valgrind_arguments($args, \$exe); - mtr_add_arg($args, "%s", $_) for @args_saved; - } - - # ---------------------------------------------------------------------- - # Prefix the strace options to the argument list. - # ---------------------------------------------------------------------- - if ( $opt_client_strace ) - { - my @args_saved = @$args; - mtr_init_args(\$args); - strace_arguments($args, \$exe, "mysqltest"); - mtr_add_arg($args, "%s", $_) for @args_saved; - } - if ($opt_force > 1) { mtr_add_arg($args, "--continue-on-error"); @@ -5943,21 +5564,7 @@ sub start_mysqltest ($) { } } - if ( $opt_client_gdb ) - { - gdb_arguments(\$args, \$exe, "client"); - } - elsif ( $opt_client_ddd ) - { - ddd_arguments(\$args, \$exe, "client"); - } - if ( $opt_client_dbx ) { - dbx_arguments(\$args, \$exe, "client"); - } - elsif ( $opt_client_debugger ) - { - debugger_arguments(\$args, \$exe, "client"); - } + My::Debugger::setup_client_args(\$args, \$exe); my $proc= My::SafeProcess->new ( @@ -5973,291 +5580,6 @@ sub start_mysqltest ($) { } # -# Modify the exe and args so that program is run in gdb in xterm -# -sub gdb_arguments { - my $args= shift; - my $exe= shift; - my $type= shift; - my $input= shift; - - my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; - - # Remove the old gdbinit file - unlink($gdb_init_file); - - # Put $args into a single string - $input = $input ? "< $input" : ""; - - if ($type eq 'client') { - mtr_tofile($gdb_init_file, - join("\n", - "set args @$$args $input", - split /;/, $opt_client_gdb || "" - )); - } elsif ($opt_valgrind_mysqld) { - my $v = $$exe; - my $vargs = []; - valgrind_arguments($vargs, \$v); - mtr_tofile($gdb_init_file, <<EOF); -shell @My::SafeProcess::safe_process_cmd --parent-pid=`pgrep -x gdb` -- $v --vgdb-error=0 @$vargs @$$args & -shell sleep 1 -target remote | /usr/lib64/valgrind/../../bin/vgdb -EOF - } else { - mtr_tofile($gdb_init_file, - join("\n", - "set args @$$args $input", - split /;/, $opt_gdb || "" - )); - } - - if ( $opt_manual_gdb ) - { - print "\nTo start gdb for $type, type in another window:\n"; - print "gdb -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n"; - - # Indicate the exe should not be started - $$exe= undef; - return; - } - - $$args= []; - mtr_add_arg($$args, "-title"); - mtr_add_arg($$args, "$type"); - mtr_add_arg($$args, "-e"); - - if ( $exe_libtool ) - { - mtr_add_arg($$args, $exe_libtool); - mtr_add_arg($$args, "--mode=execute"); - } - - mtr_add_arg($$args, "gdb"); - mtr_add_arg($$args, "-x"); - mtr_add_arg($$args, "$gdb_init_file"); - mtr_add_arg($$args, "$$exe"); - - $$exe= "xterm"; -} - -# -# Modify the exe and args so that program is run in lldb -# -sub lldb_arguments { - my $args= shift; - my $exe= shift; - my $type= shift; - my $input= shift; - - my $lldb_init_file= "$opt_vardir/tmp/lldbinit.$type"; - unlink($lldb_init_file); - - # Put $args into a single string - my $str= join(" ", @$$args); - $input = $input ? "< $input" : ""; - - # write init file for mysqld or client - mtr_tofile($lldb_init_file, "process launch --stop-at-entry -- $str $input\n"); - - print "\nTo start lldb for $type, type in another window:\n"; - print "cd $glob_mysql_test_dir && lldb -s $lldb_init_file $$exe\n"; - - # Indicate the exe should not be started - $$exe= undef; - return; -} - -# -# Modify the exe and args so that program is run in ddd -# -sub ddd_arguments { - my $args= shift; - my $exe= shift; - my $type= shift; - my $input= shift; - - my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; - - # Remove the old gdbinit file - unlink($gdb_init_file); - - # Put $args into a single string - my $str= join(" ", @$$args); - $input = $input ? "< $input" : ""; - - # write init file for mysqld or client - mtr_tofile($gdb_init_file, "file $$exe\nset args $str $input\n"); - - if ( $opt_manual_ddd ) - { - print "\nTo start ddd for $type, type in another window:\n"; - print "ddd -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n"; - - # Indicate the exe should not be started - $$exe= undef; - return; - } - - my $save_exe= $$exe; - $$args= []; - if ( $exe_libtool ) - { - $$exe= $exe_libtool; - mtr_add_arg($$args, "--mode=execute"); - mtr_add_arg($$args, "ddd"); - } - else - { - $$exe= "ddd"; - } - mtr_add_arg($$args, "--command=$gdb_init_file"); - mtr_add_arg($$args, "$save_exe"); -} - - -# -# Modify the exe and args so that program is run in dbx in xterm -# -sub dbx_arguments { - my $args= shift; - my $exe= shift; - my $type= shift; - my $input= shift; - - # Put $args into a single string - my $str= join " ", @$$args; - my $runline= $input ? "run $str < $input" : "run $str"; - - if ( $opt_manual_dbx ) { - print "\nTo start dbx for $type, type in another window:\n"; - print "cd $glob_mysql_test_dir; dbx -c \"stop in main; " . - "$runline\" $$exe\n"; - - # Indicate the exe should not be started - $$exe= undef; - return; - } - - $$args= []; - mtr_add_arg($$args, "-title"); - mtr_add_arg($$args, "$type"); - mtr_add_arg($$args, "-e"); - - if ( $exe_libtool ) { - mtr_add_arg($$args, $exe_libtool); - mtr_add_arg($$args, "--mode=execute"); - } - - mtr_add_arg($$args, "dbx"); - mtr_add_arg($$args, "-c"); - mtr_add_arg($$args, "stop in main; $runline"); - mtr_add_arg($$args, "$$exe"); - - $$exe= "xterm"; -} - - -# -# Modify the exe and args so that program is run in the selected debugger -# -sub debugger_arguments { - my $args= shift; - my $exe= shift; - my $debugger= $opt_debugger || $opt_client_debugger; - - if ( $debugger =~ /vcexpress|vc|devenv/ ) - { - # vc[express] /debugexe exe arg1 .. argn - - # Add name of the exe and /debugexe before args - unshift(@$$args, "$$exe"); - unshift(@$$args, "/debugexe"); - - # Set exe to debuggername - $$exe= $debugger; - - } - elsif ( $debugger =~ /windbg|vsjitdebugger/ ) - { - # windbg exe arg1 .. argn - - # Add name of the exe before args - unshift(@$$args, "$$exe"); - - # Set exe to debuggername - $$exe= $debugger; - - } - else - { - mtr_error("Unknown argument \"$debugger\" passed to --debugger"); - } -} - -# -# Modify the exe and args so that program is run in valgrind -# -sub valgrind_arguments { - my $args= shift; - my $exe= shift; - - # Ensure the jemalloc works with mysqld - if ($$exe =~ /(mysqld|mariadbd)/) - { - my %somalloc=( - 'system jemalloc' => 'libjemalloc*', - 'bundled jemalloc' => 'NONE' - ); - my ($syn) = $somalloc{$mysqld_variables{'version-malloc-library'}}; - mtr_add_arg($args, '--soname-synonyms=somalloc=%s', $syn) if $syn; - } - - # Add valgrind options, can be overridden by user - mtr_add_arg($args, '%s', $_) for (@valgrind_args); - - mtr_add_arg($args, $$exe); - - $$exe= $opt_valgrind_path || "valgrind"; - - if ($exe_libtool) - { - # Add "libtool --mode-execute" before the test to execute - # if running in valgrind(to avoid valgrinding bash) - unshift(@$args, "--mode=execute", $$exe); - $$exe= $exe_libtool; - } -} - -# -# Modify the exe and args so that program is run in strace -# -sub strace_arguments { - my $args= shift; - my $exe= shift; - my $mysqld_name= shift; - my $output= sprintf("%s/log/%s.strace", $path_vardir_trace, $mysqld_name); - - mtr_add_arg($args, "-f"); - mtr_add_arg($args, "-o%s", $output); - - # Add strace options - mtr_add_arg($args, '%s', $_) for (@strace_args); - - mtr_add_arg($args, $$exe); - - $$exe= $opt_stracer || "strace"; - - if ($exe_libtool) - { - # Add "libtool --mode-execute" before the test to execute - # if running in valgrind(to avoid valgrinding bash) - unshift(@$args, "--mode=execute", $$exe); - $$exe= $exe_libtool; - } -} - -# # Search server logs for valgrind reports printed at mysqld termination # sub valgrind_exit_reports() { @@ -6338,7 +5660,7 @@ sub usage ($) { local $"= ','; # for @DEFAULT_SUITES below - print <<HERE; + print <<HERE . My::Debugger::help() . <<HERE; $0 [ OPTIONS ] [ TESTCASE ] @@ -6465,32 +5787,11 @@ Options to run test on running server Options for debugging the product - boot-dbx Start bootstrap server in dbx - boot-ddd Start bootstrap server in ddd - boot-gdb Start bootstrap server in gdb - client-dbx Start mysqltest client in dbx - client-ddd Start mysqltest client in ddd - client-debugger=NAME Start mysqltest in the selected debugger - client-gdb Start mysqltest client in gdb - dbx Start the mysqld(s) in dbx - ddd Start the mysqld(s) in ddd debug Dump trace output for all servers and client programs debug-common Same as debug, but sets 'd' debug flags to "query,info,error,enter,exit" debug-server Use debug version of server, but without turning on tracing - debugger=NAME Start mysqld in the selected debugger - gdb[=gdb_arguments] Start the mariadbd(s) in gdb - manual-debug Let user manually start mysqld in debugger, before - running test(s) - manual-gdb Let user manually start mysqld in gdb, before running - test(s) - manual-ddd Let user manually start mysqld in ddd, before running - test(s) - manual-dbx Let user manually start mysqld in dbx, before running - test(s) - manual-lldb Let user manually start mysqld in lldb, before running - test(s) max-save-core Limit the number of core files saved (to avoid filling up disks for heavily crashing server). Defaults to $opt_max_save_core. Set its default with @@ -6504,38 +5805,7 @@ Options for debugging the product $opt_max_test_fail, set to 0 for no limit. Set it's default with MTR_MAX_TEST_FAIL core-in-failure Generate a core even if run server is run with valgrind - -Options for valgrind - - valgrind Run the "mysqltest" and "mysqld" executables using - valgrind with default options - valgrind-all Synonym for --valgrind - valgrind-mysqltest Run the "mysqltest" and "mysql_client_test" executable - with valgrind - valgrind-mysqld Run the "mysqld" executable with valgrind - valgrind-options=ARGS Deprecated, use --valgrind-option - valgrind-option=ARGS Option to give valgrind, replaces default option(s), - can be specified more then once - valgrind-path=<EXE> Path to the valgrind executable - callgrind Instruct valgrind to use callgrind - -Options for strace - - strace Run the "mysqld" executables using strace. Default - options are -f -o 'vardir'/log/'mysqld-name'.strace. - client-strace Trace the "mysqltest". - strace-option=ARGS Option to give strace, appends to existing options. - stracer=<EXE> Specify name and path to the trace program to use. - Default is "strace". Example: $0 --stracer=ktrace. - -Options for rr (Record and Replay) - rr Run the "mysqld" executables using rr. Default run - option is "rr record mysqld mysqld_options" - boot-rr Start bootstrap server in rr - rr-arg=ARG Option to give rr record, can be specified more then once - rr-dir=DIR The directory where rr recordings are stored. Defaults - to 'vardir'/rr.0 (rr.boot for bootstrap instance and - rr.1, ..., rr.N for slave instances). +HERE Misc options user=USER User for connecting to mysqld(default: $opt_user) @@ -6587,7 +5857,6 @@ Misc options the file (for buildbot) sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time - wait-for-pos-timeout=NUM Passed to mysqltest debug-sync-timeout=NUM Set default timeout for WAIT_FOR debug sync actions. Disable facility with NUM=0. gcov Collect coverage information after the test. diff --git a/mysql-test/suite/binlog/include/binlog_xa_recover.inc b/mysql-test/suite/binlog/include/binlog_xa_recover.inc deleted file mode 100644 index 9e0906c90f0..00000000000 --- a/mysql-test/suite/binlog/include/binlog_xa_recover.inc +++ /dev/null @@ -1,280 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently binlog and binlog_encryption). -# Please check all dependent tests after modifying it -# - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_row.inc -# Valgrind does not work well with test that crashes the server ---source include/not_valgrind.inc - -# (We do not need to restore these settings, as we crash the server). -SET GLOBAL max_binlog_size= 4096; -SET GLOBAL innodb_flush_log_at_trx_commit= 1; -RESET MASTER; - -CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; -# Insert some data to force a couple binlog rotations (3), so we get some -# normal binlog checkpoints before starting the test. -INSERT INTO t1 VALUES (100, REPEAT("x", 4100)); -# Wait for the master-bin.000002 binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002" ---let $field= Info ---let $condition= = "master-bin.000002" ---source include/wait_show_condition.inc -INSERT INTO t1 VALUES (101, REPEAT("x", 4100)); ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" ---let $field= Info ---let $condition= = "master-bin.000003" ---source include/wait_show_condition.inc -INSERT INTO t1 VALUES (102, REPEAT("x", 4100)); ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" ---let $field= Info ---let $condition= = "master-bin.000004" ---source include/wait_show_condition.inc - -# Now start a bunch of transactions that span multiple binlog -# files. Leave then in the state prepared-but-not-committed in the engine -# and crash the server. Check that crash recovery is able to recover all -# of them. -# -# We use debug_sync to get all the transactions into the prepared state before -# we commit any of them. This is because the prepare step flushes the InnoDB -# redo log - including any commits made before, so recovery would become -# unnecessary, decreasing the value of this test. -# -# We arrange to have con1 with a prepared transaction in master-bin.000004, -# con2 and con3 with a prepared transaction in master-bin.000005, and a new -# empty master-bin.000006. So the latest binlog checkpoint should be -# master-bin.000006. - -connect(con1,localhost,root,,); -# First wait after prepare and before write to binlog. -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont"; -# Then complete InnoDB commit in memory (but not commit checkpoint / write to -# disk), and hang until crash, leaving a transaction to be XA recovered. -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever"; -send INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con1_wait"; - -connect(con2,localhost,root,,); -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont"; -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever"; -send INSERT INTO t1 VALUES (2, NULL); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con2_wait"; - -connect(con3,localhost,root,,); -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont"; -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever"; -send INSERT INTO t1 VALUES (3, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con3_wait"; - -connect(con4,localhost,root,,); -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont"; -SET SESSION debug_dbug="+d,crash_commit_after_log"; -send INSERT INTO t1 VALUES (4, NULL); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con4_wait"; - -SET DEBUG_SYNC= "now SIGNAL con1_cont"; -SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; -SET DEBUG_SYNC= "now SIGNAL con2_cont"; -SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; -SET DEBUG_SYNC= "now SIGNAL con3_cont"; -SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; - -# Check that everything is committed in binary log. ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000003 ---let $binlog_start= 4 ---source include/show_binlog_events.inc ---let $binlog_file= master-bin.000004 ---source include/show_binlog_events.inc ---let $binlog_file= master-bin.000005 ---source include/show_binlog_events.inc ---let $binlog_file= master-bin.000006 ---source include/show_binlog_events.inc - - -# Check that server will not purge too much. -PURGE BINARY LOGS TO "master-bin.000006"; ---source include/show_binary_logs.inc - -# Now crash the server with one more transaction in prepared state. ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-binlog_xa_recover.test -EOF ---error 0,2006,2013 -SET DEBUG_SYNC= "now SIGNAL con4_cont"; -connection con4; ---error 2006,2013 -reap; - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-group_commit_binlog_pos.test -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc - -# Check that all transactions are recovered. -SELECT a FROM t1 ORDER BY a; - ---echo Test that with multiple binlog checkpoints, recovery starts from the last one. -SET GLOBAL max_binlog_size= 4096; -SET GLOBAL innodb_flush_log_at_trx_commit= 1; -RESET MASTER; - -# Rotate to binlog master-bin.000003 while delaying binlog checkpoints. -# So we get multiple binlog checkpoints in master-bin.000003. -# Then complete the checkpoints, crash, and check that we only scan -# the necessary binlog file (ie. that we use the _last_ checkpoint). - -connect(con10,localhost,root,,); -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont"; -send INSERT INTO t1 VALUES (10, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con10_ready"; - -connect(con11,localhost,root,,); -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont"; -send INSERT INTO t1 VALUES (11, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con11_ready"; - -connect(con12,localhost,root,,); -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont"; -send INSERT INTO t1 VALUES (12, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con12_ready"; -INSERT INTO t1 VALUES (13, NULL); - ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000004 ---let $binlog_start= 4 ---source include/show_binlog_events.inc - -SET DEBUG_SYNC= "now SIGNAL con10_cont"; -connection con10; -reap; -connection default; - -# We need to sync the test case with the background processing of the -# commit checkpoint, otherwise we get nondeterministic results. -SET @old_dbug= @@global.DEBUG_DBUG; -SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; -SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; -SET DEBUG_SYNC= "now SIGNAL con12_cont"; -connection con12; -reap; -connection default; -SET GLOBAL debug_dbug= @old_dbug; - -SET DEBUG_SYNC= "now SIGNAL con11_cont"; -connection con11; -reap; - -connection default; -# Wait for the last (master-bin.000004) binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" ---let $field= Info ---let $condition= = "master-bin.000004" ---source include/wait_show_condition.inc - ---echo Checking that master-bin.000004 is the last binlog checkpoint ---source include/show_binlog_events.inc - ---echo Now crash the server -# It is not too easy to test XA recovery, as it runs early during server -# startup, before any connections can be made. -# What we do is set a DBUG error insert which will crash if XA recovery -# starts from any other binlog than master-bin.000004 (check the file -# binlog_xa_recover-master.opt). Then we will fail here if XA recovery -# would start from the wrong place. ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-binlog_xa_recover.test -EOF -SET SESSION debug_dbug="+d,crash_commit_after_log"; ---error 2006,2013 -INSERT INTO t1 VALUES (14, NULL); - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-group_commit_binlog_pos.test -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc - -# Check that all transactions are recovered. -SELECT a FROM t1 ORDER BY a; - - ---echo *** Check that recovery works if we crashed early during rotate, before ---echo *** binlog checkpoint event could be written. - -SET GLOBAL max_binlog_size= 4096; -SET GLOBAL innodb_flush_log_at_trx_commit= 1; -RESET MASTER; - -# We need some initial data to reach binlog master-bin.000004. Otherwise -# crash recovery fails due to the error insert used for previous test. -INSERT INTO t1 VALUES (21, REPEAT("x", 4100)); -INSERT INTO t1 VALUES (22, REPEAT("x", 4100)); -# Wait for the master-bin.000003 binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" ---let $field= Info ---let $condition= = "master-bin.000003" ---source include/wait_show_condition.inc -INSERT INTO t1 VALUES (23, REPEAT("x", 4100)); -# Wait for the last (master-bin.000004) binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" ---let $field= Info ---let $condition= = "master-bin.000004" ---source include/wait_show_condition.inc - ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-binlog_xa_recover.test -EOF -SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event"; ---error 2006,2013 -INSERT INTO t1 VALUES (24, REPEAT("x", 4100)); - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-group_commit_binlog_pos.test -EOF - ---enable_reconnect ---source include/wait_until_connected_again.inc - -# Check that all transactions are recovered. -SELECT a FROM t1 ORDER BY a; - ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000004 ---let $binlog_start= 4 ---source include/show_binlog_events.inc - -# Cleanup -connection default; -DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_xa_recover.result b/mysql-test/suite/binlog/r/binlog_xa_recover.result index cb2cad957f0..f5060fd5160 100644 --- a/mysql-test/suite/binlog/r/binlog_xa_recover.result +++ b/mysql-test/suite/binlog/r/binlog_xa_recover.result @@ -146,29 +146,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */ SET DEBUG_SYNC= "now SIGNAL con10_cont"; connection con10; connection default; -SET @old_dbug= @@global.DEBUG_DBUG; -SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; -SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; SET DEBUG_SYNC= "now SIGNAL con12_cont"; connection con12; connection default; -SET GLOBAL debug_dbug= @old_dbug; SET DEBUG_SYNC= "now SIGNAL con11_cont"; connection con11; connection default; -Checking that master-bin.000004 is the last binlog checkpoint -include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -master-bin.000004 # Gtid_list # # [#-#-#] -master-bin.000004 # Binlog_checkpoint # # master-bin.000001 -master-bin.000004 # Gtid # # BEGIN GTID #-#-# -master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL) -master-bin.000004 # Table_map # # table_id: # (test.t1) -master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000004 # Xid # # COMMIT /* XID */ -master-bin.000004 # Binlog_checkpoint # # master-bin.000002 -master-bin.000004 # Binlog_checkpoint # # master-bin.000004 Now crash the server SET SESSION debug_dbug="+d,crash_commit_after_log"; INSERT INTO t1 VALUES (14, NULL); diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover-master.opt b/mysql-test/suite/binlog/t/binlog_xa_recover.opt index 3c44f9fad10..3c44f9fad10 100644 --- a/mysql-test/suite/binlog/t/binlog_xa_recover-master.opt +++ b/mysql-test/suite/binlog/t/binlog_xa_recover.opt diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover.test b/mysql-test/suite/binlog/t/binlog_xa_recover.test index 411394d4bef..51c30ee705d 100644 --- a/mysql-test/suite/binlog/t/binlog_xa_recover.test +++ b/mysql-test/suite/binlog/t/binlog_xa_recover.test @@ -1 +1,276 @@ ---source include/binlog_xa_recover.inc +# +# This include file is used by more than one test suite +# (currently binlog and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_row.inc +# Valgrind does not work well with test that crashes the server +--source include/not_valgrind.inc + +# (We do not need to restore these settings, as we crash the server). +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; + +CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; +# Insert some data to force a couple binlog rotations (3), so we get some +# normal binlog checkpoints before starting the test. +INSERT INTO t1 VALUES (100, REPEAT("x", 4100)); +# Wait for the master-bin.000002 binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002" +--let $field= Info +--let $condition= = "master-bin.000002" +--source include/wait_show_condition.inc +INSERT INTO t1 VALUES (101, REPEAT("x", 4100)); +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" +--let $field= Info +--let $condition= = "master-bin.000003" +--source include/wait_show_condition.inc +INSERT INTO t1 VALUES (102, REPEAT("x", 4100)); +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" +--let $field= Info +--let $condition= = "master-bin.000004" +--source include/wait_show_condition.inc + +# Now start a bunch of transactions that span multiple binlog +# files. Leave then in the state prepared-but-not-committed in the engine +# and crash the server. Check that crash recovery is able to recover all +# of them. +# +# We use debug_sync to get all the transactions into the prepared state before +# we commit any of them. This is because the prepare step flushes the InnoDB +# redo log - including any commits made before, so recovery would become +# unnecessary, decreasing the value of this test. +# +# We arrange to have con1 with a prepared transaction in master-bin.000004, +# con2 and con3 with a prepared transaction in master-bin.000005, and a new +# empty master-bin.000006. So the latest binlog checkpoint should be +# master-bin.000006. + +connect(con1,localhost,root,,); +# First wait after prepare and before write to binlog. +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont"; +# Then complete InnoDB commit in memory (but not commit checkpoint / write to +# disk), and hang until crash, leaving a transaction to be XA recovered. +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever"; +send INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con1_wait"; + +connect(con2,localhost,root,,); +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont"; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever"; +send INSERT INTO t1 VALUES (2, NULL); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con2_wait"; + +connect(con3,localhost,root,,); +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont"; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever"; +send INSERT INTO t1 VALUES (3, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con3_wait"; + +connect(con4,localhost,root,,); +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont"; +SET SESSION debug_dbug="+d,crash_commit_after_log"; +send INSERT INTO t1 VALUES (4, NULL); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con4_wait"; + +SET DEBUG_SYNC= "now SIGNAL con1_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; +SET DEBUG_SYNC= "now SIGNAL con2_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; +SET DEBUG_SYNC= "now SIGNAL con3_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; + +# Check that everything is committed in binary log. +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000003 +--let $binlog_start= 4 +--source include/show_binlog_events.inc +--let $binlog_file= master-bin.000004 +--source include/show_binlog_events.inc +--let $binlog_file= master-bin.000005 +--source include/show_binlog_events.inc +--let $binlog_file= master-bin.000006 +--source include/show_binlog_events.inc + + +# Check that server will not purge too much. +PURGE BINARY LOGS TO "master-bin.000006"; +--source include/show_binary_logs.inc + +# Now crash the server with one more transaction in prepared state. +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait-binlog_xa_recover.test +EOF +--error 0,2006,2013 +SET DEBUG_SYNC= "now SIGNAL con4_cont"; +connection con4; +--error 2006,2013 +reap; + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart-group_commit_binlog_pos.test +EOF + +connection default; +--enable_reconnect +--source include/wait_until_connected_again.inc + +# Check that all transactions are recovered. +SELECT a FROM t1 ORDER BY a; + +--echo Test that with multiple binlog checkpoints, recovery starts from the last one. +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; + +# Rotate to binlog master-bin.000003 while delaying binlog checkpoints. +# So we get multiple binlog checkpoints in master-bin.000003. +# Then complete the checkpoints, crash, and check that we only scan +# the necessary binlog file (ie. that we use the _last_ checkpoint). + +connect(con10,localhost,root,,); +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont"; +send INSERT INTO t1 VALUES (10, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con10_ready"; + +connect(con11,localhost,root,,); +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont"; +send INSERT INTO t1 VALUES (11, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con11_ready"; + +connect(con12,localhost,root,,); +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont"; +send INSERT INTO t1 VALUES (12, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con12_ready"; +INSERT INTO t1 VALUES (13, NULL); + +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000004 +--let $binlog_start= 4 +--source include/show_binlog_events.inc + +SET DEBUG_SYNC= "now SIGNAL con10_cont"; +connection con10; +reap; +connection default; + +# We need to sync the test case with the background processing of the +# commit checkpoint, otherwise we get nondeterministic results. +let $wait_condition= select count(*) = 1 from performance_schema.threads where processlist_state = "Waiting for background binlog tasks"; +--source include/wait_condition.inc + +SET DEBUG_SYNC= "now SIGNAL con12_cont"; +connection con12; +reap; +connection default; + +SET DEBUG_SYNC= "now SIGNAL con11_cont"; +connection con11; +reap; + +connection default; +# Wait for the last (master-bin.000004) binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" +--let $field= Info +--let $condition= = "master-bin.000004" +--source include/wait_show_condition.inc + +--echo Now crash the server +# It is not too easy to test XA recovery, as it runs early during server +# startup, before any connections can be made. +# What we do is set a DBUG error insert which will crash if XA recovery +# starts from any other binlog than master-bin.000004 (check the file +# binlog_xa_recover-master.opt). Then we will fail here if XA recovery +# would start from the wrong place. +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait-binlog_xa_recover.test +EOF +SET SESSION debug_dbug="+d,crash_commit_after_log"; +--error 2006,2013 +INSERT INTO t1 VALUES (14, NULL); + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart-group_commit_binlog_pos.test +EOF + +connection default; +--enable_reconnect +--source include/wait_until_connected_again.inc + +# Check that all transactions are recovered. +SELECT a FROM t1 ORDER BY a; + + +--echo *** Check that recovery works if we crashed early during rotate, before +--echo *** binlog checkpoint event could be written. + +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; + +# We need some initial data to reach binlog master-bin.000004. Otherwise +# crash recovery fails due to the error insert used for previous test. +INSERT INTO t1 VALUES (21, REPEAT("x", 4100)); +INSERT INTO t1 VALUES (22, REPEAT("x", 4100)); +# Wait for the master-bin.000003 binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" +--let $field= Info +--let $condition= = "master-bin.000003" +--source include/wait_show_condition.inc +INSERT INTO t1 VALUES (23, REPEAT("x", 4100)); +# Wait for the last (master-bin.000004) binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" +--let $field= Info +--let $condition= = "master-bin.000004" +--source include/wait_show_condition.inc + +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait-binlog_xa_recover.test +EOF +SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event"; +--error 2006,2013 +INSERT INTO t1 VALUES (24, REPEAT("x", 4100)); + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart-group_commit_binlog_pos.test +EOF + +--enable_reconnect +--source include/wait_until_connected_again.inc + +# Check that all transactions are recovered. +SELECT a FROM t1 ORDER BY a; + +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000004 +--let $binlog_start= 4 +--source include/show_binlog_events.inc + +# Cleanup +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt b/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt deleted file mode 100644 index 3c44f9fad10..00000000000 --- a/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt +++ /dev/null @@ -1 +0,0 @@ ---skip-stack-trace --skip-core-file --loose-debug-dbug=+d,xa_recover_expect_master_bin_000004 diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover.result b/mysql-test/suite/binlog_encryption/binlog_xa_recover.result index 6e33595eb9e..3e4ed42cf7c 100644 --- a/mysql-test/suite/binlog_encryption/binlog_xa_recover.result +++ b/mysql-test/suite/binlog_encryption/binlog_xa_recover.result @@ -151,30 +151,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */ SET DEBUG_SYNC= "now SIGNAL con10_cont"; connection con10; connection default; -SET @old_dbug= @@global.DEBUG_DBUG; -SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; -SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; SET DEBUG_SYNC= "now SIGNAL con12_cont"; connection con12; connection default; -SET GLOBAL debug_dbug= @old_dbug; SET DEBUG_SYNC= "now SIGNAL con11_cont"; connection con11; connection default; -Checking that master-bin.000004 is the last binlog checkpoint -include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -master-bin.000004 # Start_encryption # # -master-bin.000004 # Gtid_list # # [#-#-#] -master-bin.000004 # Binlog_checkpoint # # master-bin.000001 -master-bin.000004 # Gtid # # BEGIN GTID #-#-# -master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL) -master-bin.000004 # Table_map # # table_id: # (test.t1) -master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000004 # Xid # # COMMIT /* XID */ -master-bin.000004 # Binlog_checkpoint # # master-bin.000002 -master-bin.000004 # Binlog_checkpoint # # master-bin.000004 Now crash the server SET SESSION debug_dbug="+d,crash_commit_after_log"; INSERT INTO t1 VALUES (14, NULL); diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover.test b/mysql-test/suite/binlog_encryption/binlog_xa_recover.test index e603ccc30fe..c03adb6aff2 100644 --- a/mysql-test/suite/binlog_encryption/binlog_xa_recover.test +++ b/mysql-test/suite/binlog_encryption/binlog_xa_recover.test @@ -1 +1 @@ ---source suite/binlog/include/binlog_xa_recover.inc +--source suite/binlog/t/binlog_xa_recover.test diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result index f167712d048..2f174c5e70b 100644 --- a/mysql-test/suite/engines/iuds/r/insert_decimal.result +++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result @@ -110,15 +110,12 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 Warning 1264 Out of range value for column 'c2' at row 1 Warning 1264 Out of range value for column 'c3' at row 1 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c1` at row 2 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c2` at row 2 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c3` at row 2 +Warning 1264 Out of range value for column 'c1' at row 2 +Warning 1264 Out of range value for column 'c2' at row 2 +Warning 1264 Out of range value for column 'c3' at row 2 Note 1265 Data truncated for column 'c1' at row 3 Note 1265 Data truncated for column 'c2' at row 3 Note 1265 Data truncated for column 'c3' at row 3 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c1` at row 4 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c2` at row 4 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c3` at row 4 SELECT * FROM t1; c1 c2 c3 c4 0.00000 -0.10000 0 13 @@ -142,7 +139,6 @@ c1 c2 c3 c4 0 0 0 15 0 0 0 26 0 0 0 29 -0 0 0 31 0 0 0 32 0 0 0 33 0 0 0 7 @@ -160,6 +156,7 @@ c1 c2 c3 c4 9999999999 9999999999 9999999999 25 9999999999 9999999999 9999999999 28 9999999999 9999999999 9999999999 30 +9999999999 9999999999 9999999999 31 SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t1; total_rows min_value max_value sum avg 7 0.00000 99999.99999 212446.04999 30349.435712857 @@ -171,13 +168,13 @@ total_rows min_value max_value sum avg 7 0 111111111 111211212 18535202.0000 SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t2; total_rows min_value max_value sum avg -30 -9999999999 9999999999 21322222222 710740740.7333 +30 -9999999999 9999999999 31322222221 1044074074.0333 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) as max_value, sum(c2) as sum, avg(c2) as avg FROM t2; total_rows min_value max_value sum avg -30 0 9999999999 33444444445 1114814814.8333 +30 0 9999999999 43444444444 1448148148.1333 SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c3) as sum, avg(c3) as avg FROM t2; total_rows min_value max_value sum avg -30 -9999999999 9999999999 43322222220 1444074074.0000 +30 -9999999999 9999999999 53322222219 1777407407.3000 SELECT * FROM t1; c1 c2 c3 c4 0.00000 -0.10000 0 13 diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 18d0df3cc31..f12c1ee442b 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -26,13 +26,11 @@ galera_encrypt_tmp_files : Get error failed to enable encryption of temporary fi galera_ftwrl : MDEV-21525 galera.galera_ftwrl galera_gcache_recover_manytrx : MDEV-18834 Galera test failure galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges -galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk galera_mdl_race : MDEV-21524 galera.galera_mdl_race galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim -galera_split_brain : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key galera_toi_ddl_nonconflicting : MDEV-21518 galera.galera_toi_ddl_nonconflicting @@ -49,4 +47,6 @@ mysql-wsrep#198 : MDEV-24446: galera.mysql-wsrep#198 MTR failed: query 'reap' fa partition : MDEV-19958 Galera test failure on galera.partition query_cache: MDEV-15805 Test failure on galera.query_cache sql_log_bin : MDEV-21491 galera.sql_log_bin -versioning_trx_id : MDEV-18590 galera.versioning_trx_id +versioning_trx_id: MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch +galera_wsrep_provider_unset_set: wsrep_provider is read-only for security reasons +pxc-421: wsrep_provider is read-only for security reasons diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_load_provider.inc index 0f843597d9c..b9b201106d7 100644 --- a/mysql-test/suite/galera/include/galera_load_provider.inc +++ b/mysql-test/suite/galera/include/galera_load_provider.inc @@ -1,8 +1,6 @@ --echo Loading wsrep provider ... --disable_query_log ---eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; - # # count occurences of successful node starts in error log # diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_unload_provider.inc index cd841f51fbc..ed7e9bc41f0 100644 --- a/mysql-test/suite/galera/include/galera_unload_provider.inc +++ b/mysql-test/suite/galera/include/galera_unload_provider.inc @@ -1,7 +1,6 @@ --echo Unloading wsrep provider ... --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` ---let $wsrep_provider_orig = `SELECT @@wsrep_provider` --let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` --let $wsrep_error_log_orig = `SELECT @@log_error` if(!$wsrep_log_error_orig) @@ -12,4 +11,4 @@ if(!$wsrep_log_error_orig) } --let LOG_FILE= $wsrep_log_error_orig -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup.result b/mysql-test/suite/galera/r/galera_ist_mariabackup.result index 13f7d898a59..70a87c73df7 100644 --- a/mysql-test/suite/galera/r/galera_ist_mariabackup.result +++ b/mysql-test/suite/galera/r/galera_ist_mariabackup.result @@ -23,7 +23,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result index 13f7d898a59..70a87c73df7 100644 --- a/mysql-test/suite/galera/r/galera_ist_rsync.result +++ b/mysql-test/suite/galera/r/galera_ist_rsync.result @@ -23,7 +23,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/r/galera_kill_nochanges.result b/mysql-test/suite/galera/r/galera_kill_nochanges.result index 8795608a303..f7478e29fd8 100644 --- a/mysql-test/suite/galera/r/galera_kill_nochanges.result +++ b/mysql-test/suite/galera/r/galera_kill_nochanges.result @@ -1,3 +1,5 @@ +connection node_2; +connection node_1; connection node_1; connection node_2; connection node_1; diff --git a/mysql-test/suite/galera/r/galera_split_brain.result b/mysql-test/suite/galera/r/galera_split_brain.result index 7c669e5516a..bd8c3a5bc44 100644 --- a/mysql-test/suite/galera/r/galera_split_brain.result +++ b/mysql-test/suite/galera/r/galera_split_brain.result @@ -1,3 +1,5 @@ +connection node_2; +connection node_1; connection node_1; connection node_2; call mtr.add_suppression("WSREP: TO isolation failed for: "); @@ -6,7 +8,7 @@ connection node_2; Killing server ... connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; -ERROR 40001: WSREP replication failed. Check your wsrep connection state and retry the query. +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction connection node_2; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; disconnect node_2; diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result index b24671d120d..818469bf6ad 100644 --- a/mysql-test/suite/galera/r/galera_ssl_upgrade.result +++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result @@ -4,12 +4,21 @@ VARIABLE_VALUE = 'Synced' SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_1; +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*"); +connection node_2; +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*"); +connection node_1; +connection node_2; +connection node_1; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_2; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_1; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result index 4ed679ba477..145b3a94775 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result @@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/r/galera_truncate.result b/mysql-test/suite/galera/r/galera_truncate.result index c649d9bbaf9..c9a4bc854f8 100644 --- a/mysql-test/suite/galera/r/galera_truncate.result +++ b/mysql-test/suite/galera/r/galera_truncate.result @@ -32,6 +32,17 @@ SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t AUTO_INCREMENT = 1 1 1 +connection node_1; +TRUNCATE TABLE mysql.user; +ERROR 42S02: Table 'mysql.user' doesn't exist +TRUNCATE TABLE performance_schema.threads; +ERROR HY000: Invalid performance_schema usage +TRUNCATE TABLE information_schema.tables; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +TRUNCATE TABLE mysql.innodb_index_stats; +TRUNCATE TABLE foo.bar; +ERROR 42S02: Table 'foo.bar' doesn't exist +TRUNCATE TABLE t1; DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_provider_options.result b/mysql-test/suite/galera/r/galera_var_wsrep_provider_options.result new file mode 100644 index 00000000000..5ef4a23fd90 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_var_wsrep_provider_options.result @@ -0,0 +1,10 @@ +connection node_2; +connection node_1; +call mtr.add_suppression("WSREP: Unknown parameter 'a'"); +call mtr.add_suppression("WSREP: Set options returned 7"); +SET GLOBAL wsrep_provider_options=NULL; +ERROR HY000: Incorrect arguments to SET +SET GLOBAL wsrep_provider_options=''; +SET GLOBAL wsrep_provider_options=' '; +SET GLOBAL wsrep_provider_options='a=1'; +ERROR HY000: Incorrect arguments to SET diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result index fb0b593cc96..45c6a3f660a 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#33.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result @@ -32,7 +32,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test index 91a2cc326a2..6a822b8f127 100644 --- a/mysql-test/suite/galera/t/galera_split_brain.test +++ b/mysql-test/suite/galera/t/galera_split_brain.test @@ -26,18 +26,13 @@ call mtr.add_suppression("WSREP: TO isolation failed for: "); CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; # Reset the master and restart the slave so that post-test checks can run - - --connection node_2 --source include/start_mysqld.inc ---sleep 5 --source include/wait_until_connected_again.inc --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc ---sleep 10 - --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 --source include/wait_until_connected_again.inc @@ -46,4 +41,3 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; --source include/auto_increment_offset_restore.inc --source include/galera_end.inc - diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf index 3fd1c650c05..2954ae0f4cb 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test index 2ce932b5398..3adb208e442 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -6,15 +6,31 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_ssl_communication.inc SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--connection node_1 +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*"); +--connection node_2 +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*"); + +# Setup galera ports +--connection node_1 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT + +--connection node_2 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT + # 2. Restart node #1 with a socket.ssl_ca that includes both the new and the old certificate --connection node_1 --source include/shutdown_mysqld.inc ---let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/cakey.pem +--let $restart_noprint = 1 +--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem --source include/start_mysqld.inc --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/galera/t/galera_truncate.test b/mysql-test/suite/galera/t/galera_truncate.test index f490943db7c..0000b430e45 100644 --- a/mysql-test/suite/galera/t/galera_truncate.test +++ b/mysql-test/suite/galera/t/galera_truncate.test @@ -3,8 +3,7 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc - +--source include/have_perfschema.inc # # Simple case # @@ -57,6 +56,23 @@ TRUNCATE TABLE t4; --connection node_2 SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t3', 't4'); + +# +# MDEV-24865 : Server crashes when truncate mysql user table +# +--connection node_1 + +--error ER_NO_SUCH_TABLE +TRUNCATE TABLE mysql.user; +--error ER_WRONG_PERFSCHEMA_USAGE +TRUNCATE TABLE performance_schema.threads; +--error ER_DBACCESS_DENIED_ERROR +TRUNCATE TABLE information_schema.tables; +TRUNCATE TABLE mysql.innodb_index_stats; +--error ER_NO_SUCH_TABLE +TRUNCATE TABLE foo.bar; +TRUNCATE TABLE t1; + DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; diff --git a/mysql-test/suite/galera/t/galera_var_wsrep_provider_options.test b/mysql-test/suite/galera/t/galera_var_wsrep_provider_options.test new file mode 100644 index 00000000000..3dc2cbaa7d6 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_wsrep_provider_options.test @@ -0,0 +1,11 @@ +--source include/galera_cluster.inc + +call mtr.add_suppression("WSREP: Unknown parameter 'a'"); +call mtr.add_suppression("WSREP: Set options returned 7"); + +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_provider_options=NULL; +SET GLOBAL wsrep_provider_options=''; +SET GLOBAL wsrep_provider_options=' '; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_provider_options='a=1'; diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index 26b091c31bf..f69efbde076 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -20,6 +20,7 @@ galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0 galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query galera_pc_bootstrap : MDEV-24650 galera_pc_bootstrap MTR failed: Could not execute 'check-testcase' before testcase +galera_safe_to_bootstrap : MDEV-24097 galera_3nodes.galera_safe_to_bootstrap MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed galera_slave_options_do : MDEV-8798 galera_slave_options_ignore : MDEV-8798 galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed diff --git a/mysql-test/suite/innodb/r/alter_large_dml.result b/mysql-test/suite/innodb/r/alter_large_dml.result index 056e8fdd768..41f497a5591 100644 --- a/mysql-test/suite/innodb/r/alter_large_dml.result +++ b/mysql-test/suite/innodb/r/alter_large_dml.result @@ -14,16 +14,10 @@ SET DEBUG_SYNC = 'now SIGNAL dml_pause'; SET DEBUG_SYNC = 'now WAIT_FOR dml_restart'; ROLLBACK; BEGIN; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_81920; ROLLBACK; BEGIN; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_114688; ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL dml_done'; connect con2, localhost,root,,test; diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result index 58e2b22273b..aec2964121b 100644 --- a/mysql-test/suite/innodb/r/alter_table.result +++ b/mysql-test/suite/innodb/r/alter_table.result @@ -70,6 +70,27 @@ ERROR HY000: Tablespace has been discarded for table `t` ALTER TABLE t FORCE; ERROR HY000: Tablespace has been discarded for table `t` DROP TABLE t; +# +# MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS +# +CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a)) +ENGINE=InnoDB; +ALTER TABLE t1 CHANGE COLUMN a u INT; +SELECT sf.* FROM information_schema.innodb_sys_fields sf +INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id +INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id +WHERE st.name='test/t1' ORDER BY sf.index_id,sf.pos; +INDEX_ID NAME POS +ID b 0 +ID c 0 +ID u 1 +DROP TABLE t1; +# +# End of 10.2 tests +# +# +# Check that innodb supports transactional=1 +# create table t1 (a int) transactional=1 engine=aria; create table t2 (a int) transactional=1 engine=innodb; show create table t1; @@ -86,6 +107,9 @@ alter table t1 engine=innodb; alter table t1 add column b int; drop table t1,t2; # +# End of 10.4 tests +# +# # MDEV-21748 ASAN use-after-poison in PageBulk::insertPage() # CREATE TABLE t1 (pk TIMESTAMP PRIMARY KEY, a TIMESTAMP NULL UNIQUE) diff --git a/mysql-test/suite/innodb/r/alter_varchar_change.result b/mysql-test/suite/innodb/r/alter_varchar_change.result index ddf0449a040..9bf0d126588 100644 --- a/mysql-test/suite/innodb/r/alter_varchar_change.result +++ b/mysql-test/suite/innodb/r/alter_varchar_change.result @@ -492,11 +492,18 @@ DROP TABLE t1; DROP PROCEDURE get_index_id; DROP PROCEDURE get_table_id; create table t (a varchar(100)) engine=innodb; -select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a'; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; name pos mtype prtype len a 0 1 524303 100 alter table t modify a varchar(110), algorithm=inplace; -select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a'; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; name pos mtype prtype len a 0 1 524303 110 drop table t; +# End of 10.2 tests diff --git a/mysql-test/suite/innodb/r/page_cleaner.result b/mysql-test/suite/innodb/r/page_cleaner.result new file mode 100644 index 00000000000..97dd012054b --- /dev/null +++ b/mysql-test/suite/innodb/r/page_cleaner.result @@ -0,0 +1,14 @@ +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; +SET GLOBAL innodb_max_dirty_pages_pct=0.0; +SET GLOBAL innodb_max_dirty_pages_pct=90.0; +CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_10000; +SELECT variable_value>0 FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; +variable_value>0 +1 +SET GLOBAL innodb_max_dirty_pages_pct=0.0; +DROP TABLE t; +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; diff --git a/mysql-test/suite/innodb/t/alter_large_dml.test b/mysql-test/suite/innodb/t/alter_large_dml.test index e44adf2c3ba..d8b288e5a9f 100644 --- a/mysql-test/suite/innodb/t/alter_large_dml.test +++ b/mysql-test/suite/innodb/t/alter_large_dml.test @@ -27,17 +27,11 @@ SET DEBUG_SYNC = 'now WAIT_FOR dml_restart'; ROLLBACK; BEGIN; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_81920; ROLLBACK; BEGIN; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_114688; ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL dml_done'; diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test index ec01d34fdd8..53a9dbfea03 100644 --- a/mysql-test/suite/innodb/t/alter_table.test +++ b/mysql-test/suite/innodb/t/alter_table.test @@ -80,9 +80,26 @@ ALTER TABLE t ENGINE INNODB; ALTER TABLE t FORCE; DROP TABLE t; -# -# Check that innodb supports transactional=1 -# +--echo # +--echo # MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS +--echo # +CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a)) +ENGINE=InnoDB; +ALTER TABLE t1 CHANGE COLUMN a u INT; +--replace_column 1 ID +SELECT sf.* FROM information_schema.innodb_sys_fields sf +INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id +INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id +WHERE st.name='test/t1' ORDER BY sf.index_id,sf.pos; +DROP TABLE t1; + +--echo # +--echo # End of 10.2 tests +--echo # + +--echo # +--echo # Check that innodb supports transactional=1 +--echo # create table t1 (a int) transactional=1 engine=aria; create table t2 (a int) transactional=1 engine=innodb; @@ -93,6 +110,10 @@ alter table t1 add column b int; drop table t1,t2; --echo # +--echo # End of 10.4 tests +--echo # + +--echo # --echo # MDEV-21748 ASAN use-after-poison in PageBulk::insertPage() --echo # CREATE TABLE t1 (pk TIMESTAMP PRIMARY KEY, a TIMESTAMP NULL UNIQUE) diff --git a/mysql-test/suite/innodb/t/alter_varchar_change.test b/mysql-test/suite/innodb/t/alter_varchar_change.test index 65dc38a3411..d1ce5d7403e 100644 --- a/mysql-test/suite/innodb/t/alter_varchar_change.test +++ b/mysql-test/suite/innodb/t/alter_varchar_change.test @@ -361,7 +361,15 @@ DROP PROCEDURE get_table_id; # LEN must increase here create table t (a varchar(100)) engine=innodb; -select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a'; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; alter table t modify a varchar(110), algorithm=inplace; -select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a'; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; drop table t; + +--echo # End of 10.2 tests diff --git a/mysql-test/suite/innodb/t/innodb_bug60049-master.opt b/mysql-test/suite/innodb/t/innodb_bug60049-master.opt deleted file mode 100644 index 22a5d4ed221..00000000000 --- a/mysql-test/suite/innodb/t/innodb_bug60049-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_fast_shutdown=0 diff --git a/mysql-test/suite/innodb/t/innodb_bug60049.test b/mysql-test/suite/innodb/t/innodb_bug60049.test deleted file mode 100644 index cb05ca297ea..00000000000 --- a/mysql-test/suite/innodb/t/innodb_bug60049.test +++ /dev/null @@ -1,49 +0,0 @@ -# Bug #60049 Verify that purge leaves no garbage in unique secondary indexes -# This test requires a fresh server start-up and a slow shutdown. -# This was a suspected bug (not a bug). - --- source include/not_embedded.inc --- source include/have_innodb.inc --- source include/have_innodb_16k.inc - --- disable_query_log -call mtr.add_suppression('\\[ERROR\\] InnoDB: Table `mysql`.`innodb_(table|index)_stats` not found'); -call mtr.add_suppression('\\[ERROR\\] InnoDB: Fetch of persistent statistics requested for table `mysql`.`gtid_executed`'); - -let $create1 = query_get_value(SHOW CREATE TABLE mysql.innodb_table_stats, Create Table, 1); -let $create2 = query_get_value(SHOW CREATE TABLE mysql.innodb_index_stats, Create Table, 1); -DROP TABLE mysql.innodb_index_stats; -DROP TABLE mysql.innodb_table_stats; --- enable_query_log - -CREATE TABLE t(a INT)ENGINE=InnoDB STATS_PERSISTENT=0; -RENAME TABLE t TO u; -DROP TABLE u; -SELECT @@innodb_fast_shutdown; -let $MYSQLD_DATADIR=`select @@datadir`; - ---source include/shutdown_mysqld.inc - -# Check the tail of ID_IND (SYS_TABLES.ID) -let IBDATA1=$MYSQLD_DATADIR/ibdata1; -perl; -my $file = $ENV{'IBDATA1'}; -open(FILE, "<$file") || die "Unable to open $file"; -# Read DICT_HDR_TABLE_IDS, the root page number of ID_IND (SYS_TABLES.ID). -seek(FILE, 7*16384+38+36, 0) || die "Unable to seek $file"; -die unless read(FILE, $_, 4) == 4; -my $sys_tables_id_root = unpack("N", $_); -print "Last record of ID_IND root page ($sys_tables_id_root):\n"; -# This should be the last record in ID_IND. Dump it in hexadecimal. -seek(FILE, $sys_tables_id_root*16384 + 152, 0) || die "Unable to seek $file"; -read(FILE, $_, 32) || die "Unable to read $file"; -close(FILE); -print unpack("H*", $_), "\n"; -EOF - ---source include/start_mysqld.inc - --- disable_query_log -USE mysql; -eval $create1; -eval $create2; diff --git a/mysql-test/suite/innodb/t/page_cleaner.test b/mysql-test/suite/innodb/t/page_cleaner.test new file mode 100644 index 00000000000..f597619aa08 --- /dev/null +++ b/mysql-test/suite/innodb/t/page_cleaner.test @@ -0,0 +1,30 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc + +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; + +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; +SET GLOBAL innodb_max_dirty_pages_pct=0.0; + +let $wait_condition = +SELECT variable_value = 0 +FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; +--source include/wait_condition.inc + +SET GLOBAL innodb_max_dirty_pages_pct=90.0; + +CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_10000; + +SELECT variable_value>0 FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; + +SET GLOBAL innodb_max_dirty_pages_pct=0.0; + +# Without the MDEV-24917 fix, we would time out here. +--source include/wait_condition.inc +DROP TABLE t; + +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; diff --git a/mysql-test/suite/innodb_gis/t/rtree_purge.test b/mysql-test/suite/innodb_gis/t/rtree_purge.test index 42f00428b88..60ecbe2e53a 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_purge.test +++ b/mysql-test/suite/innodb_gis/t/rtree_purge.test @@ -1,7 +1,7 @@ # This test case will test R-tree purge. --source include/innodb_page_size.inc -# Valgrind takes too much time on PB2 even in the --big-test runs. +--source include/have_sequence.inc --source include/not_valgrind.inc SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; @@ -16,9 +16,7 @@ set @p=point(1,1); let $n=200; while ($n) { begin; -insert into t values(@p,@p),(@p,@p); -insert into t select @p,@p -from t a,t b,t c,t d,t e,t f,t g; +insert into t select @p,@p from seq_1_to_130; delete from t; commit; dec $n; diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result index 5439bdef72c..48cec72d917 100644 --- a/mysql-test/suite/rpl/r/rpl_change_master.result +++ b/mysql-test/suite/rpl/r/rpl_change_master.result @@ -22,4 +22,8 @@ n connection master; drop table t1; connection slave; +connection master; +CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='', +MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH=''; +CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test index 5e170d5acce..9ab49a585e6 100644 --- a/mysql-test/suite/rpl/t/rpl_change_master.test +++ b/mysql-test/suite/rpl/t/rpl_change_master.test @@ -101,4 +101,11 @@ connection master; drop table t1; } +--connection master +# MDEV-22741: *SAN: ERROR: AddressSanitizer: use-after-poison on address in +# instrings/strmake.c:36 from change_master (on optimized builds) +CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='', + MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH=''; +CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0; + --source include/rpl_end.inc diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result index 64477f0535b..411de902799 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result @@ -418,7 +418,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL -READ_ONLY NO +READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED GLOBAL_VALUE_PATH NULL VARIABLE_NAME WSREP_ON @@ -478,7 +478,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL -READ_ONLY NO +READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED GLOBAL_VALUE_PATH NULL VARIABLE_NAME WSREP_PROVIDER_OPTIONS diff --git a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result b/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result deleted file mode 100644 index 056ff8c817b..00000000000 --- a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result +++ /dev/null @@ -1,47 +0,0 @@ -# -# wsrep_notify_cmd -# -call mtr.add_suppression("WSREP: Failed to get provider options"); -# save the initial value -SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; -# default -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd - - -# scope -SELECT @@session.wsrep_notify_cmd; -ERROR HY000: Variable 'wsrep_notify_cmd' is a GLOBAL variable -SET @@global.wsrep_notify_cmd='notify_cmd'; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -notify_cmd - -# valid values -SET @@global.wsrep_notify_cmd='command'; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -command -SET @@global.wsrep_notify_cmd='hyphenated-command'; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -hyphenated-command -SET @@global.wsrep_notify_cmd=default; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd - -SET @@global.wsrep_notify_cmd=NULL; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -NULL - -# invalid values -SET @@global.wsrep_notify_cmd=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_notify_cmd' -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -NULL - -# restore the initial value -SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result deleted file mode 100644 index 3e4ac8ca883..00000000000 --- a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result +++ /dev/null @@ -1,40 +0,0 @@ -# -# wsrep_provider -# -# save the initial value -SET @wsrep_provider_global_saved = @@global.wsrep_provider; -# default -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# scope -SELECT @@session.wsrep_provider; -ERROR HY000: Variable 'wsrep_provider' is a GLOBAL variable -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# valid values -SET @@global.wsrep_provider=default; -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# invalid values -SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; -ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/invalid/libgalera_smm.so' -SET @@global.wsrep_provider=NULL; -ERROR 42000: Variable 'wsrep_provider' can't be set to the value of 'NULL' -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none -SET @@global.wsrep_provider=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_provider' -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# restore the initial value -SET @@global.wsrep_provider = @wsrep_provider_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result deleted file mode 100644 index 15949a14e39..00000000000 --- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result +++ /dev/null @@ -1,46 +0,0 @@ -# -# wsrep_provider_options -# -call mtr.add_suppression("WSREP: Failed to get provider options"); -# default -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - - -# scope -SELECT @@session.wsrep_provider_options; -ERROR HY000: Variable 'wsrep_provider_options' is a GLOBAL variable -SET @@global.wsrep_provider_options='option1'; -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - - -# valid values -SET @@global.wsrep_provider_options='name1=value1;name2=value2'; -ERROR HY000: WSREP (galera) not started -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - -SET @@global.wsrep_provider_options='hyphenated-name:value'; -ERROR HY000: WSREP (galera) not started -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - -SET @@global.wsrep_provider_options=default; -ERROR HY000: WSREP (galera) not started -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - - -# invalid values -SET @@global.wsrep_provider_options=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_provider_options' -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - -SET @@global.wsrep_provider_options=NULL; -Got one of the listed errors -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - -# End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test b/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test deleted file mode 100644 index 6d1535ba148..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test +++ /dev/null @@ -1,43 +0,0 @@ ---source include/have_wsrep.inc - ---echo # ---echo # wsrep_notify_cmd ---echo # - -call mtr.add_suppression("WSREP: Failed to get provider options"); - ---echo # save the initial value -SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; - ---echo # default -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd='notify_cmd'; -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # valid values -SET @@global.wsrep_notify_cmd='command'; -SELECT @@global.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd='hyphenated-command'; -SELECT @@global.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd=default; -SELECT @@global.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd=NULL; -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # invalid values ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_notify_cmd=1; -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # restore the initial value -SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; - ---echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test deleted file mode 100644 index 1190ab41bb0..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test +++ /dev/null @@ -1,39 +0,0 @@ ---source include/have_wsrep.inc - ---echo # ---echo # wsrep_provider ---echo # - ---echo # save the initial value -SET @wsrep_provider_global_saved = @@global.wsrep_provider; - ---echo # default -SELECT @@global.wsrep_provider; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.wsrep_provider; -SELECT @@global.wsrep_provider; - ---echo ---echo # valid values -SET @@global.wsrep_provider=default; -SELECT @@global.wsrep_provider; - ---echo ---echo # invalid values ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.wsrep_provider=NULL; -SELECT @@global.wsrep_provider; ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_provider=1; -SELECT @@global.wsrep_provider; - ---echo ---echo # restore the initial value -SET @@global.wsrep_provider = @wsrep_provider_global_saved; - ---echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test deleted file mode 100644 index 6eb3a94b6a4..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test +++ /dev/null @@ -1,41 +0,0 @@ ---source include/have_wsrep.inc - ---echo # ---echo # wsrep_provider_options ---echo # - -call mtr.add_suppression("WSREP: Failed to get provider options"); - ---echo # default -SELECT @@global.wsrep_provider_options; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.wsrep_provider_options; ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options='option1'; -SELECT @@global.wsrep_provider_options; - ---echo ---echo # valid values ---error ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options='name1=value1;name2=value2'; -SELECT @@global.wsrep_provider_options; ---error ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options='hyphenated-name:value'; -SELECT @@global.wsrep_provider_options; ---error ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options=default; -SELECT @@global.wsrep_provider_options; - ---echo ---echo # invalid values ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_provider_options=1; -SELECT @@global.wsrep_provider_options; ---error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options=NULL; -SELECT @@global.wsrep_provider_options; - ---echo # End of test diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def index 11577bfe8b0..a1c8165d165 100644 --- a/mysql-test/suite/wsrep/disabled.def +++ b/mysql-test/suite/wsrep/disabled.def @@ -10,3 +10,7 @@ # ############################################################################## + +mdev_6832: wsrep_provider is read-only for security reasons +MDEV-23092: wsrep_provider is read-only for security reasons +wsrep_variables_no_provider: wsrep_provider is read-only for security reasons diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index 9ef1b3290af..df7ca3787aa 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -14,7 +14,6 @@ SET SESSION wsrep_replicate_myisam= ON; ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL SET GLOBAL wsrep_replicate_myisam= ON; SET GLOBAL wsrep_replicate_myisam= OFF; -SET GLOBAL wsrep_provider=none; # # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of # variables when using "_" @@ -26,7 +25,6 @@ wsrep_local_state_comment # # Should show nothing. SHOW STATUS LIKE 'x'; Variable_name Value -SET GLOBAL wsrep_provider=none; SHOW STATUS LIKE 'wsrep_local_state_uuid'; Variable_name Value @@ -35,7 +33,6 @@ wsrep_local_state_uuid # SHOW STATUS LIKE 'wsrep_last_committed'; Variable_name Value wsrep_last_committed # -SET GLOBAL wsrep_provider=none; # # MDEV#6206: wsrep_slave_threads subtracts from max_connections @@ -49,7 +46,7 @@ SELECT @@global.wsrep_slave_threads; 1 SELECT @@global.wsrep_cluster_address; @@global.wsrep_cluster_address - +gcomm:// SELECT @@global.wsrep_on; @@global.wsrep_on 1 @@ -58,14 +55,14 @@ Variable_name Value Threads_connected 1 SHOW STATUS LIKE 'wsrep_thread_count'; Variable_name Value -wsrep_thread_count 0 +wsrep_thread_count 2 SELECT @@global.wsrep_provider; @@global.wsrep_provider libgalera_smm.so SELECT @@global.wsrep_cluster_address; @@global.wsrep_cluster_address - +gcomm:// SELECT @@global.wsrep_on; @@global.wsrep_on 1 @@ -74,11 +71,10 @@ Variable_name Value Threads_connected 1 SHOW STATUS LIKE 'wsrep_thread_count'; Variable_name Value -wsrep_thread_count 0 +wsrep_thread_count 2 # Setting wsrep_cluster_address triggers the creation of # applier/rollbacker threads. -SET GLOBAL wsrep_cluster_address= 'gcomm://'; # Wait for applier thread to get created 1. # Wait for applier thread to get created 2. SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; @@ -136,16 +132,7 @@ drop user test@localhost; # SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= 'user:pass'; -SELECT @@global.wsrep_sst_auth; -@@global.wsrep_sst_auth -******** SET @@global.wsrep_sst_auth= ''; -SELECT @@global.wsrep_sst_auth; -@@global.wsrep_sst_auth -NULL SET @@global.wsrep_sst_auth= NULL; -SELECT @@global.wsrep_sst_auth; -@@global.wsrep_sst_auth -NULL SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved; # End of test. diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index cae2fe5d6db..6b767c60979 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -22,7 +22,7 @@ SET GLOBAL wsrep_replicate_myisam= ON; # Reset it back. SET GLOBAL wsrep_replicate_myisam= OFF; -SET GLOBAL wsrep_provider=none; +#SET GLOBAL wsrep_provider=none; --echo # --echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of @@ -31,9 +31,7 @@ SET GLOBAL wsrep_provider=none; CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*"); ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --replace_column 2 # SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment'; @@ -42,11 +40,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment'; SHOW STATUS LIKE 'x'; # Reset it back. -SET GLOBAL wsrep_provider=none; +#SET GLOBAL wsrep_provider=none; ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; # The following 2 variables are used by mariabackup # SST. @@ -58,7 +54,7 @@ SHOW STATUS LIKE 'wsrep_local_state_uuid'; SHOW STATUS LIKE 'wsrep_last_committed'; # Reset it back. -SET GLOBAL wsrep_provider=none; +#SET GLOBAL wsrep_provider=none; --echo --echo # @@ -66,9 +62,7 @@ SET GLOBAL wsrep_provider=none; --echo # call mtr.add_suppression("WSREP: Failed to get provider options"); ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --replace_regex /.*libgalera.*smm.*/libgalera_smm.so/ SELECT @@global.wsrep_provider; @@ -79,9 +73,7 @@ SHOW STATUS LIKE 'threads_connected'; SHOW STATUS LIKE 'wsrep_thread_count'; --echo ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --replace_regex /.*libgalera.*smm.*/libgalera_smm.so/ SELECT @@global.wsrep_provider; @@ -93,7 +85,7 @@ SHOW STATUS LIKE 'wsrep_thread_count'; --echo # Setting wsrep_cluster_address triggers the creation of --echo # applier/rollbacker threads. -SET GLOBAL wsrep_cluster_address= 'gcomm://'; +#SET GLOBAL wsrep_cluster_address= 'gcomm://'; --echo # Wait for applier thread to get created 1. --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; @@ -147,22 +139,10 @@ drop user test@localhost; --echo # SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= 'user:pass'; -SELECT @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= ''; -SELECT @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= NULL; -SELECT @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved; -# Reset (for mtr internal checks) - ---disable_query_log -SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved; -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; -SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved; -SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved; ---enable_query_log - --source include/galera_wait_ready.inc --echo # End of test. |