Skip to content

Commit e538cb0

Browse files
committed
Merge 10.5 into 10.6
2 parents 356c149 + 80459bc commit e538cb0

File tree

61 files changed

+907
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+907
-635
lines changed

CMakeLists.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,17 @@ OPTION(WITH_ASAN "Enable address sanitizer" OFF)
203203
IF (WITH_ASAN AND NOT MSVC)
204204
# this flag might be set by default on some OS
205205
MY_CHECK_AND_SET_COMPILER_FLAG("-U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
206-
# gcc 4.8.1 and new versions of clang
207206
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -fPIC"
208207
DEBUG RELWITHDEBINFO)
209208
SET(HAVE_C_FSANITIZE ${have_C__fsanitize_address__fPIC})
210209
SET(HAVE_CXX_FSANITIZE ${have_CXX__fsanitize_address__fPIC})
211210
IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE)
211+
OPTION(WITH_ASAN_SCOPE "Enable -fsanitize-address-use-after-scope" OFF)
212212
SET(WITH_ASAN_OK 1)
213-
ELSE()
214-
# older versions of clang
215-
MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -fPIC"
216-
DEBUG RELWITHDEBINFO)
217-
SET(HAVE_C_FADDRESS ${have_C__faddress_sanitizer__fPIC})
218-
SET(HAVE_CXX_FADDRESS ${have_CXX__faddress_sanitizer__fPIC})
219-
IF(HAVE_C_FADDRESS AND HAVE_CXX_FADDRESS)
220-
SET(WITH_ASAN_OK 1)
213+
IF(WITH_ASAN_SCOPE)
214+
MY_CHECK_AND_SET_COMPILER_FLAG(
215+
"-fsanitize=address -fsanitize-address-use-after-scope"
216+
DEBUG RELWITHDEBINFO)
221217
ENDIF()
222218
ENDIF()
223219

client/mysql.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4716,7 +4716,11 @@ sql_real_connect(char *host,char *database,char *user,char *password,
47164716
return -1; // Retryable
47174717
}
47184718

4719-
charset_info= get_charset_by_name(mysql.charset->name, MYF(0));
4719+
if (!(charset_info= get_charset_by_name(mysql.charset->name, MYF(0))))
4720+
{
4721+
put_info("Unknown default character set", INFO_ERROR);
4722+
return 1;
4723+
}
47204724

47214725

47224726
connected=1;

config.h.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
#cmakedefine HAVE_DECL_MADVISE 1
170170
#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA 1
171171
#cmakedefine HAVE_MALLINFO 1
172+
#cmakedefine HAVE_MALLINFO2 1
172173
#cmakedefine HAVE_MEMCPY 1
173174
#cmakedefine HAVE_MEMMOVE 1
174175
#cmakedefine HAVE_MKSTEMP 1

configure.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ CHECK_FUNCTION_EXISTS (localtime_r HAVE_LOCALTIME_R)
363363
CHECK_FUNCTION_EXISTS (lstat HAVE_LSTAT)
364364
CHECK_FUNCTION_EXISTS (madvise HAVE_MADVISE)
365365
CHECK_FUNCTION_EXISTS (mallinfo HAVE_MALLINFO)
366+
CHECK_FUNCTION_EXISTS (mallinfo2 HAVE_MALLINFO2)
366367
CHECK_FUNCTION_EXISTS (memcpy HAVE_MEMCPY)
367368
CHECK_FUNCTION_EXISTS (memmove HAVE_MEMMOVE)
368369
CHECK_FUNCTION_EXISTS (mkstemp HAVE_MKSTEMP)

mysql-test/lib/My/Debugger.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ my %debuggers = (
6161
lldb => {
6262
term => 1,
6363
options => '-s {script} {exe}',
64-
script => 'process launch --stop-at-entry {args}',
64+
script => 'process launch --stop-at-entry -- {args}',
6565
},
6666
valgrind => {
6767
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',

mysql-test/main/derived_cond_pushdown.result

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17106,6 +17106,220 @@ a
1710617106
3
1710717107
DROP VIEW v1;
1710817108
DROP TABLE t1;
17109+
#
17110+
# MDEV-25128: Split optimization for join with materialized semi-join
17111+
#
17112+
create table t1 (id int, a int, index (a), index (id, a)) engine=myisam;
17113+
insert into t1 values
17114+
(17,1),(17,3010),(17,3013),(17,3053),(21,2446),(21,2467),(21,2);
17115+
create table t2 (a int) engine=myisam;
17116+
insert into t2 values (1),(2),(3);
17117+
create table t3 (id int) engine=myisam;
17118+
insert into t3 values (1),(2);
17119+
analyze table t1,t2,t3;
17120+
Table Op Msg_type Msg_text
17121+
test.t1 analyze status Engine-independent statistics collected
17122+
test.t1 analyze status OK
17123+
test.t2 analyze status Engine-independent statistics collected
17124+
test.t2 analyze status OK
17125+
test.t3 analyze status Engine-independent statistics collected
17126+
test.t3 analyze status OK
17127+
set optimizer_switch="split_materialized=off";
17128+
select * from t1, (select a from t1 cp2 group by a) dt, t3
17129+
where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2);
17130+
id a a id
17131+
17 1 1 1
17132+
21 2 2 2
17133+
explain select * from t1, (select a from t1 cp2 group by a) dt, t3
17134+
where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2);
17135+
id select_type table type possible_keys key key_len ref rows Extra
17136+
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
17137+
1 PRIMARY t1 ref a a 5 test.t3.id 1
17138+
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1
17139+
1 PRIMARY <derived2> ref key0 key0 5 test.t3.id 2
17140+
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
17141+
2 DERIVED cp2 range NULL a 5 NULL 8 Using index for group-by
17142+
explain format=json select * from t1, (select a from t1 cp2 group by a) dt, t3
17143+
where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2);
17144+
EXPLAIN
17145+
{
17146+
"query_block": {
17147+
"select_id": 1,
17148+
"table": {
17149+
"table_name": "t3",
17150+
"access_type": "ALL",
17151+
"rows": 2,
17152+
"filtered": 100,
17153+
"attached_condition": "t3.`id` is not null and t3.`id` is not null"
17154+
},
17155+
"table": {
17156+
"table_name": "t1",
17157+
"access_type": "ref",
17158+
"possible_keys": ["a"],
17159+
"key": "a",
17160+
"key_length": "5",
17161+
"used_key_parts": ["a"],
17162+
"ref": ["test.t3.id"],
17163+
"rows": 1,
17164+
"filtered": 100
17165+
},
17166+
"table": {
17167+
"table_name": "<subquery3>",
17168+
"access_type": "eq_ref",
17169+
"possible_keys": ["distinct_key"],
17170+
"key": "distinct_key",
17171+
"key_length": "4",
17172+
"used_key_parts": ["a"],
17173+
"ref": ["func"],
17174+
"rows": 1,
17175+
"filtered": 100,
17176+
"materialized": {
17177+
"unique": 1,
17178+
"query_block": {
17179+
"select_id": 3,
17180+
"table": {
17181+
"table_name": "t2",
17182+
"access_type": "ALL",
17183+
"rows": 3,
17184+
"filtered": 100
17185+
}
17186+
}
17187+
}
17188+
},
17189+
"table": {
17190+
"table_name": "<derived2>",
17191+
"access_type": "ref",
17192+
"possible_keys": ["key0"],
17193+
"key": "key0",
17194+
"key_length": "5",
17195+
"used_key_parts": ["a"],
17196+
"ref": ["test.t3.id"],
17197+
"rows": 2,
17198+
"filtered": 100,
17199+
"materialized": {
17200+
"query_block": {
17201+
"select_id": 2,
17202+
"table": {
17203+
"table_name": "cp2",
17204+
"access_type": "range",
17205+
"key": "a",
17206+
"key_length": "5",
17207+
"used_key_parts": ["a"],
17208+
"rows": 8,
17209+
"filtered": 100,
17210+
"using_index_for_group_by": true
17211+
}
17212+
}
17213+
}
17214+
}
17215+
}
17216+
}
17217+
set optimizer_switch="split_materialized=default";
17218+
select * from t1, (select a from t1 cp2 group by a) dt, t3
17219+
where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2);
17220+
id a a id
17221+
17 1 1 1
17222+
21 2 2 2
17223+
explain select * from t1, (select a from t1 cp2 group by a) dt, t3
17224+
where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2);
17225+
id select_type table type possible_keys key key_len ref rows Extra
17226+
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
17227+
1 PRIMARY t1 ref a a 5 test.t3.id 1
17228+
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1
17229+
1 PRIMARY <derived2> ref key0 key0 5 test.t3.id 2
17230+
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
17231+
2 LATERAL DERIVED cp2 ref a a 5 test.t1.a 1 Using index
17232+
explain format=json select * from t1, (select a from t1 cp2 group by a) dt, t3
17233+
where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2);
17234+
EXPLAIN
17235+
{
17236+
"query_block": {
17237+
"select_id": 1,
17238+
"table": {
17239+
"table_name": "t3",
17240+
"access_type": "ALL",
17241+
"rows": 2,
17242+
"filtered": 100,
17243+
"attached_condition": "t3.`id` is not null and t3.`id` is not null"
17244+
},
17245+
"table": {
17246+
"table_name": "t1",
17247+
"access_type": "ref",
17248+
"possible_keys": ["a"],
17249+
"key": "a",
17250+
"key_length": "5",
17251+
"used_key_parts": ["a"],
17252+
"ref": ["test.t3.id"],
17253+
"rows": 1,
17254+
"filtered": 100
17255+
},
17256+
"table": {
17257+
"table_name": "<subquery3>",
17258+
"access_type": "eq_ref",
17259+
"possible_keys": ["distinct_key"],
17260+
"key": "distinct_key",
17261+
"key_length": "4",
17262+
"used_key_parts": ["a"],
17263+
"ref": ["func"],
17264+
"rows": 1,
17265+
"filtered": 100,
17266+
"materialized": {
17267+
"unique": 1,
17268+
"query_block": {
17269+
"select_id": 3,
17270+
"table": {
17271+
"table_name": "t2",
17272+
"access_type": "ALL",
17273+
"rows": 3,
17274+
"filtered": 100
17275+
}
17276+
}
17277+
}
17278+
},
17279+
"table": {
17280+
"table_name": "<derived2>",
17281+
"access_type": "ref",
17282+
"possible_keys": ["key0"],
17283+
"key": "key0",
17284+
"key_length": "5",
17285+
"used_key_parts": ["a"],
17286+
"ref": ["test.t3.id"],
17287+
"rows": 2,
17288+
"filtered": 100,
17289+
"materialized": {
17290+
"lateral": 1,
17291+
"query_block": {
17292+
"select_id": 2,
17293+
"outer_ref_condition": "t1.a is not null",
17294+
"table": {
17295+
"table_name": "cp2",
17296+
"access_type": "ref",
17297+
"possible_keys": ["a"],
17298+
"key": "a",
17299+
"key_length": "5",
17300+
"used_key_parts": ["a"],
17301+
"ref": ["test.t1.a"],
17302+
"rows": 1,
17303+
"filtered": 100,
17304+
"using_index": true
17305+
}
17306+
}
17307+
}
17308+
}
17309+
}
17310+
}
17311+
prepare stmt from "select * from t1, (select a from t1 cp2 group by a) dt, t3
17312+
where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2)";
17313+
execute stmt;
17314+
id a a id
17315+
17 1 1 1
17316+
21 2 2 2
17317+
execute stmt;
17318+
id a a id
17319+
17 1 1 1
17320+
21 2 2 2
17321+
deallocate prepare stmt;
17322+
drop table t1,t2,t3;
1710917323
# End of 10.3 tests
1711017324
#
1711117325
# MDEV-18679: materialized view with SELECT S containing materialized

mysql-test/main/derived_cond_pushdown.test

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3479,6 +3479,43 @@ SELECT * from v1 WHERE a=3;
34793479
DROP VIEW v1;
34803480
DROP TABLE t1;
34813481

3482+
--echo #
3483+
--echo # MDEV-25128: Split optimization for join with materialized semi-join
3484+
--echo #
3485+
3486+
create table t1 (id int, a int, index (a), index (id, a)) engine=myisam;
3487+
insert into t1 values
3488+
(17,1),(17,3010),(17,3013),(17,3053),(21,2446),(21,2467),(21,2);
3489+
3490+
create table t2 (a int) engine=myisam;
3491+
insert into t2 values (1),(2),(3);
3492+
3493+
create table t3 (id int) engine=myisam;
3494+
insert into t3 values (1),(2);
3495+
3496+
analyze table t1,t2,t3;
3497+
3498+
let $q=
3499+
select * from t1, (select a from t1 cp2 group by a) dt, t3
3500+
where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2);
3501+
3502+
set optimizer_switch="split_materialized=off";
3503+
eval $q;
3504+
eval explain $q;
3505+
eval explain format=json $q;
3506+
3507+
set optimizer_switch="split_materialized=default";
3508+
eval $q;
3509+
eval explain $q;
3510+
eval explain format=json $q;
3511+
3512+
eval prepare stmt from "$q";
3513+
execute stmt;
3514+
execute stmt;
3515+
deallocate prepare stmt;
3516+
3517+
drop table t1,t2,t3;
3518+
34823519
--echo # End of 10.3 tests
34833520

34843521
--echo #

mysql-test/main/join_cache.result

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6126,6 +6126,36 @@ a b c d e
61266126
DROP TABLE t1,t2,t3,t4;
61276127
set join_cache_level=@save_join_cache_level;
61286128
#
6129+
# MDEV-24767: forced BNLH used for equi-join supported by compound index
6130+
#
6131+
create table t1 (a int, b int, c int ) engine=myisam ;
6132+
create table t2 (a int, b int, c int, primary key (c,a,b)) engine=myisam ;
6133+
insert into t1 values (3,4,2), (5,6,4);
6134+
insert into t2 values (3,4,2), (5,6,4);
6135+
select t1.a, t1.b, t1.c from t1,t2
6136+
where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c;
6137+
a b c
6138+
3 4 2
6139+
5 6 4
6140+
explain select t1.a, t1.b, t1.c from t1,t2
6141+
where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c;
6142+
id select_type table type possible_keys key key_len ref rows Extra
6143+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
6144+
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.c,test.t1.a,test.t1.b 1 Using index
6145+
set join_cache_level=3;
6146+
select t1.a, t1.b, t1.c from t1,t2
6147+
where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c;
6148+
a b c
6149+
3 4 2
6150+
5 6 4
6151+
explain select t1.a, t1.b, t1.c from t1,t2
6152+
where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c;
6153+
id select_type table type possible_keys key key_len ref rows Extra
6154+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
6155+
1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 12:12 test.t1.c,test.t1.a,test.t1.b 2 Using index; Using join buffer (flat, BNLH join)
6156+
drop table t1,t2;
6157+
set join_cache_level=@save_join_cache_level;
6158+
#
61296159
# MDEV-21243: Join buffer: condition is checked in wrong place for range access
61306160
#
61316161
create table t1(a int primary key);

0 commit comments

Comments
 (0)