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

EXCHANGE PARTITION with non-matching vcol expression segfault

    XMLWordPrintable

Details

    Description

      SIGSEGV in row_mysql_store_col_in_innobase_format, and Assertion `pos < table->n_v_def' failed in dict_table_get_nth_v_col, and Assertion `table->s->db_options_in_use == part_table->s->db_options_in_use' failed in compare_table_with_partition

      Even though it is present in all versions, this may be a new regression. Feel free to remove tag and lower prio if not.

      SET sql_mode='';
      CREATE TABLE t1 (a INT,KEY(a)) ENGINE=InnoDB PARTITION BY RANGE (a) (PARTITION p VALUES LESS THAN (1));
      CREATE TABLE t (a INT GENERATED ALWAYS AS (1) VIRTUAL,KEY(a));
      ALTER TABLE t1 EXCHANGE PARTITION p WITH TABLE t;
      INSERT INTO t VALUES (1);
      

      Leads to:

      10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Optimized)

      Core was generated by `/test/MD160322-mariadb-10.9.0-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000556de2e400eb in row_mysql_store_col_in_innobase_format (dfield=0x0, 
          buf=0x152df402ad11 "", row_format_col=1, mysql_data=0x152df40293e9 "\001", 
          col_len=4, comp=1) at /test/10.9_opt/storage/innobase/row/row0mysql.cc:363
      363		type = dtype->mtype;
      [Current thread is 1 (Thread 0x152e4c11a700 (LWP 4084564))]
      (gdb) bt
      #0  0x0000556de2e400eb in row_mysql_store_col_in_innobase_format (dfield=0x0, buf=0x152df402ad11 "", row_format_col=1, mysql_data=0x152df40293e9 "\001", col_len=4, comp=1) at /test/10.9_opt/storage/innobase/row/row0mysql.cc:363
      #1  0x0000556de2e42bbc in row_mysql_convert_row_to_innobase (blob_heap=<synthetic pointer>, mysql_rec=0x152df40293e8 "\375\001", prebuilt=0x152df402a760, row=0x152df402ad18) at /test/10.9_opt/storage/innobase/include/dict0mem.h:1820
      #2  row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x152df40293e8 "\375\001", prebuilt=0x152df402a760, ins_mode=ROW_INS_NORMAL) at /test/10.9_opt/storage/innobase/row/row0mysql.cc:1290
      #3  0x0000556de2d919da in ha_innobase::write_row (this=0x152df4029800, record=0x152df40293e8 "\375\001") at /test/10.9_opt/storage/innobase/handler/ha_innodb.cc:7800
      #4  0x0000556de2a9af30 in handler::ha_write_row (this=0x152df4029800, buf=0x152df40293e8 "\375\001") at /test/10.9_opt/sql/handler.cc:7527
      #5  0x0000556de280421d in write_record (thd=thd@entry=0x152df4000c58, table=table@entry=0x152df40177d8, info=info@entry=0x152e4c118c80, sink=sink@entry=0x0) at /test/10.9_opt/sql/sql_insert.cc:2156
      #6  0x0000556de280aa68 in mysql_insert (thd=thd@entry=0x152df4000c58, table_list=<optimized out>, fields=@0x152df4005d60: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x556de39d63b0 <end_of_list>, last = 0x152df4005d60, elements = 0}, <No data fields>}, values_list=@0x152df4005da8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x152df40115a0, last = 0x152df40115a0, elements = 1}, <No data fields>}, update_fields=@0x152df4005d90: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x556de39d63b0 <end_of_list>, last = 0x152df4005d90, elements = 0}, <No data fields>}, update_values=@0x152df4005d78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x556de39d63b0 <end_of_list>, last = 0x152df4005d78, elements = 0}, <No data fields>}, duplic=<optimized out>, ignore=<optimized out>, result=<optimized out>) at /test/10.9_opt/sql/sql_insert.cc:1127
      #7  0x0000556de284596f in mysql_execute_command (thd=0x152df4000c58, is_called_from_prepared_stmt=<optimized out>) at /test/10.9_opt/sql/sql_parse.cc:4562
      #8  0x0000556de28351c6 in mysql_parse (thd=0x152df4000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.9_opt/sql/sql_parse.cc:8027
      #9  0x0000556de2841375 in dispatch_command (command=COM_QUERY, thd=0x152df4000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/10.9_opt/sql/sql_class.h:1362
      #10 0x0000556de2843567 in do_command (thd=0x152df4000c58, blocking=blocking@entry=true) at /test/10.9_opt/sql/sql_parse.cc:1402
      #11 0x0000556de2962e97 in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /test/10.9_opt/sql/sql_connect.cc:1418
      #12 0x0000556de29631dd in handle_one_connection (arg=arg@entry=0x556de630d458) at /test/10.9_opt/sql/sql_connect.cc:1312
      #13 0x0000556de2cdc8d1 in pfs_spawn_thread (arg=0x556de628cbc8) at /test/10.9_opt/storage/perfschema/pfs.cc:2201
      #14 0x0000152e632d5609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #15 0x0000152e62ec1163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

      mysqld: /test/10.9_dbg/storage/innobase/include/dict0dict.inl:387: dict_v_col_t* dict_table_get_nth_v_col(const dict_table_t*, ulint): Assertion `pos < table->n_v_def' failed.
      

      10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

      Core was generated by `/test/MD160322-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 0x149e1c1fe700 (LWP 4084799))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000149e38873859 in __GI_abort () at abort.c:79
      #2  0x0000149e38873729 in __assert_fail_base (fmt=0x149e38a09588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55872b6de646 "pos < table->n_v_def", file=0x55872b6e1278 "/test/10.9_dbg/storage/innobase/include/dict0dict.inl", line=387, function=<optimized out>) at assert.c:92
      #3  0x0000149e38885006 in __GI___assert_fail (assertion=assertion@entry=0x55872b6de646 "pos < table->n_v_def", file=file@entry=0x55872b6e1278 "/test/10.9_dbg/storage/innobase/include/dict0dict.inl", line=line@entry=387, function=function@entry=0x55872b6e2d30 "dict_v_col_t* dict_table_get_nth_v_col(const dict_table_t*, ulint)") at assert.c:101
      #4  0x000055872ae686b6 in dict_table_get_nth_v_col (pos=0, table=0x149ddc0242c8) at /test/10.9_dbg/storage/innobase/include/dict0dict.inl:387
      #5  build_template_field (prebuilt=0x149ddc02bfc8, clust_index=clust_index@entry=0x149ddc026ae8, index=index@entry=0x149ddc026ae8, table=<optimized out>, field=field@entry=0x149ddc03a090, i=<optimized out>, i@entry=0, v_no=<optimized out>) at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:7175
      #6  0x000055872ae6d909 in ha_innobase::build_template (this=this@entry=0x149ddc03a4d0, whole_row=<optimized out>, whole_row@entry=true) at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:7587
      #7  0x000055872ae6de5d in ha_innobase::write_row (this=0x149ddc03a4d0, record=0x149ddc03a048 "\375\001") at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:7793
      #8  0x000055872aac7601 in handler::ha_write_row (this=0x149ddc03a4d0, buf=0x149ddc03a048 "\375\001") at /test/10.9_dbg/sql/handler.cc:7527
      #9  0x000055872a75d494 in write_record (thd=thd@entry=0x149ddc000db8, table=table@entry=0x149ddc0358a8, info=info@entry=0x149e1c1fccd0, sink=sink@entry=0x0) at /test/10.9_dbg/sql/sql_insert.cc:2156
      #10 0x000055872a7691ea in mysql_insert (thd=thd@entry=0x149ddc000db8, table_list=0x149ddc013eb8, fields=@0x149ddc006080: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55872be009a0 <end_of_list>, last = 0x149ddc006080, elements = 0}, <No data fields>}, values_list=@0x149ddc0060c8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x149ddc014ac0, last = 0x149ddc014ac0, elements = 1}, <No data fields>}, update_fields=@0x149ddc0060b0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55872be009a0 <end_of_list>, last = 0x149ddc0060b0, elements = 0}, <No data fields>}, update_values=@0x149ddc006098: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55872be009a0 <end_of_list>, last = 0x149ddc006098, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.9_dbg/sql/sql_insert.cc:1127
      #11 0x000055872a7afa4c in mysql_execute_command (thd=thd@entry=0x149ddc000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:4562
      #12 0x000055872a79a437 in mysql_parse (thd=thd@entry=0x149ddc000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x149e1c1fd400) at /test/10.9_dbg/sql/sql_parse.cc:8027
      #13 0x000055872a7a90d3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x149ddc000db8, packet=packet@entry=0x149ddc00b889 "INSERT INTO t VALUES (1)", packet_length=packet_length@entry=24, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
      #14 0x000055872a7ac51a in do_command (thd=0x149ddc000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
      #15 0x000055872a927228 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55872e275a48, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
      #16 0x000055872a92782d in handle_one_connection (arg=arg@entry=0x55872e275a48) at /test/10.9_dbg/sql/sql_connect.cc:1312
      #17 0x000055872adadf23 in pfs_spawn_thread (arg=0x55872e188fd8) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
      #18 0x0000149e38d84609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #19 0x0000149e38970163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.2.44 (dbg), 10.2.44 (opt), 10.3.35 (dbg), 10.3.35 (opt), 10.4.25 (dbg), 10.4.25 (opt), 10.5.16 (dbg), 10.5.16 (opt), 10.6.8 (dbg), 10.6.8 (opt), 10.7.4 (dbg), 10.7.4 (opt), 10.8.3 (dbg), 10.8.3 (opt), 10.9.0 (dbg), 10.9.0 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.37 (dbg), 5.7.37 (opt), 8.0.28 (dbg), 8.0.28 (opt)

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              8 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.