diff options
-rw-r--r-- | cmake/maintainer.cmake | 12 | ||||
-rw-r--r-- | mysql-test/lib/My/Tee.pm | 2 | ||||
-rw-r--r-- | mysql-test/lib/mtr_report.pm | 90 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 8 | ||||
-rw-r--r-- | mysql-test/r/index_merge_myisam.result | 53 | ||||
-rw-r--r-- | mysql-test/r/mysqldump.result | 2 | ||||
-rw-r--r-- | mysql-test/r/range.result | 20 | ||||
-rw-r--r-- | mysql-test/r/range_innodb.result | 28 | ||||
-rw-r--r-- | mysql-test/r/range_mrr_icp.result | 20 | ||||
-rw-r--r-- | mysql-test/r/range_vs_index_merge.result | 2 | ||||
-rw-r--r-- | mysql-test/t/index_merge_myisam.test | 51 | ||||
-rw-r--r-- | mysql-test/t/range.test | 16 | ||||
-rw-r--r-- | mysql-test/t/range_innodb.test | 28 | ||||
-rw-r--r-- | scripts/galera_recovery.sh | 3 | ||||
-rw-r--r-- | sql/opt_range.cc | 23 | ||||
-rw-r--r-- | support-files/mariadb.service.in | 2 | ||||
-rw-r--r-- | support-files/mariadb@.service.in | 4 | ||||
-rw-r--r-- | support-files/rpm/my.cnf | 2 | ||||
-rw-r--r-- | win/packaging/heidisql.cmake | 2 | ||||
-rw-r--r-- | win/packaging/heidisql.wxi.in | 28 |
20 files changed, 366 insertions, 30 deletions
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index 8c2deeb8e40..9c51cb797bb 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -1,4 +1,5 @@ # Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, MariaDB # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,11 +29,16 @@ SET(MY_WARNING_FLAGS -Woverloaded-virtual -Wvla -Wwrite-strings - -Werror ) +FOREACH(F ${MY_WARNING_FLAGS}) + MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO) +ENDFOREACH() + +SET(MY_ERROR_FLAGS -Werror) + IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") - SET(MY_WARNING_FLAGS ${MY_WARNING_FLAGS} -Wno-error=maybe-uninitialized) + SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized) ENDIF() IF(MYSQL_MAINTAINER_MODE MATCHES "OFF") @@ -41,7 +47,7 @@ ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO") SET(WHERE DEBUG) ENDIF() -FOREACH(F ${MY_WARNING_FLAGS}) +FOREACH(F ${MY_ERROR_FLAGS}) MY_CHECK_AND_SET_COMPILER_FLAG(${F} ${WHERE}) ENDFOREACH() diff --git a/mysql-test/lib/My/Tee.pm b/mysql-test/lib/My/Tee.pm index 5985fe33739..8d6b4ddd52f 100644 --- a/mysql-test/lib/My/Tee.pm +++ b/mysql-test/lib/My/Tee.pm @@ -10,7 +10,7 @@ sub PUSHED open($copyfh, '>', "$::opt_vardir/log/stdout.log") or die "open(>$::opt_vardir/log/stdout.log): $!" unless $copyfh; - bless { }, shift; + bless { }, shift; } sub WRITE diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 3701ad79b15..a3282704dd2 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -20,7 +20,9 @@ # same name. package mtr_report; + use strict; +use Sys::Hostname; use base qw(Exporter); our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line @@ -253,6 +255,7 @@ sub mtr_report_stats ($$$$) { # Find out how we where doing # ---------------------------------------------------------------------- + my $tot_disabled = 0; my $tot_skipped= 0; my $tot_skipdetect= 0; my $tot_passed= 0; @@ -273,6 +276,7 @@ sub mtr_report_stats ($$$$) { { # Test was skipped (disabled not counted) $tot_skipped++ unless $tinfo->{'disable'}; + $tot_disabled++ if $tinfo->{'disable'}; $tot_skipdetect++ if $tinfo->{'skip_detected_by_test'}; } elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' ) @@ -402,6 +406,92 @@ sub mtr_report_stats ($$$$) { print "All $tot_tests tests were successful.\n\n"; } + if ($::opt_xml_report) { + my $xml_report = ""; + my @sorted_tests = sort {$a->{'name'} cmp $b->{'name'}} @$tests; + my $last_suite = ""; + my $current_suite = ""; + my $timest = isotime(time); + my %suite_totals; + my %suite_time; + my %suite_tests; + my %suite_failed; + my %suite_disabled; + my %suite_skipped; + my $host = hostname; + my $suiteNo = 0; + + # loop through test results to count totals + foreach my $test ( @sorted_tests ) { + $current_suite = $test->{'suite'}->{'name'}; + + if ($test->{'timer'} eq "") { + $test->{'timer'} = 0; + } + + $suite_time{$current_suite} = $suite_time{$current_suite} + $test->{'timer'}; + $suite_tests{$current_suite} = $suite_tests{$current_suite} + 1; + + if ($test->{'result'} eq "MTR_RES_FAILED") { + $suite_failed{$current_suite} = $suite_failed{$current_suite} + 1; + } elsif ($test->{'result'} eq "MTR_RES_SKIPPED" && $test->{'disable'}) { + $suite_disabled{$current_suite} = $suite_disabled{$current_suite} + 1; + } elsif ($test->{'result'} eq "MTR_RES_SKIPPED") { + $suite_skipped{$current_suite} = $suite_skipped{$current_suite} + 1; + } + + $suite_totals{"all_time"} = $suite_totals{"all_time"} + $test->{'timer'}; + } + + my $all_time = sprintf("%.3f", $suite_totals{"all_time"} / 1000); + my $suite_time = 0; + my $test_time = 0; + + # generate xml + $xml_report = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; + $xml_report .= qq(<testsuites disabled="$tot_disabled" errors="" failures="$tot_failed" name="" tests="$tot_tests" time="$all_time">\n); + + foreach my $test ( @sorted_tests ) { + $current_suite = $test->{'suite'}->{'name'}; + + if ($current_suite ne $last_suite) { + if ($last_suite ne "") { + $xml_report .= "\t</testsuite>\n"; + $suiteNo++; + } + + $suite_time = sprintf("%.3f", $suite_time{$current_suite} / 1000); + $xml_report .= qq(\t<testsuite disabled="$suite_disabled{$current_suite}" errors="" failures="$suite_failed{$current_suite}" hostname="$host" id="$suiteNo" name="$current_suite" package="" skipped="$suite_skipped{$current_suite}" tests="$suite_tests{$current_suite}" time="$suite_time" timestamp="$timest">\n); + $last_suite = $current_suite; + } + + $test_time = sprintf("%.3f", $test->{timer} / 1000); + $xml_report .= qq(\t\t<testcase assertions="" classname="$current_suite" name="$test->{'name'}" status="$test->{'result'}" time="$test_time"); + + my $comment = $test->{'comment'}; + $comment =~ s/[\"]//g; + + if ($test->{'result'} eq "MTR_RES_FAILED") { + $xml_report .= qq(>\n\t\t\t<failure message="" type="$test->{'result'}">\n<![CDATA[$test->{'logfile'}]]>\n\t\t\t</failure>\n\t\t</testcase>\n); + } elsif ($test->{'result'} eq "MTR_RES_SKIPPED" && $test->{'disable'}) { + $xml_report .= qq(>\n\t\t\t<disabled message="$comment" type="$test->{'result'}"/>\n\t\t</testcase>\n); + } elsif ($test->{'result'} eq "MTR_RES_SKIPPED") { + $xml_report .= qq(>\n\t\t\t<skipped message="$comment" type="$test->{'result'}"/>\n\t\t</testcase>\n); + } else { + $xml_report .= " />\n"; + } + } + + $xml_report .= "\t</testsuite>\n</testsuites>\n"; + + # save to file + my $xml_file = $::opt_xml_report; + + open XML_FILE, ">", $xml_file or die "Cannot create file $xml_file: $!"; + print XML_FILE $xml_report; + close XML_FILE; + } + if (@$extra_warnings) { print <<MSG; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 2df95f9ffe7..2026f0aefed 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -128,6 +128,8 @@ our $path_testlog; our $default_vardir; our $opt_vardir; # Path to use for var/ dir our $plugindir; +our $opt_xml_report; # XML output + my $path_vardir_trace; # unix formatted opt_vardir for trace files my $opt_tmpdir; # Path to use for tmp/ dir my $opt_tmpdir_pid; @@ -730,7 +732,6 @@ sub main { mtr_print_line(); print_total_times($opt_parallel) if $opt_report_times; - mtr_report_stats($prefix, $fail, $completed, $extra_warnings); if ($opt_gcov) { @@ -1233,6 +1234,7 @@ sub print_global_resfile { resfile_global("warnings", $opt_warnings ? 1 : 0); resfile_global("max-connections", $opt_max_connections); resfile_global("product", "MySQL"); + resfile_global("xml-report", $opt_xml_report); # Somewhat hacky code to convert numeric version back to dot notation my $v1= int($mysql_version_id / 10000); my $v2= int(($mysql_version_id % 10000)/100); @@ -1398,7 +1400,8 @@ sub command_line_setup { 'help|h' => \$opt_usage, # list-options is internal, not listed in help 'list-options' => \$opt_list_options, - 'skip-test-list=s' => \@opt_skip_test_list + 'skip-test-list=s' => \@opt_skip_test_list, + 'xml-report=s' => \$opt_xml_report ); # fix options (that take an optional argument and *only* after = sign @@ -6603,6 +6606,7 @@ Misc options phases of test execution. stress=ARGS Run stress test, providing options to mysql-stress-test.pl. Options are separated by comma. + xml-report=<file> Output jUnit xml file of the results. Some options that control enabling a feature for normal test runs, can be turned off by prepending 'no' to the option, e.g. --notimer. diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index ccb7a65ecc3..5a23092457d 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -1688,6 +1688,58 @@ id select_type table type possible_keys key key_len ref rows Extra DROP TABLE t1; set optimizer_switch= @optimizer_switch_save; # +# MDEV-21932: ROR union with index_merge_sort_union=off +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +insert into t0 select a+10 from t0; +insert into t0 select a+20 from t0; +insert into t0 select a+40 from t0; +insert into t0 select a+80 from t0; +insert into t0 select a+160 from t0; +delete from t0 where a > 300; +create table t1 ( +f1 int, f2 int, f3 int, f4 int, +primary key (f1), key (f3), key(f4) +) engine=myisam; +insert into t1 select a+100, a+100, a+100, a+100 from t0; +insert into t1 VALUES (9,0,2,6), (9930,0,0,NULL); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +set optimizer_switch='index_merge_sort_union=off'; +set optimizer_switch='index_merge_union=on'; +explain select * from t1 +where (( f3 = 1 or f1 = 7 ) and f1 < 10) or +(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where +select * from t1 +where (( f3 = 1 or f1 = 7 ) and f1 < 10) or +(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); +f1 f2 f3 f4 +9 0 2 6 +insert into t1 values (52,0,1,0),(53,0,1,0); +insert into t1 values (50,0,1,0),(51,0,1,0); +insert into t1 values (48,0,1,0),(49,0,1,0); +insert into t1 values (46,0,1,0),(47,0,1,0); +insert into t1 values (44,0,1,0),(45,0,1,0); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +explain select * from t1 +where (( f3 = 1 or f1 = 7 ) and f1 < 10) or +(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 13 Using union(f3,PRIMARY,f3); Using where +select * from t1 +where (( f3 = 1 or f1 = 7 ) and f1 < 10) or +(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); +f1 f2 f3 f4 +9 0 2 6 +drop table t0,t1; +set optimizer_switch= @optimizer_switch_save; +# # MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union # create table t0 @@ -1722,3 +1774,4 @@ key1 key2 key3 key8 3 3 3 1021 set @@optimizer_switch= @optimizer_switch_save; drop table t0; +# End of 10.1 tests diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index e527dbffe43..bbd7163552e 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3756,7 +3756,7 @@ DROP TABLE t1; # CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2); -mysqldump: Input filename too long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ql-test/r/range.result index b55b462c8ef..26ea2c6d323 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2136,6 +2136,26 @@ value1 1003560 12345 value1 1004807 12345 drop table t1; # +# MDEV-22191: Range access is not picked when index_merge_sort_union is turned off +# +set @save_optimizer_switch=@@optimizer_switch; +set @save_optimizer_switch="index_merge_sort_union=OFF"; +CREATE TABLE t1 (a INT, INDEX(a)); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +explain +SELECT * FROM t1 WHERE a > 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 5 Using where; Using index +SELECT * FROM t1 WHERE a > 5; +a +6 +7 +8 +9 +set @@optimizer_switch=@save_optimizer_switch; +drop table t1; +# End of 5.5 tests +# # BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE # CREATE TABLE t1 (pk INT PRIMARY KEY); diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result index 38a8964bb61..f2349f26571 100644 --- a/mysql-test/r/range_innodb.result +++ b/mysql-test/r/range_innodb.result @@ -37,6 +37,33 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) drop table t0,t1,t2; +# +# MDEV-10466: constructing an invalid SEL_ARG +# +create table t1 ( +pk int, a int, b int, +primary key (pk), index idx1(b), index idx2(b) +) engine=innodb; +Warnings: +Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release +insert into t1 values (1,6,0),(2,1,0),(3,5,2),(4,8,0); +create table t2 (c int) engine=innodb; +insert into t2 values (1),(2); +create table t3 (d int) engine=innodb; +insert into t3 values (3),(-1),(4); +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='extended_keys=on'; +explain +select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 4 Using where; Using join buffer (incremental, BNL join) +select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0'; +pk a b +1 6 0 +set optimizer_switch=@save_optimizer_switch; +drop table t1,t2,t3; CREATE TABLE t1 ( pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1), KEY(f1), KEY(f2) @@ -80,3 +107,4 @@ ERROR HY000: Table definition has changed, please retry transaction DROP TABLE t0,t1; SET @@GLOBAL.debug_dbug = @saved_dbug; set @@optimizer_switch= @optimizer_switch_save; +# End of 10.1 tests diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 2584fc5a8bf..fe4eb99f31f 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2138,6 +2138,26 @@ value1 1003560 12345 value1 1004807 12345 drop table t1; # +# MDEV-22191: Range access is not picked when index_merge_sort_union is turned off +# +set @save_optimizer_switch=@@optimizer_switch; +set @save_optimizer_switch="index_merge_sort_union=OFF"; +CREATE TABLE t1 (a INT, INDEX(a)); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +explain +SELECT * FROM t1 WHERE a > 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 5 Using where; Using index +SELECT * FROM t1 WHERE a > 5; +a +6 +7 +8 +9 +set @@optimizer_switch=@save_optimizer_switch; +drop table t1; +# End of 5.5 tests +# # BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE # CREATE TABLE t1 (pk INT PRIMARY KEY); diff --git a/mysql-test/r/range_vs_index_merge.result b/mysql-test/r/range_vs_index_merge.result index 4f3c36b7660..faab314896c 100644 --- a/mysql-test/r/range_vs_index_merge.result +++ b/mysql-test/r/range_vs_index_merge.result @@ -1659,7 +1659,7 @@ SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 ); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,f3,f4 NULL NULL NULL 2 Using where +1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 ); diff --git a/mysql-test/t/index_merge_myisam.test b/mysql-test/t/index_merge_myisam.test index 2cee768706b..b2216bf9485 100644 --- a/mysql-test/t/index_merge_myisam.test +++ b/mysql-test/t/index_merge_myisam.test @@ -244,6 +244,55 @@ DROP TABLE t1; set optimizer_switch= @optimizer_switch_save; --echo # +--echo # MDEV-21932: ROR union with index_merge_sort_union=off +--echo # + +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +insert into t0 select a+10 from t0; +insert into t0 select a+20 from t0; +insert into t0 select a+40 from t0; +insert into t0 select a+80 from t0; +insert into t0 select a+160 from t0; +delete from t0 where a > 300; + +create table t1 ( + f1 int, f2 int, f3 int, f4 int, + primary key (f1), key (f3), key(f4) +) engine=myisam; +insert into t1 select a+100, a+100, a+100, a+100 from t0; +insert into t1 VALUES (9,0,2,6), (9930,0,0,NULL); +analyze table t1; + +set optimizer_switch='index_merge_sort_union=off'; +set optimizer_switch='index_merge_union=on'; + +let $q1= +select * from t1 + where (( f3 = 1 or f1 = 7 ) and f1 < 10) or + (f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); +eval explain $q1; +eval $q1; + +insert into t1 values (52,0,1,0),(53,0,1,0); +insert into t1 values (50,0,1,0),(51,0,1,0); +insert into t1 values (48,0,1,0),(49,0,1,0); +insert into t1 values (46,0,1,0),(47,0,1,0); +insert into t1 values (44,0,1,0),(45,0,1,0); +analyze table t1; + +let $q2= +select * from t1 + where (( f3 = 1 or f1 = 7 ) and f1 < 10) or + (f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); +eval explain $q2; +eval $q2; + +drop table t0,t1; + +set optimizer_switch= @optimizer_switch_save; + +--echo # --echo # MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union --echo # @@ -270,3 +319,5 @@ explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z. select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; set @@optimizer_switch= @optimizer_switch_save; drop table t0; + +--echo # End of 10.1 tests diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 2558ae4e404..67d876d5f10 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1721,6 +1721,22 @@ select * from t1; drop table t1; --echo # +--echo # MDEV-22191: Range access is not picked when index_merge_sort_union is turned off +--echo # + +set @save_optimizer_switch=@@optimizer_switch; +set @save_optimizer_switch="index_merge_sort_union=OFF"; +CREATE TABLE t1 (a INT, INDEX(a)); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +explain +SELECT * FROM t1 WHERE a > 5; +SELECT * FROM t1 WHERE a > 5; +set @@optimizer_switch=@save_optimizer_switch; +drop table t1; + +--echo # End of 5.5 tests + +--echo # --echo # BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE --echo # diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test index 928ed74f784..428e5c26e5c 100644 --- a/mysql-test/t/range_innodb.test +++ b/mysql-test/t/range_innodb.test @@ -46,6 +46,32 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250; drop table t0,t1,t2; + +--echo # +--echo # MDEV-10466: constructing an invalid SEL_ARG +--echo # + +create table t1 ( + pk int, a int, b int, + primary key (pk), index idx1(b), index idx2(b) +) engine=innodb; +insert into t1 values (1,6,0),(2,1,0),(3,5,2),(4,8,0); +create table t2 (c int) engine=innodb; +insert into t2 values (1),(2); +create table t3 (d int) engine=innodb; +insert into t3 values (3),(-1),(4); + +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='extended_keys=on'; + +explain +select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0'; +select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0'; + +set optimizer_switch=@save_optimizer_switch; + +drop table t1,t2,t3; + CREATE TABLE t1 ( pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1), KEY(f1), KEY(f2) @@ -88,3 +114,5 @@ select * from t1 where a=10 and b=10; DROP TABLE t0,t1; SET @@GLOBAL.debug_dbug = @saved_dbug; set @@optimizer_switch= @optimizer_switch_save; + +--echo # End of 10.1 tests diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh index 709c4b0eed5..8df2abc3fd5 100644 --- a/scripts/galera_recovery.sh +++ b/scripts/galera_recovery.sh @@ -101,8 +101,7 @@ wsrep_recover_position() { # Safety checks if [ -n "$log_file" -a -f "$log_file" ]; then - [ "$euid" = "0" ] && chown $user $log_file - chmod 600 $log_file + chmod 600 $log_file else log "WSREP: mktemp failed" fi diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 99508cf0b50..6663f092bc8 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -358,7 +358,8 @@ QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index, static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool index_read_must_be_used, bool update_tbl_stats, - double read_time); + double read_time, + bool ror_scans_required); static TRP_INDEX_INTERSECT *get_best_index_intersect(PARAM *param, SEL_TREE *tree, double read_time); @@ -2592,7 +2593,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, /* Get best 'range' plan and prepare data for making other plans */ if ((range_trp= get_key_scans_params(¶m, tree, FALSE, TRUE, - best_read_time))) + best_read_time, FALSE))) { best_trp= range_trp; best_read_time= best_trp->read_cost; @@ -4716,7 +4717,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, { DBUG_EXECUTE("info", print_sel_tree(param, *ptree, &(*ptree)->keys_map, "tree in SEL_IMERGE");); - if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE, read_time))) + if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE, + read_time, TRUE))) { /* One of index scans in this index_merge is more expensive than entire @@ -5038,7 +5040,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge, index merge retrievals are not well calibrated */ trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE, - read_time); + read_time, TRUE); } DBUG_RETURN(trp); @@ -6766,6 +6768,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, index_read_must_be_used if TRUE, assume 'index only' option will be set (except for clustered PK indexes) read_time don't create read plans with cost > read_time. + ror_scans_required set to TRUE for index merge RETURN Best range read plan NULL if no plan found or error occurred @@ -6774,7 +6777,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool index_read_must_be_used, bool update_tbl_stats, - double read_time) + double read_time, + bool ror_scans_required) { uint idx, UNINIT_VAR(best_idx); SEL_ARG *key_to_read= NULL; @@ -6822,6 +6826,13 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, update_tbl_stats, &mrr_flags, &buf_size, &cost); + if (ror_scans_required && !param->is_ror_scan && + !optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION)) + { + /* The scan is not a ROR-scan, just skip it */ + continue; + } + if (found_records != HA_POS_ERROR && tree->index_scans && (index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root, sizeof(INDEX_SCAN_INFO)))) @@ -9069,7 +9080,7 @@ key_and(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag) if (key2->next_key_part) { key1->use_count--; // Incremented in and_all_keys - return and_all_keys(param, key1, key2, clone_flag); + return and_all_keys(param, key1, key2->next_key_part, clone_flag); } key2->use_count--; // Key2 doesn't have a tree } diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index 49d7c3efb74..1c79a0d8678 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -75,7 +75,7 @@ PermissionsStartOnly=true # Do not panic if galera_recovery script is not available. (MDEV-10538) ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION" ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ - VAR=`@bindir@/galera_recovery`; [ $? -eq 0 ] \ + VAR=`cd @bindir@/..; @bindir@/galera_recovery`; [ $? -eq 0 ] \ && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1" # Needed to create system tables etc. diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 184298dab47..79402287592 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -84,14 +84,14 @@ PermissionsStartOnly=true ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I" ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ - VAR=`@bindir@/galera_recovery --defaults-file=@sysconf2dir@/my%I.cnf`; [ $? -eq 0 ] \ + VAR=`cd @bindir@/..; @bindir@/galera_recovery --defaults-file=@sysconf2dir@/my%I.cnf`; [ $? -eq 0 ] \ && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" # Alternate: (remove ConditionPathExists above) # use [mysqld.INSTANCENAME] as sections in my.cnf # #ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ -# VAR=`@bindir@/galera_recovery --defaults-group-suffix=%I`; [ $? -eq 0 ] \ +# VAR=`cd @bindir@/..; @bindir@/galera_recovery --defaults-group-suffix=%I`; [ $? -eq 0 ] \ # && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" # Needed to create system tables etc. diff --git a/support-files/rpm/my.cnf b/support-files/rpm/my.cnf index 913b88f8328..8c6a7139de5 100644 --- a/support-files/rpm/my.cnf +++ b/support-files/rpm/my.cnf @@ -5,7 +5,7 @@ [client-server] # -# include all files from the config directory +# include *.cnf from the config directory # !includedir /etc/my.cnf.d diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake index a3d884adb56..6290ada9704 100644 --- a/win/packaging/heidisql.cmake +++ b/win/packaging/heidisql.cmake @@ -1,4 +1,4 @@ -SET(HEIDISQL_BASE_NAME "HeidiSQL_10.2_32_Portable") +SET(HEIDISQL_BASE_NAME "HeidiSQL_11.0_32_Portable") SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip") SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}") SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME}) diff --git a/win/packaging/heidisql.wxi.in b/win/packaging/heidisql.wxi.in index 4244b47d0d8..58d95210783 100644 --- a/win/packaging/heidisql.wxi.in +++ b/win/packaging/heidisql.wxi.in @@ -33,20 +33,25 @@ <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts.heidisql" Value="1" Type="string" KeyPath="yes" /> <Shortcut Id="startmenuHeidiSQL" Directory="ShortcutFolder" Name="HeidiSQL" Target="[D.HeidiSQL]\heidisql.exe"/> </Component> + + <Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no"> <File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" /> </Component> + <Component Id="component.HeidiSQL_libmysql_6.1.dll" Guid="*" Win64="no"> + <File Id="heidisql.libmysql_6.1.dll" Name="libmysql-6.1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql-6.1.dll" /> + </Component> <Component Id="component.HeidiSQL_libmariadb.dll" Guid="*" Win64="no"> <File Id="heidisql.libmariadb.dll" Name="libmariadb.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmariadb.dll" /> </Component> - <Component Id="component.HeidiSQL_libeay32.dll" Guid="*" Win64="no"> - <File Id="heidisql.libeay32.dll" Name="libeay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libeay32.dll" /> + <Component Id="component.HeidiSQL_libssl_1_1.dll" Guid="*" Win64="no"> + <File Id="heidisql.libssl_1_1.dll" Name="libssl-1_1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libssl-1_1.dll" /> </Component> - <Component Id="component.HeidiSQL_libpq.dll" Guid="*" Win64="no"> - <File Id="heidisql.libpq.dll" Name="libpq.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libpq.dll" /> + <Component Id="component.HeidiSQL_libpq_10.dll" Guid="*" Win64="no"> + <File Id="heidisql.libpq_10.dll" Name="libpq-10.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libpq-10.dll" /> </Component> - <Component Id="component.HeidiSQL_ssleay32.dll" Guid="*" Win64="no"> - <File Id="heidisql.ssleay32.dll" Name="ssleay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\ssleay32.dll" /> + <Component Id="component.HeidiSQL_libcrypto_1_1.dll" Guid="*" Win64="no"> + <File Id="heidisql.libcrypto_1_1.dll" Name="libcrypto-1_1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libcrypto-1_1.dll" /> </Component> <Component Id="component.HeidiSQL_libintl_8.dll" Guid="*" Win64="no"> <File Id="heidisql.libintl_8.dll" Name="libintl-8.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libintl-8.dll" /> @@ -54,6 +59,9 @@ <Component Id="component.HeidiSQL_libiconv_2.dll" Guid="*" Win64="no"> <File Id="heidisql.libiconv_2.dll" Name="libiconv-2.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libiconv-2.dll" /> </Component> + <Component Id="component.HeidiSQL_sqlite3.dll" Guid="*" Win64="no"> + <File Id="heidisql.sqlite3.dll" Name="sqlite3.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\sqlite3.dll" /> + </Component> <Directory Id="D.HeidiSQL.plugins" Name="plugins"> <?foreach dll in $(var.pluginlist) ?> @@ -76,11 +84,13 @@ <ComponentRef Id="component.HeidiSQL_MenuShortcut"/> <ComponentRef Id="component.HeidiSQL_libmysql.dll"/> <ComponentRef Id="component.HeidiSQL_libmariadb.dll"/> - <ComponentRef Id="component.HeidiSQL_libeay32.dll" /> - <ComponentRef Id="component.HeidiSQL_libpq.dll" /> - <ComponentRef Id="component.HeidiSQL_ssleay32.dll" /> + <ComponentRef Id="component.HeidiSQL_libssl_1_1.dll" /> + <ComponentRef Id="component.HeidiSQL_libpq_10.dll" /> + <ComponentRef Id="component.HeidiSQL_libcrypto_1_1.dll" /> <ComponentRef Id="component.HeidiSQL_libintl_8.dll" /> <ComponentRef Id="component.HeidiSQL_libiconv_2.dll" /> + <ComponentRef Id="component.HeidiSQL_sqlite3.dll" /> + <ComponentRef Id="component.HeidiSQL_libmysql_6.1.dll" /> <?foreach dll in $(var.pluginlist)?> <ComponentRef Id="component.HeidiSQL_$(var.dll)" /> <?endforeach?> |