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

Crash when processing multi-update using view with optimizer_trace on

    XMLWordPrintable

Details

    Description

      SET SESSION optimizer_trace = 'enabled=on';
       
      CREATE TABLE t (a int, b int);
      CREATE VIEW v AS SELECT 1 AS c UNION SELECT 2 AS c;
      INSERT INTO t VALUES (3,4),(5,6);
      UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a;
       
      # Cleanup
      DROP VIEW v;
      DROP TABLE t;
      

      10.4 2e1c532b

      #3  <signal handler called>
      #4  0x000055f70170f2e4 in st_select_lex::print_set_clause (this=0x7fe460019058, thd=0x7fe460000da0, str=0x7fe47246aba0, query_type=1037) at /data/src/10.4/sql/sql_select.cc:28113
      #5  0x000055f701710143 in st_select_lex::print (this=0x7fe460019058, thd=0x7fe460000da0, str=0x7fe47246aba0, query_type=1037) at /data/src/10.4/sql/sql_select.cc:28357
      #6  0x000055f7018ed6ad in opt_trace_print_expanded_query (thd=0x7fe460000da0, select_lex=0x7fe460019058, writer=0x7fe47246b140) at /data/src/10.4/sql/opt_trace.cc:115
      #7  0x000055f7016c1d21 in JOIN::prepare (this=0x7fe460064d38, tables_init=0x7fe460016270, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fe460019058, unit_arg=0x7fe460016228) at /data/src/10.4/sql/sql_select.cc:1566
      #8  0x000055f7016cdd4d in mysql_select (thd=0x7fe460000da0, tables=0x7fe460016270, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=268435456, result=0x7fe460019a78, unit=0x7fe460016228, select_lex=0x7fe460019058) at /data/src/10.4/sql/sql_select.cc:4747
      #9  0x000055f701792064 in st_select_lex_unit::exec (this=0x7fe460016228) at /data/src/10.4/sql/sql_union.cc:1729
      #10 0x000055f70161b273 in mysql_derived_fill (thd=0x7fe460000da0, lex=0x7fe460004c18, derived=0x7fe460015038) at /data/src/10.4/sql/sql_derived.cc:1245
      #11 0x000055f7016183a7 in mysql_handle_single_derived (lex=0x7fe460004c18, derived=0x7fe460015038, phases=96) at /data/src/10.4/sql/sql_derived.cc:200
      #12 0x000055f7016e7e7c in st_join_table::preread_init (this=0x7fe460063bd0) at /data/src/10.4/sql/sql_select.cc:13823
      #13 0x000055f7016fab39 in sub_select (join=0x7fe460058568, join_tab=0x7fe460063bd0, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20796
      #14 0x000055f7016fb4ce in evaluate_join_record (join=0x7fe460058568, join_tab=0x7fe460063828, error=0) at /data/src/10.4/sql/sql_select.cc:21059
      #15 0x000055f7016fad23 in sub_select (join=0x7fe460058568, join_tab=0x7fe460063828, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20832
      #16 0x000055f7016fa100 in do_select (join=0x7fe460058568, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:20366
      #17 0x000055f7016cd73c in JOIN::exec_inner (this=0x7fe460058568) at /data/src/10.4/sql/sql_select.cc:4590
      #18 0x000055f7016cc810 in JOIN::exec (this=0x7fe460058568) at /data/src/10.4/sql/sql_select.cc:4372
      #19 0x000055f7016ce00f in mysql_select (thd=0x7fe460000da0, tables=0x7fe4600148f8, wild_num=0, fields=..., conds=0x7fe460015e40, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7fe460058478, unit=0x7fe460004cd8, select_lex=0x7fe460005508) at /data/src/10.4/sql/sql_select.cc:4811
      #20 0x000055f70179af81 in mysql_multi_update (thd=0x7fe460000da0, table_list=0x7fe4600148f8, fields=0x7fe460005668, values=0x7fe460005c28, conds=0x7fe460015e40, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7fe460004cd8, select_lex=0x7fe460005508, result=0x7fe47246bd40) at /data/src/10.4/sql/sql_update.cc:1965
      #21 0x000055f701677e43 in mysql_execute_command (thd=0x7fe460000da0) at /data/src/10.4/sql/sql_parse.cc:4520
      #22 0x000055f701683d83 in mysql_parse (thd=0x7fe460000da0, rawbuf=0x7fe4600147e8 "UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a", length=52, parser_state=0x7fe47246c3c0, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7998
      #23 0x000055f70166f7b5 in dispatch_command (command=COM_QUERY, thd=0x7fe460000da0, packet=0x7fe46000ac41 "UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a", packet_length=52, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
      #24 0x000055f70166e01c in do_command (thd=0x7fe460000da0) at /data/src/10.4/sql/sql_parse.cc:1378
      #25 0x000055f70180e9ca in do_handle_one_connection (connect=0x55f704d3ba00) at /data/src/10.4/sql/sql_connect.cc:1420
      #26 0x000055f70180e732 in handle_one_connection (arg=0x55f704d3ba00) at /data/src/10.4/sql/sql_connect.cc:1324
      #27 0x000055f701d5ea48 in pfs_spawn_thread (arg=0x55f704d81930) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #28 0x00007fe4784a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #29 0x00007fe4785285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Reproducible with MyISAM, Aria, InnoDB.
      The failure started happening after this commit in 10.4:

      commit f33fc2fae5c3f3e80c4d24348609f3ce5246ca9c
      Author: Igor Babaev
      Date:   Wed Mar 22 21:59:18 2023 -0700
       
          MDEV-30539 EXPLAIN EXTENDED: no message with queries for DML statements
      

      Attachments

        Activity

          People

            igor Igor Babaev
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.