summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-01 10:24:36 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-01 10:24:36 +0300
commitf813131c7b235a490399764ba75c6138e602c23e (patch)
tree9360a0ff33952bf6f88771c4669eb18a9b438978
parentf9639c2d1a5e24f1a1533b6277fe7eca3aa3c3c0 (diff)
parent24cb76b8dd86bf54f264352be41506995b6c89c4 (diff)
downloadmariadb-git-f813131c7b235a490399764ba75c6138e602c23e.tar.gz
Merge 5.5 into 10.1bb-10.1-merge
-rw-r--r--mysql-test/r/index_merge_myisam.result53
-rw-r--r--mysql-test/r/range_innodb.result28
-rw-r--r--mysql-test/r/range_vs_index_merge.result2
-rw-r--r--mysql-test/t/index_merge_myisam.test51
-rw-r--r--mysql-test/t/range_innodb.test28
-rw-r--r--sql/opt_range.cc9
-rw-r--r--win/packaging/heidisql.cmake2
-rw-r--r--win/packaging/heidisql.wxi.in28
8 files changed, 189 insertions, 12 deletions
diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
index b87a7dfef4b..8f3d536983f 100644
--- a/mysql-test/r/index_merge_myisam.result
+++ b/mysql-test/r/index_merge_myisam.result
@@ -1685,6 +1685,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
@@ -1719,3 +1771,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/range_innodb.result b/mysql-test/r/range_innodb.result
index 6572b248911..faeec530acb 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)
@@ -79,3 +106,4 @@ ERROR HY000: Table definition has changed, please retry transaction
DROP TABLE t0,t1;
set @@global.debug_dbug="-d";
set @@optimizer_switch= @optimizer_switch_save;
+# End of 10.1 tests
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_innodb.test b/mysql-test/t/range_innodb.test
index a17ef3f1146..03e9e2f0678 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)
@@ -87,3 +113,5 @@ select * from t1 where a=10 and b=10;
DROP TABLE t0,t1;
set @@global.debug_dbug="-d";
set @@optimizer_switch= @optimizer_switch_save;
+
+--echo # End of 10.1 tests
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 7e987c3cfba..258d757e5f2 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -6827,6 +6827,13 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
update_tbl_stats, &mrr_flags,
&buf_size, &cost);
+ if (!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))))
@@ -8865,7 +8872,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/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?>