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

Server crash or assertion `foreign->foreign_table != __null' failed in init_fts_doc_id_for_ref

    XMLWordPrintable

Details

    Description

      10.2 1ff8588c non-debug

      2020-10-27 15:12:55 139934267832064 [Warning] InnoDB: In ALTER TABLE `test`.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition.
      201027 15:12:55 [ERROR] mysqld got signal 11 ;
       
      #3  <signal handler called>
      #4  0x00005589c7ea5253 in init_fts_doc_id_for_ref (depth=0x7f44fc4e9928, table=0x7f44a80940a8) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1722
      #5  init_fts_doc_id_for_ref (depth=0x7f44fc4e9928, table=0x7f44a80940a8) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1696
      #6  row_update_for_mysql (prebuilt=0x7f44a80a7528) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1772
      #7  0x00005589c7df5953 in ha_innobase::update_row (this=0x7f44a80a2150, old_row=0x7f44a8094908 "\375=", new_row=0x7f44a80948f8 "\375=") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:8954
      #8  0x00005589c7c57a44 in handler::ha_update_row (this=0x7f44a80a2150, old_data=0x7f44a8094908 "\375=", new_data=0x7f44a80948f8 "\375=") at /data/src/10.2/sql/handler.cc:6141
      #9  0x00005589c7b47eff in mysql_update (thd=thd@entry=0x7f44ac000c48, table_list=<optimized out>, fields=..., values=..., conds=<optimized out>, order_num=<optimized out>, order=<optimized out>, limit=18446744073709551555, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f44fc4e9fa0, updated_return=0x7f44fc4ea050) at /data/src/10.2/sql/sql_update.cc:819
      #10 0x00005589c7a9e9e2 in mysql_execute_command (thd=0x7f44ac000c48) at /data/src/10.2/sql/sql_parse.cc:4001
      #11 0x00005589c7aa445b in mysql_parse (thd=thd@entry=0x7f44ac000c48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f44fc4eb5b0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:7733
      #12 0x00005589c7aa770d in dispatch_command (command=COM_QUERY, thd=0x7f44ac000c48, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.2/sql/sql_class.h:1095
      #13 0x00005589c7aa8897 in do_command (thd=0x7f44ac000c48) at /data/src/10.2/sql/sql_parse.cc:1380
      #14 0x00005589c7b80f36 in do_handle_one_connection (connect=connect@entry=0x5589cb484b38) at /data/src/10.2/sql/sql_connect.cc:1336
      #15 0x00005589c7b810af in handle_one_connection (arg=arg@entry=0x5589cb484b38) at /data/src/10.2/sql/sql_connect.cc:1241
      #16 0x00005589c8118c76 in pfs_spawn_thread (arg=0x5589cb4379c8) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #17 0x00007f45025af609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #18 0x00007f45021a4293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.2 1ff8588c debug

      2020-10-27 15:10:50 139714472048384 [Warning] InnoDB: In ALTER TABLE `test`.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition.
      mysqld: /data/src/10.2/storage/innobase/row/row0mysql.cc:1720: void init_fts_doc_id_for_ref(dict_table_t*, ulint*): Assertion `foreign->foreign_table != __null' failed.
      201027 15:10:50 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f11d9394f36 in __GI___assert_fail (assertion=0x560917e53bd8 "foreign->foreign_table != __null", file=0x560917e52dd8 "/data/src/10.2/storage/innobase/row/row0mysql.cc", line=1720, function=0x560917e53ba0 "void init_fts_doc_id_for_ref(dict_table_t*, ulint*)") at assert.c:101
      #8  0x0000560917822f31 in init_fts_doc_id_for_ref (table=0x7f11800a05e0, depth=0x7f11cf7523c0) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1720
      #9  0x000056091782319a in row_update_for_mysql (prebuilt=0x7f118009b890) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1772
      #10 0x00005609176e3f8a in ha_innobase::update_row (this=0x7f1180191488, old_row=0x7f11800a80d0 "\375\f", new_row=0x7f11800a80c0 "\375\f") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:8954
      #11 0x00005609174e515c in handler::ha_update_row (this=0x7f1180191488, old_data=0x7f11800a80d0 "\375\f", new_data=0x7f11800a80c0 "\375\f") at /data/src/10.2/sql/handler.cc:6141
      #12 0x000056091734821c in mysql_update (thd=0x7f1174000d90, table_list=0x7f1174011410, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551604, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f11cf752c60, updated_return=0x7f11cf752d10) at /data/src/10.2/sql/sql_update.cc:819
      #13 0x0000560917255111 in mysql_execute_command (thd=0x7f1174000d90) at /data/src/10.2/sql/sql_parse.cc:4001
      #14 0x0000560917260ec1 in mysql_parse (thd=0x7f1174000d90, rawbuf=0x7f1174011338 "UPDATE t1 SET a = 6", length=19, parser_state=0x7f11cf7535f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7733
      #15 0x000056091724f25e in dispatch_command (command=COM_QUERY, thd=0x7f1174000d90, packet=0x7f1174008b51 "UPDATE t1 SET a = 6", packet_length=19, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1826
      #16 0x000056091724dd59 in do_command (thd=0x7f1174000d90) at /data/src/10.2/sql/sql_parse.cc:1380
      #17 0x00005609173a7bb1 in do_handle_one_connection (connect=0x56091a604f60) at /data/src/10.2/sql/sql_connect.cc:1336
      #18 0x00005609173a7916 in handle_one_connection (arg=0x56091a604f60) at /data/src/10.2/sql/sql_connect.cc:1241
      #19 0x0000560917bcc0cc in pfs_spawn_thread (arg=0x56091a645920) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #20 0x00007f11d98a4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #21 0x00007f11d9480293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      rr profile is available.

      Reproducible on 10.2-10.5 with the test case below. 10.1 rejects the first ALTER TABLE despite the disabled foreign key checks.
      The test case is non-deterministic, run with --repeat=N. It currently fails for me reasonably well, within ~10 attempts or so (but it takes much longer with rr, hundreds of attempts).

      --source include/have_innodb.inc
      --source include/have_sequence.inc
       
      call mtr.add_suppression("has or is referenced in foreign key constraints");
       
      CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, a INT, KEY(a)) ENGINE=InnoDB;
      CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=InnoDB;
       
      INSERT INTO t1 (a) SELECT 1 FROM seq_1_to_100;
       
      SET FOREIGN_KEY_CHECKS= OFF;
      ALTER TABLE t2 MODIFY COLUMN b YEAR;
       
      --connect (con1,localhost,root,,test)
      --send
        UPDATE t1 SET a = 6;
       
      --connection default
      ALTER TABLE t2 ADD INDEX ind (b);
       
      --source include/restart_mysqld.inc
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.