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

Invalid (old?) table, unexpected ER_ROW_IS_REFERENCED_2, Assertion `!"invalid table name"' failure upon concurrent DML/DDL on tables with virtual columns and foreign keys

    XMLWordPrintable

    Details

      Description

      Note: The test case is non-deterministic, run with --repeat=N. It usually fails for me in 1-3 attempts.
      Note: There is some redundancy in error codes and timeouts in the test case, it is to make it applicable to 10.1 as well. It only partially helps though, as 10.1 still hangs, despite the timeouts.

      --source include/have_innodb.inc
       
      SET @stats.save= @@innodb_stats_persistent;
      SET GLOBAL innodb_stats_persistent= ON;
       
      CREATE TABLE t1 ( 
        pk INT AUTO_INCREMENT,
        f CHAR(8) NULL,
        v CHAR(8) AS (f) VIRTUAL,
        PRIMARY KEY(pk)
      ) ENGINE=InnoDB;
       
      INSERT INTO t1 (f) VALUES ('bar'),('foo');
       
      CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB;
      INSERT INTO t2 VALUES (1);
       
      CREATE TABLE t3 (pk INT PRIMARY KEY) ENGINE=InnoDB;
      CREATE VIEW v3 AS SELECT * FROM t3;
       
      --connect (con1,localhost,root,,test)
      --send
        INSERT INTO v3 SELECT * FROM t3;
      --connection default
      SET lock_wait_timeout= 2, innodb_lock_wait_timeout= 2;
      --send
        ALTER TABLE t1 ADD FOREIGN KEY (pk) REFERENCES t2 (pk) ON DELETE CASCADE;
       
      --connection con1
      --reap
      --error 0,ER_BAD_FIELD_ERROR
      ALTER IGNORE TABLE t2 ADD CHECK (x < 4);
       
      --error ER_WRONG_VALUE_COUNT_ON_ROW
      INSERT IGNORE INTO t2 VALUES (1,2);
      SET lock_wait_timeout= 2, innodb_lock_wait_timeout= 2;
      --error 0,ER_LOCK_WAIT_TIMEOUT
      REPLACE INTO t2 SELECT * FROM t2;
       
      # Cleanup
      --disconnect con1
       
      --connection default
      --error ER_NO_REFERENCED_ROW_2
      --reap
      SET GLOBAL innodb_stats_persistent= @stats.save;
      DROP VIEW v3;
      DROP TABLE t1, t2, t3;
      

      mysqltest: At line 48: query 'DROP TABLE t1, t2, t3' failed: 1451: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`#sql-a5d_9`, CONSTRAINT `#sql-a5d_9_ibfk_1` FOREIGN KEY (`pk`) REFERENCES `t2` (`pk`) ON DELETE CASCADE)
      

      2019-02-09  0:55:14 139629861943040 [ERROR] Invalid (old?) table or database name '#sql-a5d_9'
      

      10.2 0216f87d debug

      2019-02-09  0:56:19 140176325338880 [ERROR] Invalid (old?) table or database name '#sql-add_e'
      mysqld: /data/src/10.2/storage/innobase/handler/ha_innodb.cc:21546: TABLE* innodb_find_table_for_vc(THD*, dict_table_t*): Assertion `!"invalid table name"' failed.
      190209  0:56:19 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f7d5e4b1ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x00005606591dd424 in innodb_find_table_for_vc (thd=0x7f7d00000b00, table=0x7f7d0c0dc258) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:21546
      #9  0x00005606591dd912 in innobase_allocate_row_for_vcol (thd=0x7f7d00000b00, index=0x7f7d0c0df558, heap=0x7f7d581394d8, table=0x7f7d581394b0, record=0x7f7d581394e0, storage=0x7f7d581394e8) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:21687
      #10 0x0000560659357dd6 in row_upd_store_v_row (node=0x7f7d00074998, update=0x0, thd=0x7f7d00000b00, mysql_table=0x0) at /data/src/10.2/storage/innobase/row/row0upd.cc:2139
      #11 0x0000560659358225 in row_upd_store_row (node=0x7f7d00074998, thd=0x7f7d00000b00, mysql_table=0x0) at /data/src/10.2/storage/innobase/row/row0upd.cc:2259
      #12 0x000056065935a3b6 in row_upd_del_mark_clust_rec (node=0x7f7d00074998, index=0x7f7d0c0df558, offsets=0x7f7d58139b20, thr=0x7f7d0c0d1158, referenced=0, foreign=true, mtr=0x7f7d58139e40) at /data/src/10.2/storage/innobase/row/row0upd.cc:2982
      #13 0x000056065935acbe in row_upd_clust_step (node=0x7f7d00074998, thr=0x7f7d0c0d1158) at /data/src/10.2/storage/innobase/row/row0upd.cc:3165
      #14 0x000056065935b19f in row_upd (node=0x7f7d00074998, thr=0x7f7d0c0d1158) at /data/src/10.2/storage/innobase/row/row0upd.cc:3286
      #15 0x000056065935b678 in row_upd_step (thr=0x7f7d0c0d1158) at /data/src/10.2/storage/innobase/row/row0upd.cc:3432
      #16 0x00005606593025d9 in row_update_cascade_for_mysql (thr=0x7f7d0c0d1158, node=0x7f7d00074998, table=0x7f7d0c0dc258) at /data/src/10.2/storage/innobase/row/row0mysql.cc:2114
      #17 0x00005606592de149 in row_ins_foreign_check_on_constraint (thr=0x7f7d0c0d1158, foreign=0x7f7d0c0dd7e8, pcur=0x7f7d5813a7f0, entry=0x7f7d00074260, mtr=0x7f7d5813ac10) at /data/src/10.2/storage/innobase/row/row0ins.cc:1435
      #18 0x00005606592dedc4 in row_ins_check_foreign_constraint (check_ref=0, foreign=0x7f7d0c0dd7e8, table=0x7f7d0c0915d8, entry=0x7f7d00074260, thr=0x7f7d0c0d1158) at /data/src/10.2/storage/innobase/row/row0ins.cc:1803
      #19 0x000056065935459d in row_upd_check_references_constraints (node=0x7f7d0c0d0e80, pcur=0x7f7d0001f400, table=0x7f7d0c0915d8, index=0x7f7d0c072288, offsets=0x7f7d5813b4a0, thr=0x7f7d0c0d1158, mtr=0x7f7d5813b7c0) at /data/src/10.2/storage/innobase/row/row0upd.cc:327
      #20 0x000056065935a481 in row_upd_del_mark_clust_rec (node=0x7f7d0c0d0e80, index=0x7f7d0c072288, offsets=0x7f7d5813b4a0, thr=0x7f7d0c0d1158, referenced=1, foreign=false, mtr=0x7f7d5813b7c0) at /data/src/10.2/storage/innobase/row/row0upd.cc:2998
      #21 0x000056065935acbe in row_upd_clust_step (node=0x7f7d0c0d0e80, thr=0x7f7d0c0d1158) at /data/src/10.2/storage/innobase/row/row0upd.cc:3165
      #22 0x000056065935b19f in row_upd (node=0x7f7d0c0d0e80, thr=0x7f7d0c0d1158) at /data/src/10.2/storage/innobase/row/row0upd.cc:3286
      #23 0x000056065935b678 in row_upd_step (thr=0x7f7d0c0d1158) at /data/src/10.2/storage/innobase/row/row0upd.cc:3432
      #24 0x0000560659301bd5 in row_update_for_mysql (prebuilt=0x7f7d0c0d03c8) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1830
      #25 0x00005606591c794f in ha_innobase::delete_row (this=0x7f7d0c0740f8, record=0x7f7d0c070fb8 "\245\001") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9103
      #26 0x0000560658ebb896 in handler::ha_delete_row (this=0x7f7d0c0740f8, buf=0x7f7d0c070fb8 "\245\001") at /data/src/10.2/sql/handler.cc:6069
      #27 0x0000560658c0e70d in write_record (thd=0x7f7d00000b00, table=0x7f7d0c0734f0, info=0x7f7d00012748) at /data/src/10.2/sql/sql_insert.cc:1893
      #28 0x0000560658c13965 in select_insert::send_data (this=0x7f7d00012708, values=...) at /data/src/10.2/sql/sql_insert.cc:3758
      #29 0x0000560658ca4800 in end_send (join=0x7f7d000127b0, join_tab=0x7f7d00014158, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:19930
      #30 0x0000560658ca22b4 in evaluate_join_record (join=0x7f7d000127b0, join_tab=0x7f7d00013da8, error=0) at /data/src/10.2/sql/sql_select.cc:18978
      #31 0x0000560658cb6744 in AGGR_OP::end_send (this=0x7f7d00014630) at /data/src/10.2/sql/sql_select.cc:26720
      #32 0x0000560658ca1670 in sub_select_postjoin_aggr (join=0x7f7d000127b0, join_tab=0x7f7d00013da8, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18473
      #33 0x0000560658ca1996 in sub_select (join=0x7f7d000127b0, join_tab=0x7f7d000139f8, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18709
      #34 0x0000560658ca11ac in do_select (join=0x7f7d000127b0, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18304
      #35 0x0000560658c7b73f in JOIN::exec_inner (this=0x7f7d000127b0) at /data/src/10.2/sql/sql_select.cc:3623
      #36 0x0000560658c7abec in JOIN::exec (this=0x7f7d000127b0) at /data/src/10.2/sql/sql_select.cc:3418
      #37 0x0000560658c7bdb7 in mysql_select (thd=0x7f7d00000b00, tables=0x7f7d000118e0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489925888, result=0x7f7d00012708, unit=0x7f7d000046e8, select_lex=0x7f7d00004e20) at /data/src/10.2/sql/sql_select.cc:3818
      #38 0x0000560658c6ffc7 in handle_select (thd=0x7f7d00000b00, lex=0x7f7d00004620, result=0x7f7d00012708, setup_tables_done_option=1073741824) at /data/src/10.2/sql/sql_select.cc:376
      #39 0x0000560658c3454e in mysql_execute_command (thd=0x7f7d00000b00) at /data/src/10.2/sql/sql_parse.cc:4548
      #40 0x0000560658c3f351 in mysql_parse (thd=0x7f7d00000b00, rawbuf=0x7f7d00011098 "REPLACE INTO t2 SELECT * FROM t2", length=32, parser_state=0x7f7d5813d200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8018
      #41 0x0000560658c2cc8b in dispatch_command (command=COM_QUERY, thd=0x7f7d00000b00, packet=0x7f7d000088b1 "REPLACE INTO t2 SELECT * FROM t2", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1829
      #42 0x0000560658c2b596 in do_command (thd=0x7f7d00000b00) at /data/src/10.2/sql/sql_parse.cc:1379
      #43 0x0000560658d7ea3e in do_handle_one_connection (connect=0x56065c53a920) at /data/src/10.2/sql/sql_connect.cc:1336
      #44 0x0000560658d7e7cb in handle_one_connection (arg=0x56065c53a920) at /data/src/10.2/sql/sql_connect.cc:1242
      #45 0x00005606591a5f0e in pfs_spawn_thread (arg=0x56065c540730) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #46 0x00007f7d60188494 in start_thread (arg=0x7f7d5813e700) at pthread_create.c:333
      #47 0x00007f7d5e56e93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Reproducible on 10.2-10.4.
      10.1 doesn't crash for me, but it hangs on or around REPLACE.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              svoj Sergey Vojtovich
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.