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

Vector: Assertion `!thd->is_error()' failed on low-memory REPAIR TABLE ... USE_FRM

    XMLWordPrintable

Details

    Description

      Only the given testcase crashes. Any other combination (other storage engine, different column type, not using 'USE_FRM' etc. do not result in a crash). Testcase is CLI and MTR compatible.

      SET max_session_mem_used=8192;
      CREATE TABLE t (v VECTOR (1) NOT NULL,VECTOR (v)) ENGINE=Aria;
      REPAIR TABLE t USE_FRM;
      

      Leads to:

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

      mariadbd: /test/12.1_dbg/sql/table.cc:3658: int TABLE_SHARE::init_from_sql_statement_string(THD *, bool, const char *, size_t): Assertion `!thd->is_error()' 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 3309545)]
      (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  0x00007f245c84526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007f245c8288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007f245c82881b in __assert_fail_base (fmt=0x7f245c9d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55839a2c5d16 "!thd->is_error()", file=file@entry=0x55839a1274ed "/test/12.1_dbg/sql/table.cc", line=line@entry=3658, function=function@entry=0x55839a23d0a7 "int TABLE_SHARE::init_from_sql_statement_string(THD *, bool, const char *, size_t)") at ./assert/assert.c:94
      #6  0x00007f245c83b507 in __assert_fail (assertion=0x55839a2c5d16 "!thd->is_error()", file=0x55839a1274ed "/test/12.1_dbg/sql/table.cc", line=3658, function=0x55839a23d0a7 "int TABLE_SHARE::init_from_sql_statement_string(THD *, bool, const char *, size_t)") at ./assert/assert.c:103
      #7  0x000055839afcd171 in TABLE_SHARE::init_from_sql_statement_string (this=0x7f2458c9dd88, thd=0x7f230c000d58, write=false, sql=0x7f230c01ad30 "CREATE TABLE i (", ' ' <repeats 21 times>, "layer tinyint not null,", ' ' <repeats 12 times>, "tref varbinary(5),", ' ' <repeats 16 times>, "vec blob not null,", ' ' <repeats 17 times>, "neighbors blob not null,", ' ' <repeats 11 times>, "unique (tref),          "..., sql_length=244)at /test/12.1_dbg/sql/table.cc:3658
      #8  0x000055839a99f3d7 in ha_create_table (thd=0x7f230c000d58, path=0x7f2458c9eb00 "./test/t", db=0x7f230c019f98 "test", table_name=0x7f230c019f68 "t", create_info=0x7f2458c9ed10, frm=0x0, skip_frm_file=false) at /test/12.1_dbg/sql/handler.cc:6496
      #9  0x000055839b093621 in dd_recreate_table (thd=0x7f230c000d58, db=0x7f230c019f98 "test", table_name=0x7f230c019f68 "t")at /test/12.1_dbg/sql/datadict.cc:213
      #10 0x000055839b05b709 in prepare_for_repair (thd=0x7f230c000d58, table_list=0x7f230c019fa8, check_opt=0x7f230c0064c0)at /test/12.1_dbg/sql/sql_admin.cc:259
      #11 0x000055839b057120 in mysql_admin_table (thd=0x7f230c000d58, tables=0x7f230c019fa8, check_opt=0x7f230c0064c0, operator_name=0x55839bcc9e08 <msg_repair>, lock_type=TL_WRITE, org_open_for_modify=true, no_errors_from_open=true, extra_open_options=32, prepare_func=0x55839b05b090 <prepare_for_repair(THD*, TABLE_LIST*, st_ha_check_opt*)>, operator_func=(int (handler::*)(class handler * const, class THD *, HA_CHECK_OPT *)) 0x55839a99bdc0 <handler::ha_repair(THD*, st_ha_check_opt*)>, view_operator_func=0x55839afbe920 <view_repair(THD*, TABLE_LIST*, st_ha_check_opt*)>, is_cmd_replicated=true) at /test/12.1_dbg/sql/sql_admin.cc:737
      #12 0x000055839b05b04b in Sql_cmd_repair_table::execute (this=0x7f230c01a6e0, thd=0x7f230c000d58) at /test/12.1_dbg/sql/sql_admin.cc:1729
      #13 0x000055839ae31d6d in mysql_execute_command (thd=0x7f230c000d58, is_called_from_prepared_stmt=false) at /test/12.1_dbg/sql/sql_parse.cc:5861
      #14 0x000055839ae210a4 in mysql_parse (thd=0x7f230c000d58, rawbuf=0x7f230c019ee0 "REPAIR TABLE t USE_FRM", length=22, parser_state=0x7f2458ca2a10) at /test/12.1_dbg/sql/sql_parse.cc:7882
      #15 0x000055839ae1e478 in dispatch_command (command=COM_QUERY, thd=0x7f230c000d58, packet=0x7f230c00b259 "", packet_length=22, blocking=true) at /test/12.1_dbg/sql/sql_parse.cc:1877
      #16 0x000055839ae21c53 in do_command (thd=0x7f230c000d58, blocking=true)at /test/12.1_dbg/sql/sql_parse.cc:1416
      #17 0x000055839b03f629 in do_handle_one_connection (connect=0x55839dd2a488, put_in_cache=true) at /test/12.1_dbg/sql/sql_connect.cc:1414
      #18 0x000055839b03f3ce in handle_one_connection (arg=0x55839ddbdb88)at /test/12.1_dbg/sql/sql_connect.cc:1326
      #19 0x00007f245c89ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #20 0x00007f245c929c3c 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  !thd->is_error()|SIGABRT|TABLE_SHARE::init_from_sql_statement_string|ha_create_table|dd_recreate_table|prepare_for_repair
      CS  11.8   opt  060625  67e6fdee05ead4974fe632e91c38941ade369b0c  No bug found                  
      CS  12.0   dbg  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  !thd->is_error()|SIGABRT|TABLE_SHARE::init_from_sql_statement_string|ha_create_table|dd_recreate_table|prepare_for_repair
      CS  12.0   opt  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  No bug found                  
      CS  12.1   dbg  100625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  !thd->is_error()|SIGABRT|TABLE_SHARE::init_from_sql_statement_string|ha_create_table|dd_recreate_table|prepare_for_repair
      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  !thd->is_error()|SIGABRT|TABLE_SHARE::init_from_sql_statement_string|ha_create_table|dd_recreate_table|prepare_for_repair
      ES  11.4   opt  060625  1c8b2d3059f5ccb67c042868baca3ee269c6eca7  No bug found                
      ES  11.8   dbg  110625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  !thd->is_error()|SIGABRT|TABLE_SHARE::init_from_sql_statement_string|ha_create_table|dd_recreate_table|prepare_for_repair
      ES  11.8   opt  110625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  No bug found                    
      MS  5.5    dbg  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.5    opt  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.6    dbg  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.6    opt  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.7    dbg  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  5.7    opt  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  8.0    dbg  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  8.0    opt  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  9.1    dbg  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      MS  9.1    opt  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      

      The repair table output on optimized builds may also be of interest (i.e. the "Failed generating table from .frm file"):

      CS 11.8.3 67e6fdee05ead4974fe632e91c38941ade369b0c (Optimized) Build 06/06/2025

      11.8.3-opt>REPAIR TABLE t USE_FRM;
      +--------+--------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table  | Op     | Msg_type | Msg_text                                                                                                                                                                                                                                                                                                    |
      +--------+--------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | t      | repair | error    | Failed generating table from .frm file                                                                                                                                                                                                                                                                      |
      | test.t | repair | Error    | Engine Aria failed to discover table `test`.`t` with 'CREATE TABLE i (                     layer tinyint not null,            tref varbinary(5),                vec blob not null,                 neighbors blob not null,           unique (tref),                     key (layer))                     ' |
      | test.t | repair | error    | Corrupt                                                                                                                                                                                                                                                                                                     |
      +--------+--------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      3 rows in set (0.008 sec)
      

      This can be compared for example with this INT-based table:

      CS 11.8.3 67e6fdee05ead4974fe632e91c38941ade369b0c (Optimized) Build 06/06/2025

      11.8.3-opt>SET max_session_mem_used=8192;
      Query OK, 0 rows affected (0.000 sec)
       
      11.8.3-opt>CREATE TABLE t (c INT NOT NULL PRIMARY KEY) ENGINE=Aria;
      Query OK, 0 rows affected (0.010 sec)
       
      11.8.3-opt>REPAIR TABLE t USE_FRM;
      +-------+--------+----------+-----------------------------------------+
      | Table | Op     | Msg_type | Msg_text                                |
      +-------+--------+----------+-----------------------------------------+
      | t     | repair | error    | Failed to open partially repaired table |
      +-------+--------+----------+-----------------------------------------+
      1 row in set, 1 warning (0.008 sec)
      

      Attachments

        Issue Links

          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:

                Git Integration

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