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

mysqld_update()/mysql_delete() continues execution even after subquery with JOIN gets error from storage engine

    XMLWordPrintable

Details

    • 10.0.29, 10.1.24

    Description

      InnoDB: Assertion failure in thread 140511760934656 in file trx0trx.ic line 60
      InnoDB: Failing assertion: state == TRX_STATE_NOT_STARTED
      

      Stack trace from 10.0 commit cee9ab9d85a8d75290b0d60bc7af26c8cf179a1d

      #5  0x00007fcb6f8ed538 in abort () from /lib64/libc.so.6
      #6  0x00000000009fbae5 in trx_state_eq (trx=0x7fcb5cc35578, state=TRX_STATE_ACTIVE) at /src/10.0/storage/xtradb/include/trx0trx.ic:60
      #7  0x0000000000a07fdb in ha_innobase::unlock_row (this=0x7fcb5cc63088) at /src/10.0/storage/xtradb/handler/ha_innodb.cc:8561
      #8  0x00000000006bb7ed in rr_unlock_row (tab=0x7fcb5ca6aa30) at /src/10.0/sql/sql_select.cc:10270
      #9  0x00000000006cd457 in evaluate_join_record (join=0x7fcb5cc88998, join_tab=0x7fcb5ca6aa30, error=0) at /src/10.0/sql/sql_select.cc:18087
      #10 0x00000000006ccde9 in sub_select (join=0x7fcb5cc88998, join_tab=0x7fcb5ca6aa30, end_of_records=false) at /src/10.0/sql/sql_select.cc:17880
      #11 0x00000000006cd333 in evaluate_join_record (join=0x7fcb5cc88998, join_tab=0x7fcb5ca6a708, error=0) at /src/10.0/sql/sql_select.cc:18063
      #12 0x00000000006ccc55 in sub_select (join=0x7fcb5cc88998, join_tab=0x7fcb5ca6a708, end_of_records=false) at /src/10.0/sql/sql_select.cc:17841
      #13 0x00000000006cc4c9 in do_select (join=0x7fcb5cc88998, fields=0x7fcb7198cba0, table=0x0, procedure=0x0) at /src/10.0/sql/sql_select.cc:17503
      #14 0x00000000006a973a in JOIN::exec_inner (this=0x7fcb5cc88998) at /src/10.0/sql/sql_select.cc:3084
      #15 0x00000000006a6c0a in JOIN::exec (this=0x7fcb5cc88998) at /src/10.0/sql/sql_select.cc:2373
      #16 0x00000000006a9fb7 in mysql_select (thd=0x7fcb6afe39b0, rref_pointer_array=0x7fcb6afe7c88, tables=0x7fcb5cc68270, wild_num=0, fields=..., conds=0x7fcb5cc77678, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7fcb5cc888d8, unit=0x7fcb6afe7320, select_lex=0x7fcb6afe7a10) at /src/10.0/sql/sql_select.cc:3308
      #17 0x0000000000738986 in mysql_multi_update (thd=0x7fcb6afe39b0, table_list=0x7fcb5cc68270, fields=0x7fcb6afe7b28, values=0x7fcb6afe7fb0, conds=0x7fcb5cc77678, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7fcb6afe7320, select_lex=0x7fcb6afe7a10, result=0x7fcb7198d2c0) at /src/10.0/sql/sql_update.cc:1597
      #18 0x000000000066f061 in mysql_execute_command (thd=0x7fcb6afe39b0) at /src/10.0/sql/sql_parse.cc:3378
      #19 0x00000000006777cd in mysql_parse (thd=0x7fcb6afe39b0, rawbuf=0x7fcb5cc68088 "UPDATE v1 LEFT JOIN t1 ON (v1.f1_2 = t1.f1_1) SET v1.f1_4 = 1 WHERE EXISTS ( SELECT * FROM t2 INNER JOIN v3 ON (f3_2 = f2) WHERE f3_1 = t1.f1_3 OR f3_2 > f2 )", length=158, parser_state=0x7fcb7198d650) at /src/10.0/sql/sql_parse.cc:6574
      #20 0x000000000066a309 in dispatch_command (command=COM_QUERY, thd=0x7fcb6afe39b0, packet=0x7fcb5f782eb1 "UPDATE v1 LEFT JOIN t1 ON (v1.f1_2 = t1.f1_1) SET v1.f1_4 = 1 WHERE EXISTS ( SELECT * FROM t2 INNER JOIN v3 ON (f3_2 = f2) WHERE f3_1 = t1.f1_3 OR f3_2 > f2 )", packet_length=158) at /src/10.0/sql/sql_parse.cc:1308
      #21 0x00000000006695d6 in do_command (thd=0x7fcb6afe39b0) at /src/10.0/sql/sql_parse.cc:998
      #22 0x0000000000787cb2 in do_handle_one_connection (thd_arg=0x7fcb6afe39b0) at /src/10.0/sql/sql_connect.cc:1378
      #23 0x0000000000787a24 in handle_one_connection (arg=0x7fcb6afe39b0) at /src/10.0/sql/sql_connect.cc:1293
      #24 0x0000000000df561c in pfs_spawn_thread (arg=0x7fcb5f6ca4f0) at /src/10.0/storage/perfschema/pfs.cc:1860
      #25 0x00007fcb716080a4 in start_thread () from /lib64/libpthread.so.0
      #26 0x00007fcb6f99c04d in clone () from /lib64/libc.so.6
      

      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7fcb5cc68088): UPDATE v1 LEFT JOIN t1 ON (v1.f1_2 = t1.f1_1) SET v1.f1_4 = 1 WHERE EXISTS ( SELECT * FROM t2 INNER JOIN v3 ON (f3_2 = f2) WHERE f3_1 = t1.f1_3 OR f3_2 > f2 )
      Connection ID (thread ID): 3
      Status: NOT_KILLED
      

      Test case

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (
        f1_1 DATE,
        f1_2 DATE NOT NULL,
        f1_3 VARCHAR(10),
        f1_4 INT UNSIGNED,
        f_ind DATE NOT NULL,
        KEY(f_ind)
      ) ENGINE=InnoDB;
      CREATE OR REPLACE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
      INSERT INTO t1 VALUES (NULL, '0000-00-00', 'z', 2, '2001-03-01'), ('0000-00-00', '2001-08-25', 'p', 2, '2006-03-03');
       
      CREATE TABLE t2 (f2 INT UNSIGNED) ENGINE=InnoDB;
      INSERT INTO t2 VALUES (1),(2);
       
      CREATE TABLE t3 (
        pk INT,
        f3_1 VARCHAR(10),
        f3_2 INT UNSIGNED,
      primary key (pk)
      ) ENGINE=innodb;
      CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
      INSERT INTO t3 VALUES (1, NULL, 9), (2, 'v', 0);
       
      --connect (con1,localhost,root,,test)
      --send
      UPDATE t1, t2, t3 SET pk = -1;
       
      --connection default
      UPDATE v1 LEFT JOIN t1 ON (v1.f1_2 = t1.f1_1) SET v1.f1_4 = 1 WHERE EXISTS ( SELECT * FROM t2 INNER JOIN v3 ON (f3_2 = f2) WHERE f3_1 = t1.f1_3 OR f3_2 > f2 );
       
      --connection con1
      --reap
      

      Attachments

        Issue Links

          Activity

            People

              vlad.lesin Vladislav Lesin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.