Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
N/A
-
None
Description
I'm not sure whether it should be one report, or two different ones, or only the 2nd part is legit, so I'll put it all together for now.
With the default join_cache_level=2 (and with any other non-0 value, as it seems), on a JOIN query like the below one a vector key isn't used.
With join_cache_level=0, the plan promises that it would be used, but the actual execution fails on an assertion.
A fix for MDEV-35159 is already in the branch.
--source include/have_sequence.inc
|
|
create table t1 (pk int primary key, a vector(1) not null, vector(a)); |
insert into t1 select seq, 0x00000000 from seq_1_to_1000; |
create table t2 (f int); |
insert into t2 select seq from seq_1_to_1000; |
|
explain select t2.f from t1 left join t2 on (t1.pk=t2.f) order by vec_distance_euclidean(t1.a,0x00000040) limit 5; |
select t2.f from t1 join t2 on (t1.pk=t2.f) order by vec_distance_euclidean(t1.a,0x00000040) limit 5; |
set join_cache_level= 0; |
explain select t2.f from t1 left join t2 on (t1.pk=t2.f) order by vec_distance_euclidean(t1.a,0x00000040) limit 5; |
select t2.f from t1 left join t2 on (t1.pk=t2.f) order by vec_distance_euclidean(t1.a,0x00000040) limit 5; |
|
# Cleanup
|
drop table t1, t2, |
bb-11.6-MDEV-32887-vector fd1ec08cefd2bdcd98aa38a20ab844763d0bffd4 |
explain select t2.f from t1 left join t2 on (t1.pk=t2.f) order by vec_distance_euclidean(t1.a,0x00000040) limit 5; |
id select_type table type possible_keys key key_len ref rows Extra |
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort |
1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join) |
select t2.f from t1 join t2 on (t1.pk=t2.f) order by vec_distance_euclidean(t1.a,0x00000040) limit 5; |
f
|
896
|
912
|
928
|
944
|
960
|
set join_cache_level= 0; |
explain select t2.f from t1 left join t2 on (t1.pk=t2.f) order by vec_distance_euclidean(t1.a,0x00000040) limit 5; |
id select_type table type possible_keys key key_len ref rows Extra |
1 SIMPLE t1 index NULL a 6 NULL 1 |
1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 Using where |
mariadbd: /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_select.cc:24763: int join_read_first(JOIN_TAB*): Assertion `tab->join->select_limit < (~ (ha_rows) 0)' failed.
|
241017 19:31:32 [ERROR] mysqld got signal 6 ;
|
|
r-asan/sql/sql_select.cc", line=24763, function=0x55f6d1756ca0 "int join_read_first(JOIN_TAB*)") at ./assert/assert.c:101
|
#10 0x000055f6cf55d812 in join_read_first (tab=0x629000241420) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_select.cc:24763
|
#11 0x000055f6cf5550a7 in sub_select (join=0x6290000e9388, join_tab=0x629000241420, end_of_records=false) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_select.cc:23651
|
#12 0x000055f6cf552af7 in do_select (join=0x6290000e9388, procedure=0x0) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_select.cc:23165
|
#13 0x000055f6cf4d0f7a in JOIN::exec_inner (this=0x6290000e9388) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_select.cc:5026
|
#14 0x000055f6cf4ce304 in JOIN::exec (this=0x6290000e9388) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_select.cc:4809
|
#15 0x000055f6cf4d2a33 in mysql_select (thd=0x62c0000c0218, tables=0x6290000e6a10, fields=..., conds=0x0, og_num=1, order=0x6290000e91a0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x6290000e9358, unit=0x62c0000c4710, select_lex=0x6290000e6378) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_select.cc:5342
|
#16 0x000055f6cf4a0f6f in handle_select (thd=0x62c0000c0218, lex=0x62c0000c4630, result=0x6290000e9358, setup_tables_done_option=0) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_select.cc:624
|
#17 0x000055f6cf3c3b25 in execute_sqlcom_select (thd=0x62c0000c0218, all_tables=0x6290000e6a10) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_parse.cc:6151
|
#18 0x000055f6cf3b3750 in mysql_execute_command (thd=0x62c0000c0218, is_called_from_prepared_stmt=false) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_parse.cc:3953
|
#19 0x000055f6cf3ce576 in mysql_parse (thd=0x62c0000c0218, rawbuf=0x6290000e6238 "select t2.f from t1 left join t2 on (t1.pk=t2.f) order by vec_distance_euclidean(t1.a,0x00000040) limit 5", length=105, parser_state=0x7f72c4acb9f0) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_parse.cc:7873
|
#20 0x000055f6cf3a5598 in dispatch_command (command=COM_QUERY, thd=0x62c0000c0218, packet=0x629000253219 "", packet_length=105, blocking=true) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_parse.cc:1892
|
#21 0x000055f6cf3a22ac in do_command (thd=0x62c0000c0218, blocking=true) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_parse.cc:1405
|
#22 0x000055f6cf8916e3 in do_handle_one_connection (connect=0x6080000034b8, put_in_cache=true) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_connect.cc:1448
|
#23 0x000055f6cf8910a4 in handle_one_connection (arg=0x608000003438) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_connect.cc:1350
|
#24 0x000055f6d0536c18 in pfs_spawn_thread (arg=0x617000005b98) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/storage/perfschema/pfs.cc:2198
|
#25 0x00007f72d00a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
|
#26 0x00007f72d012861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
|
Attachments
Issue Links
- is caused by
-
MDEV-34939 vector search in 11.7
- Closed