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

Assertion when adding FK to MyISAM/Aria table with a vector index

    XMLWordPrintable

Details

    • Can result in data loss

    Description

      CREATE TABLE t (v VECTOR(1) NOT NULL,VECTOR (v));
      ALTER TABLE t ADD x INT REFERENCES t(x),ADD y INT CONSTRAINT c REFERENCES t(y);
      

      Leads to:

      CS 12.1.0 6a2afb42ba86188ccda0972f9c2df363f34e10a0 (Debug) Build 10/06/2025

      mariadbd: /test/12.1_dbg/sql/handler.cc:6467: int ha_create_table(THD *, const char *, const char *, const char *, HA_CREATE_INFO *, LEX_CUSTRING *, bool): Assertion `share.key_info[share.keys].algorithm == HA_KEY_ALG_VECTOR' failed.
      

      CS 12.1.0 6a2afb42ba86188ccda0972f9c2df363f34e10a0 (Debug) Build 10/06/2025

      Core was generated by `/test/MD100625-mariadb-12.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 3312239)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x00007fc89804526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007fc8980288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007fc89802881b in __assert_fail_base (fmt=0x7fc8981d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5654d535cede "share.key_info[share.keys].algorithm == HA_KEY_ALG_VECTOR", file=file@entry=0x5654d52ed792 "/test/12.1_dbg/sql/handler.cc", line=line@entry=6467, function=function@entry=0x5654d5248215 "int ha_create_table(THD *, const char *, const char *, const char *, HA_CREATE_INFO *, LEX_CUSTRING *, bool)")at ./assert/assert.c:94
      #6  0x00007fc89803b507 in __assert_fail (assertion=0x5654d535cede "share.key_info[share.keys].algorithm == HA_KEY_ALG_VECTOR", file=0x5654d52ed792 "/test/12.1_dbg/sql/handler.cc", line=6467, function=0x5654d5248215 "int ha_create_table(THD *, const char *, const char *, const char *, HA_CREATE_INFO *, LEX_CUSTRING *, bool)")at ./assert/assert.c:103
      #7  0x00005654d5a46172 in ha_create_table (thd=0x7fc784000d58, path=0x7fc8941c98ab "./test/#sql-alter-328515-4-0", db=0x7fc78401a018 "test", table_name=0x7fc784019fe8 "t", create_info=0x7fc8941cafd0, frm=0x7fc8941c7e30, skip_frm_file=false)at /test/12.1_dbg/sql/handler.cc:6467
      #8  0x00005654d6017eaf in mysql_alter_table (thd=0x7fc784000d58, new_db=0x7fc784005a48, new_name=0x7fc784005ec0, create_info=0x7fc8941cafd0, table_list=0x7fc78401a028, recreate_info=0x7fc8941ca700, alter_info=0x7fc8941cae58, order_num=0, order=0x0, ignore=false, if_exists=false)at /test/12.1_dbg/sql/sql_table.cc:11765
      #9  0x00005654d60f2eee in Sql_cmd_alter_table::execute (this=0x7fc78401adf8, thd=0x7fc784000d58) at /test/12.1_dbg/sql/sql_alter.cc:695
      #10 0x00005654d5ed8d6d in mysql_execute_command (thd=0x7fc784000d58, is_called_from_prepared_stmt=false) at /test/12.1_dbg/sql/sql_parse.cc:5861
      #11 0x00005654d5ec80a4 in mysql_parse (thd=0x7fc784000d58, rawbuf=0x7fc784019ee0 "ALTER TABLE t ADD x INT REFERENCES t(x),ADD y INT CONSTRAINT c REFERENCES t(y)", length=78, parser_state=0x7fc8941cca10)at /test/12.1_dbg/sql/sql_parse.cc:7882
      #12 0x00005654d5ec5478 in dispatch_command (command=COM_QUERY, thd=0x7fc784000d58, packet=0x7fc78400b259 "ALTER TABLE t ADD x INT REFERENCES t(x),ADD y INT CONSTRAINT c REFERENCES t(y)", packet_length=78, blocking=true)at /test/12.1_dbg/sql/sql_parse.cc:1877
      #13 0x00005654d5ec8c53 in do_command (thd=0x7fc784000d58, blocking=true)at /test/12.1_dbg/sql/sql_parse.cc:1416
      #14 0x00005654d60e6629 in do_handle_one_connection (connect=0x5654d87b9488, put_in_cache=true) at /test/12.1_dbg/sql/sql_connect.cc:1414
      #15 0x00005654d60e63ce in handle_one_connection (arg=0x5654d88a40b8)at /test/12.1_dbg/sql/sql_connect.cc:1326
      #16 0x00007fc89809ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #17 0x00007fc898129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  060625  643319a7fb1e273797c2a1e46d76cfac0fa1da8f  No bug found                  
      CS  10.6   opt  060625  643319a7fb1e273797c2a1e46d76cfac0fa1da8f  No bug found                  
      CS  10.11  dbg  060625  11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32  No bug found                  
      CS  10.11  opt  060625  11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32  No bug found                  
      CS  11.4   dbg  060625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  No bug found                  
      CS  11.4   opt  060625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  No bug found                  
      CS  11.8   dbg  060625  67e6fdee05ead4974fe632e91c38941ade369b0c  share.key_info[share.keys].algorithm == HA_KEY_ALG_VECTOR|SIGABRT|ha_create_table|mysql_alter_table|Sql_cmd_alter_table::execute|mysql_execute_command
      CS  11.8   opt  060625  67e6fdee05ead4974fe632e91c38941ade369b0c  No bug found                  
      CS  12.0   dbg  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  share.key_info[share.keys].algorithm == HA_KEY_ALG_VECTOR|SIGABRT|ha_create_table|mysql_alter_table|Sql_cmd_alter_table::execute|mysql_execute_command
      CS  12.0   opt  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  No bug found                  
      CS  12.1   dbg  100625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  share.key_info[share.keys].algorithm == HA_KEY_ALG_VECTOR|SIGABRT|ha_create_table|mysql_alter_table|Sql_cmd_alter_table::execute|mysql_execute_command
      CS  12.1   opt  100625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  No bug found                  
      ES  10.5   dbg  060625  ec7bc4f84e490b25f52db7422a1e0e8bbea72fb1  No bug found                  
      ES  10.5   opt  060625  ec7bc4f84e490b25f52db7422a1e0e8bbea72fb1  No bug found                  
      ES  10.6   dbg  060625  8541ea1e4c2fa15789dd162f6ba4b32681f74e61  No bug found                  
      ES  10.6   opt  060625  8541ea1e4c2fa15789dd162f6ba4b32681f74e61  No bug found                  
      ES  11.4   dbg  060625  1c8b2d3059f5ccb67c042868baca3ee269c6eca7  share.key_info[share.keys].algorithm == HA_KEY_ALG_VECTOR|SIGABRT|ha_create_table|mysql_alter_table|Sql_cmd_alter_table::execute|mysql_execute_command
      ES  11.4   opt  060625  1c8b2d3059f5ccb67c042868baca3ee269c6eca7  No bug found                  
      ES  11.8   dbg  110625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  share.key_info[share.keys].algorithm == HA_KEY_ALG_VECTOR|SIGABRT|ha_create_table|mysql_alter_table|Sql_cmd_alter_table::execute|mysql_execute_command
      ES  11.8   opt  110625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  No bug found                             
      

      No ASAN nor UBSAN issues observed. Testcase is CLI and MTR compatible.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.