Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-35922

Server crashes in mhnsw_read_first upon using vector key with views

Details

    Description

      --source include/have_innodb.inc
       
      create table t (pk int primary key, v vector(1) not null, vector(v)) engine=InnoDB;
      insert into t values (1,0x31313131),(2,0x32323232); # optional, fails either way
      create view v as select * from t;
      select pk from v order by vec_distance_euclidean(v, 0x30303030) limit 2;
      drop table t;
      

      11.7 195dcfec6f09cc4a07991a6ceb90cd7f4e9f3369

      #3  <signal handler called>
      #4  0x0000565509f9b492 in mhnsw_read_first (table=0x61900007fd98, keyinfo=0x62500028d510, dist=0x62d0003c1de8, limit=2) at /data/bld/11.7-asan/sql/vector_mhnsw.cc:1254
      #5  0x0000565509010060 in TABLE::hlindex_read_first (this=0x61900007fd98, nr=1, item=0x62d0003c1de8, limit=2) at /data/bld/11.7-asan/sql/sql_base.cc:9927
      #6  0x0000565509354a15 in join_read_first (tab=0x62d0006052d8) at /data/bld/11.7-asan/sql/sql_select.cc:25210
      #7  0x000056550934c053 in sub_select (join=0x62d0003c5fd8, join_tab=0x62d0006052d8, end_of_records=false) at /data/bld/11.7-asan/sql/sql_select.cc:24095
      #8  0x0000565509349a99 in do_select (join=0x62d0003c5fd8, procedure=0x0) at /data/bld/11.7-asan/sql/sql_select.cc:23609
      #9  0x00005655092c5526 in JOIN::exec_inner (this=0x62d0003c5fd8) at /data/bld/11.7-asan/sql/sql_select.cc:5040
      #10 0x00005655092c2890 in JOIN::exec (this=0x62d0003c5fd8) at /data/bld/11.7-asan/sql/sql_select.cc:4823
      #11 0x00005655092c6fdf in mysql_select (thd=0x62c0001e0218, tables=0x62d0003c0bb8, fields=..., conds=0x0, og_num=1, order=0x62d0003c1ec0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x62d0003c5fa8, unit=0x62c0001e4740, select_lex=0x62d0003c0530) at /data/bld/11.7-asan/sql/sql_select.cc:5356
      #12 0x0000565509295135 in handle_select (thd=0x62c0001e0218, lex=0x62c0001e4660, result=0x62d0003c5fa8, setup_tables_done_option=0) at /data/bld/11.7-asan/sql/sql_select.cc:633
      #13 0x00005655091b72f6 in execute_sqlcom_select (thd=0x62c0001e0218, all_tables=0x62d0003c0bb8) at /data/bld/11.7-asan/sql/sql_parse.cc:6191
      #14 0x00005655091a6eea in mysql_execute_command (thd=0x62c0001e0218, is_called_from_prepared_stmt=false) at /data/bld/11.7-asan/sql/sql_parse.cc:3980
      #15 0x00005655091c1d88 in mysql_parse (thd=0x62c0001e0218, rawbuf=0x62d0003c0438 "select pk from v order by vec_distance_euclidean(v, 0x30303030) limit 2", length=71, parser_state=0x7f0a7e078a30) at /data/bld/11.7-asan/sql/sql_parse.cc:7915
      #16 0x0000565509198ba3 in dispatch_command (command=COM_QUERY, thd=0x62c0001e0218, packet=0x62900028f219 "", packet_length=71, blocking=true) at /data/bld/11.7-asan/sql/sql_parse.cc:1903
      #17 0x00005655091958ab in do_command (thd=0x62c0001e0218, blocking=true) at /data/bld/11.7-asan/sql/sql_parse.cc:1416
      #18 0x000056550968d8d9 in do_handle_one_connection (connect=0x608000005138, put_in_cache=true) at /data/bld/11.7-asan/sql/sql_connect.cc:1415
      #19 0x000056550968d438 in handle_one_connection (arg=0x6080000050b8) at /data/bld/11.7-asan/sql/sql_connect.cc:1327
      #20 0x000056550a34c5d0 in pfs_spawn_thread (arg=0x617000008218) at /data/bld/11.7-asan/storage/perfschema/pfs.cc:2198
      #21 0x00007f0a92ca81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #22 0x00007f0a92d2885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failure started happening after this commit in 11.7:

      commit cca243bf02f200c6b9ed8117efc8c162c5a16af2 (HEAD)
      Commit:     Sergei Golubchik
      CommitDate: Mon Jan 13 19:57:12 2025 +0100
       
          MDEV-35768 Vector key is not used upon selecting from views / subqueries
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.