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

SIGSEGV in innobase_get_mysql_key_number_for_index and Assertion `table->magic_n == 76333786' failed in dict_table_get_first_index and InnoDB: Failing assertion: i > 0 and Assertion `!trx->check_foreigns' failed on INSERT

    XMLWordPrintable

Details

    Description

      SET unique_checks=0, foreign_key_checks=0, autocommit=0;
      CREATE TABLE t (c INT PRIMARY KEY) ENGINE=InnoDB;
      INSERT INTO t VALUES (0);
      INSERT INTO t VALUES (0);
      DROP TABLE IF EXISTS t;
      CREATE TABLE t (d INT KEY) ENGINE=InnoDB;  # Changing table name t to e in the last two queries yields the same result
      INSERT INTO t SELECT s.SEQ FROM seq_1_to_128,seq_1_to_1024 s;
      

      Leads to:

      10.9.0 b5852ffbeebc3000982988383daeefb0549e058a (Optimized)

      Core was generated by `/test/MD140222-mariadb-10.9.0-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  innobase_get_mysql_key_number_for_index (table=0x154ea0016ac8, 
          table=0x154ea0016ac8, index=0x154ea001da30, ib_table=0x154ea001ec40)
          at /test/10.9_opt/storage/innobase/handler/ha_innodb.cc:14424
      [Current thread is 1 (Thread 0x154f297a0700 (LWP 3993205))]
      (gdb) bt
      #0  innobase_get_mysql_key_number_for_index (table=0x154ea0016ac8, table=0x154ea0016ac8, index=0x154ea001da30, ib_table=0x154ea001ec40) at /test/10.9_opt/storage/innobase/handler/ha_innodb.cc:14424
      #1  ha_innobase::info_low (this=0x154ea004a1f0, flag=34, is_analyze=<optimized out>) at /test/10.9_opt/storage/innobase/handler/ha_innodb.cc:14904
      #2  0x000056294268fbf0 in handler::get_dup_key (error=<optimized out>, this=0x154ea004a1f0) at /test/10.9_opt/sql/handler.cc:4783
      #3  handler::get_dup_key (this=0x154ea004a1f0, error=<optimized out>) at /test/10.9_opt/sql/handler.cc:4770
      #4  0x0000562942690205 in handler::print_error (this=0x154ea004a1f0, error=121, errflag=0) at /test/10.9_opt/sql/handler.cc:4342
      #5  0x00005629423fe543 in write_record (thd=0x154ea0000c58, table=0x154ea0016ac8, info=info@entry=0x154ea004ed98, sink=0x0) at /test/10.9_opt/sql/sql_insert.cc:2201
      #6  0x00005629423fecf3 in select_insert::send_data (this=0x154ea004ed48, values=<optimized out>) at /test/10.9_opt/sql/sql_insert.cc:4120
      #7  0x000056294249d8dc in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, items=@0x154ea0011368: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x154ea0011668, last = 0x154ea0011668, elements = 1}, <No data fields>}, this=<optimized out>) at /test/10.9_opt/sql/sql_class.h:5612
      #8  select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=@0x154ea0011368: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x154ea0011668, last = 0x154ea0011668, elements = 1}, <No data fields>}, this=<optimized out>) at /test/10.9_opt/sql/sql_class.h:5602
      #9  end_send (join=0x154ea004ee08, join_tab=0x154ea0050e18, end_of_records=<optimized out>) at /test/10.9_opt/sql/sql_select.cc:22331
      #10 0x000056294258bf79 in JOIN_CACHE::generate_full_extensions (rec_ptr=0x154ea0055418 "\017", this=0x154ea00515d8) at /test/10.9_opt/sql/sql_join_cache.cc:2478
      #11 JOIN_CACHE::generate_full_extensions (this=0x154ea00515d8, rec_ptr=0x154ea0055418 "\017") at /test/10.9_opt/sql/sql_join_cache.cc:2461
      #12 0x000056294258c37e in JOIN_CACHE::join_matching_records (this=0x154ea00515d8, skip_last=false) at /test/10.9_opt/sql/sql_join_cache.cc:2370
      #13 0x000056294258bbc1 in JOIN_CACHE::join_records (this=this@entry=0x154ea00515d8, skip_last=skip_last@entry=false) at /test/10.9_opt/sql/sql_join_cache.cc:2151
      #14 0x000056294248724a in sub_select_cache (join=0x154ea004ee08, join_tab=0x154ea0050a68, end_of_records=<optimized out>) at /test/10.9_opt/sql/sql_select.cc:20869
      #15 0x00005629424b4a4b in do_select (procedure=<optimized out>, join=0x154ea004ee08) at /test/10.9_opt/sql/sql_select.cc:20642
      #16 JOIN::exec_inner (this=0x154ea004ee08) at /test/10.9_opt/sql/sql_select.cc:4749
      #17 0x00005629424b4fb8 in JOIN::exec (this=this@entry=0x154ea004ee08) at /test/10.9_opt/sql/sql_select.cc:4527
      #18 0x00005629424b30c1 in mysql_select (thd=0x154ea0000c58, tables=0x154ea00116c0, fields=@0x154ea0011368: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x154ea0011668, last = 0x154ea0011668, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x154ea004ed48, unit=0x154ea0004ea8, select_lex=0x154ea00110c8) at /test/10.9_opt/sql/sql_select.cc:5007
      #19 0x00005629424b3877 in handle_select (thd=thd@entry=0x154ea0000c58, lex=lex@entry=0x154ea0004dd0, result=result@entry=0x154ea004ed48, setup_tables_done_option=setup_tables_done_option@entry=1073741824) at /test/10.9_opt/sql/sql_select.cc:543
      #20 0x00005629424432c9 in mysql_execute_command (thd=0x154ea0000c58, is_called_from_prepared_stmt=<optimized out>) at /test/10.9_opt/sql/sql_parse.cc:4708
      #21 0x000056294242f086 in mysql_parse (thd=0x154ea0000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.9_opt/sql/sql_parse.cc:8027
      #22 0x000056294243b235 in dispatch_command (command=COM_QUERY, thd=0x154ea0000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/10.9_opt/sql/sql_class.h:1362
      #23 0x000056294243d427 in do_command (thd=0x154ea0000c58, blocking=blocking@entry=true) at /test/10.9_opt/sql/sql_parse.cc:1402
      #24 0x000056294255cd77 in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /test/10.9_opt/sql/sql_connect.cc:1418
      #25 0x000056294255d0bd in handle_one_connection (arg=arg@entry=0x562946084848) at /test/10.9_opt/sql/sql_connect.cc:1312
      #26 0x00005629428d67b1 in pfs_spawn_thread (arg=0x5629460199a8) at /test/10.9_opt/storage/perfschema/pfs.cc:2201
      #27 0x0000154f50957609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #28 0x0000154f50545293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.9.0 b5852ffbeebc3000982988383daeefb0549e058a (Debug)

      mysqld: /test/10.9_dbg/storage/innobase/include/dict0dict.inl:211: dict_index_t* dict_table_get_first_index(const dict_table_t*): Assertion `table->magic_n == 76333786' failed.
      

      10.9.0 b5852ffbeebc3000982988383daeefb0549e058a (Debug)

      Core was generated by `/test/MD140222-mariadb-10.9.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x14afa8072700 (LWP 3994012))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014afb22d6859 in __GI_abort () at abort.c:79
      #2  0x000014afb22d6729 in __assert_fail_base (fmt=0x14afb246c588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55ba14f4e22e "table->magic_n == 76333786", file=0x55ba14f51328 "/test/10.9_dbg/storage/innobase/include/dict0dict.inl", line=211, function=<optimized out>) at assert.c:92
      #3  0x000014afb22e7f36 in __GI___assert_fail (assertion=assertion@entry=0x55ba14f4e22e "table->magic_n == 76333786", file=file@entry=0x55ba14f51328 "/test/10.9_dbg/storage/innobase/include/dict0dict.inl", line=line@entry=211, function=function@entry=0x55ba14f527e8 "dict_index_t* dict_table_get_first_index(const dict_table_t*)") at assert.c:101
      #4  0x000055ba146d87b3 in dict_table_get_first_index (table=0x14aed0024238) at /test/10.9_dbg/storage/innobase/include/dict0dict.inl:211
      #5  innobase_get_mysql_key_number_for_index (index=0x14aed00241e8, ib_table=0x14aed0021878, table=<optimized out>) at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:14421
      #6  ha_innobase::info_low (this=0x14aed0080e80, flag=<optimized out>, is_analyze=is_analyze@entry=false) at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:14904
      #7  0x000055ba146d8c82 in ha_innobase::info (this=<optimized out>, flag=<optimized out>) at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:14935
      #8  0x000055ba14332beb in handler::get_dup_key (this=this@entry=0x14aed0080e80, error=error@entry=121) at /test/10.9_dbg/sql/handler.cc:4783
      #9  0x000055ba14332e92 in handler::print_error (this=0x14aed0080e80, error=121, errflag=0) at /test/10.9_dbg/sql/handler.cc:4342
      #10 0x000055ba13fd05ba in write_record (thd=0x14aed0000db8, table=0x14aed00805a8, info=info@entry=0x14aed008b718, sink=<optimized out>) at /test/10.9_dbg/sql/sql_insert.cc:2201
      #11 0x000055ba13fd07c9 in select_insert::send_data (this=0x14aed008b6c8, values=<optimized out>) at /test/10.9_dbg/sql/sql_insert.cc:4120
      #12 0x000055ba1409889b in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=@0x14aed0014888: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14aed0014b88, last = 0x14aed0014b88, elements = 1}, <No data fields>}, this=<optimized out>) at /test/10.9_dbg/sql/sql_class.h:5612
      #13 end_send (join=0x14aed008b788, join_tab=0x14aed008d798, end_of_records=<optimized out>) at /test/10.9_dbg/sql/sql_select.cc:22331
      #14 0x000055ba141e316a in JOIN_CACHE::generate_full_extensions (this=this@entry=0x14aed008e0d8, rec_ptr=rec_ptr@entry=0x14aed0098518 "\017") at /test/10.9_dbg/sql/sql_join_cache.cc:2478
      #15 0x000055ba141e3511 in JOIN_CACHE::join_matching_records (this=0x14aed008e0d8, skip_last=false) at /test/10.9_dbg/sql/sql_join_cache.cc:2370
      #16 0x000055ba141e2b6a in JOIN_CACHE::join_records (this=this@entry=0x14aed008e0d8, skip_last=skip_last@entry=false) at /test/10.9_dbg/sql/sql_join_cache.cc:2151
      #17 0x000055ba1407e900 in sub_select_cache (join=0x14aed008b788, join_tab=0x14aed008d3e8, end_of_records=<optimized out>) at /test/10.9_dbg/sql/sql_select.cc:20869
      #18 0x000055ba1407e3c5 in sub_select (join=0x14aed008b788, join_tab=0x14aed008d038, end_of_records=<optimized out>) at /test/10.9_dbg/sql/sql_select.cc:21039
      #19 0x000055ba140b634a in do_select (procedure=<optimized out>, join=0x14aed008b788) at /test/10.9_dbg/sql/sql_select.cc:20642
      #20 JOIN::exec_inner (this=this@entry=0x14aed008b788) at /test/10.9_dbg/sql/sql_select.cc:4749
      #21 0x000055ba140b68c0 in JOIN::exec (this=this@entry=0x14aed008b788) at /test/10.9_dbg/sql/sql_select.cc:4527
      #22 0x000055ba140b48cf in mysql_select (thd=thd@entry=0x14aed0000db8, tables=0x14aed0014be0, fields=@0x14aed0014888: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14aed0014b88, last = 0x14aed0014b88, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2202446596608, result=0x14aed008b6c8, unit=0x14aed00051c8, select_lex=0x14aed00145e8) at /test/10.9_dbg/sql/sql_select.cc:5007
      #23 0x000055ba140b4b84 in handle_select (thd=thd@entry=0x14aed0000db8, lex=lex@entry=0x14aed00050f0, result=result@entry=0x14aed008b6c8, setup_tables_done_option=setup_tables_done_option@entry=1073741824) at /test/10.9_dbg/sql/sql_select.cc:543
      #24 0x000055ba140230c4 in mysql_execute_command (thd=thd@entry=0x14aed0000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:4708
      #25 0x000055ba1400d315 in mysql_parse (thd=thd@entry=0x14aed0000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14afa8071400) at /test/10.9_dbg/sql/sql_parse.cc:8027
      #26 0x000055ba1401bfb1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14aed0000db8, packet=packet@entry=0x14aed000b889 "INSERT INTO t SELECT s.SEQ FROM seq_1_to_128,seq_1_to_1024 s", packet_length=packet_length@entry=60, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
      #27 0x000055ba1401f3f8 in do_command (thd=0x14aed0000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
      #28 0x000055ba14199fc4 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55ba169d74f8, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
      #29 0x000055ba1419a5c9 in handle_one_connection (arg=arg@entry=0x55ba169d74f8) at /test/10.9_dbg/sql/sql_connect.cc:1312
      #30 0x000055ba14620d67 in pfs_spawn_thread (arg=0x55ba168ea9a8) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
      #31 0x000014afb27e5609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #32 0x000014afb23d3293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.7.2 (dbg), 10.7.2 (opt), 10.8.1 (dbg), 10.8.1 (opt), 10.9.0 (dbg), 10.9.0 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.42 (dbg), 10.2.42 (opt), 10.3.33 (dbg), 10.3.33 (opt), 10.4.23 (dbg), 10.4.23 (opt), 10.5.14 (dbg), 10.5.14 (opt), 10.6.6 (dbg), 10.6.6 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.36 (dbg), 5.7.36 (opt), 8.0.27 (dbg), 8.0.27 (opt)

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.