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

Server crashes in trnman_can_read_from on select and from subqueries, Aria tables

    Details

      Description

      It's an old problem, introduced some time around 5.3.3. The test case is weird, so it's not very critical..

      Test case

      CREATE TABLE t1 (f1 INT) ENGINE=Aria;
      INSERT INTO t1 VALUES (1),(2);
       
      CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=Aria;
      INSERT INTO t2 VALUES (8);
       
      SELECT ( SELECT MAX(f2) FROM t1 )
      FROM ( SELECT * FROM t2 ) sq;

      Stack trace from 5.5 commit 86f46a3da4a6d82cb510dc4c270d46cfd6a8965b

      #2  0x00000000007e7ee9 in handle_fatal_signal (sig=11) at 5.5/sql/signal_handler.cc:262
      #3  <signal handler called>
      #4  0x0000000000b8fbca in trnman_can_read_from (trn=0x0, trid=0) at 5.5/storage/maria/trnman.c:582
      #5  0x0000000000b7861c in _ma_row_visible_transactional_table (info=0x7f38f7db7060) at 5.5/storage/maria/ma_state.c:836
      #6  0x0000000000c08f9c in maria_rprev (info=0x7f38f7db7060, buf=0x7f38f7c59978 "\375\b", inx=0) at 5.5/storage/maria/ma_rprev.c:60
      #7  0x0000000000c09236 in maria_rlast (info=0x7f38f7db7060, buf=0x7f38f7c59978 "\375\b", inx=0) at 5.5/storage/maria/ma_rlast.c:25
      #8  0x0000000000b8b1f1 in ha_maria::index_last (this=0x7f38f7c79078, buf=0x7f38f7c59978 "\375\b") at 5.5/storage/maria/ha_maria.cc:2366
      #9  0x00000000006163e0 in handler::ha_index_last (this=0x7f38f7c79078, buf=0x7f38f7c59978 "\375\b") at 5.5/sql/sql_class.h:4290
      #10 0x0000000000908d52 in get_index_max_value (table=0x7f38f7cf0a60, ref=0x7f38f87b3690, range_fl=3) at 5.5/sql/opt_sum.cc:210
      #11 0x0000000000909352 in opt_sum_query (thd=0x7f38f8d50060, tables=..., all_fields=..., conds=0x0) at 5.5/sql/opt_sum.cc:400
      #12 0x00000000006658dc in JOIN::optimize (this=0x7f38f7dbcac8) at 5.5/sql/sql_select.cc:1172
      #13 0x000000000062b2d0 in st_select_lex::optimize_unflattened_subqueries (this=0x7f38f8d53a60, const_only=false) at 5.5/sql/sql_lex.cc:3506
      #14 0x000000000077ada2 in JOIN::optimize_unflattened_subqueries (this=0x7f38f7dbc078) at 5.5/sql/opt_subselect.cc:4944
      #15 0x0000000000667667 in JOIN::optimize (this=0x7f38f7dbc078) at 5.5/sql/sql_select.cc:1665
      #16 0x000000000066c45b in mysql_select (thd=0x7f38f8d50060, rref_pointer_array=0x7f38f8d53cd0, tables=0x7f38f7d6a4b0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f38f7d6ab30, unit=0x7f38f8d53380, select_lex=0x7f38f8d53a60) at 5.5/sql/sql_select.cc:3080
      #17 0x0000000000662fbd in handle_select (thd=0x7f38f8d50060, lex=0x7f38f8d532d0, result=0x7f38f7d6ab30, setup_tables_done_option=0) at 5.5/sql/sql_select.cc:319
      #18 0x000000000063c1fc in execute_sqlcom_select (thd=0x7f38f8d50060, all_tables=0x7f38f7d6a4b0) at 5.5/sql/sql_parse.cc:4689
      #19 0x00000000006353de in mysql_execute_command (thd=0x7f38f8d50060) at 5.5/sql/sql_parse.cc:2234
      #20 0x000000000063ece2 in mysql_parse (thd=0x7f38f8d50060, rawbuf=0x7f38f7e87078 "SELECT ( SELECT MAX(f2) FROM t1 )\nFROM ( SELECT * FROM t2 ) sq", length=62, parser_state=0x7f38f87b5620) at 5.5/sql/sql_parse.cc:5909
      #21 0x0000000000632925 in dispatch_command (command=COM_QUERY, thd=0x7f38f8d50060, packet=0x7f38f8e09061 "SELECT ( SELECT MAX(f2) FROM t1 )\nFROM ( SELECT * FROM t2 ) sq", packet_length=62) at 5.5/sql/sql_parse.cc:1079
      #22 0x0000000000631ab1 in do_command (thd=0x7f38f8d50060) at 5.5/sql/sql_parse.cc:793
      #23 0x0000000000734122 in do_handle_one_connection (thd_arg=0x7f38f8d50060) at 5.5/sql/sql_connect.cc:1266
      #24 0x0000000000733be1 in handle_one_connection (arg=0x7f38f8d50060) at 5.5/sql/sql_connect.cc:1181
      #25 0x0000000000b6c629 in pfs_spawn_thread (arg=0x7f38f8d71fc0) at 5.5/storage/perfschema/pfs.cc:1015
      #26 0x00007f38ff17db50 in start_thread (arg=<optimized out>) at pthread_create.c:304
      #27 0x00007f38fd43370d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: