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

Assertion `record_length == m_record_length' failed at Filesort_buffer::alloc_sort_buffer

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.0.0
    • 5.5.29
    • None
    • None

    Description

      It might be related to MDEV-3899 – the first SELECT in the test case is nearly identical to the one in MDEV-3899, and it's necessary for the failure which happens on the second query. However, this assertion only fails in 10.0, while the valgrind warnings appear in 5.5 too, so I'm filing it separately, in case it's a different issue.

      mysqld: maria-10.0/sql/filesort_utils.cc:111: uchar** Filesort_buffer::alloc_sort_buffer(uint, uint): Assertion `record_length == m_record_length' failed.
      [ERROR] mysqld got signal 6 ;

      #6  0x00007f6b072dbd4d in __GI___assert_fail (assertion=0xe344a0 "record_length == m_record_length", file=<optimized out>, line=111, function=<optimized out>) at assert.c:81
      #7  0x000000000094d275 in Filesort_buffer::alloc_sort_buffer (this=0x7f6afa789000, num_records=12, record_length=14) at maria-10.0/sql/filesort_utils.cc:111
      #8  0x00000000007c7c72 in Filesort_info::alloc_sort_buffer (this=0x7f6afa789000, num_records=12, record_length=14) at maria-10.0/sql/table.h:334
      #9  0x00000000007c3191 in filesort (thd=0x3d42ce0, table=0x3c09b90, sortorder=0x3c3c0c8, s_length=1, select=0x3c3bbe8, max_rows=18446744073709551615, sort_positions=false, examined_rows=0x7f6afa789510, found_rows=0x7f6afa789518) at maria-10.0/sql/filesort.cc:269
      #10 0x000000000066cfc7 in create_sort_index (thd=0x3d42ce0, join=0x3c362d8, order=0x3c36208, filesort_limit=18446744073709551615, select_limit=18446744073709551615, is_order_by=true) at maria-10.0/sql/sql_select.cc:19153
      #11 0x0000000000645f9d in JOIN::exec_inner (this=0x3c362d8) at maria-10.0/sql/sql_select.cc:2932
      #12 0x000000000064352b in JOIN::exec (this=0x3c362d8) at maria-10.0/sql/sql_select.cc:2253
      #13 0x0000000000646a6c in mysql_select (thd=0x3d42ce0, rref_pointer_array=0x3d46038, tables=0x3c02e80, wild_num=1, fields=..., conds=0x3c04a50, og_num=1, order=0x3c36208, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x3c04ba0, unit=0x3d45700, select_lex=0x3d45dd8) at maria-10.0/sql/sql_select.cc:3190
      #14 0x000000000063d3dc in handle_select (thd=0x3d42ce0, lex=0x3d45650, result=0x3c04ba0, setup_tables_done_option=0) at maria-10.0/sql/sql_select.cc:362
      #15 0x0000000000615ad8 in execute_sqlcom_select (thd=0x3d42ce0, all_tables=0x3c02e80) at maria-10.0/sql/sql_parse.cc:4937
      #16 0x000000000060e14e in mysql_execute_command (thd=0x3d42ce0) at maria-10.0/sql/sql_parse.cc:2421
      #17 0x0000000000618394 in mysql_parse (thd=0x3d42ce0, rawbuf=0x3c02bc8 "SELECT * FROM t2 AS alias1, t2 AS alias2 \nWHERE EXISTS ( SELECT 1 ) AND (alias2.pk = alias1.b ) \nORDER BY alias1.b", length=114, parser_state=0x7f6afa78a4f0) at maria-10.0/sql/sql_parse.cc:6056
      #18 0x000000000060b340 in dispatch_command (command=COM_QUERY, thd=0x3d42ce0, packet=0x3c0cef1 "SELECT * FROM t2 AS alias1, t2 AS alias2 \nWHERE EXISTS ( SELECT 1 ) AND (alias2.pk = alias1.b ) \nORDER BY alias1.b", packet_length=114) at maria-10.0/sql/sql_parse.cc:1216
      #19 0x000000000060a539 in do_command (thd=0x3d42ce0) at maria-10.0/sql/sql_parse.cc:945
      #20 0x000000000070f640 in do_handle_one_connection (thd_arg=0x3d42ce0) at maria-10.0/sql/sql_connect.cc:1254

      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x3c02bc8): SELECT * FROM t2 AS alias1, t2 AS alias2  WHERE EXISTS ( SELECT 1 ) AND (alias2.pk = alias1.b )  ORDER BY alias1.b
      Connection ID (thread ID): 2
      Status: NOT_KILLED

      branch: maria/10.0
      revision-id: knielsen@knielsen-hq.org-20121120132251-fzd2iju4hn8ttxhw
      date: 2012-11-20 14:22:51 +0100
      revno: 3480

      Could not reproduce on maria/5.2, maria/5.3, maria/5.5.
      Reproducible with the default optimizer_switch as well as with all OFF values (except for in_to_exists or materialization one of which is required to run the queries).

      EXPLAIN (with the default optimizer_switch):

      EXPLAIN EXTENDED
      SELECT * FROM t2 AS alias1, t2 AS alias2 
      WHERE EXISTS ( SELECT 1 ) AND (alias2.pk = alias1.b ) 
      ORDER BY alias1.b;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	PRIMARY	alias1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where; Using filesort
      1	PRIMARY	alias2	eq_ref	PRIMARY	PRIMARY	4	test.alias1.b	1	100.00	
      2	SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
      Warnings:
      Note	1003	select `test`.`alias1`.`pk` AS `pk`,`test`.`alias1`.`b` AS `b`,`test`.`alias2`.`pk` AS `pk`,`test`.`alias2`.`b` AS `b` from `test`.`t2` `alias1` join `test`.`t2` `alias2` where ((`test`.`alias2`.`pk` = `test`.`alias1`.`b`) and exists(select 1)) order by `test`.`alias1`.`b`

      Test case:

      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1),(2);
       
      CREATE TABLE t2 (pk INT PRIMARY KEY, b INT) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (1,1),(2,7);
       
      CREATE TABLE t3 (c INT) ENGINE=MyISAM;
      INSERT INTO t3 VALUES (8);
       
      SELECT * FROM t1
      WHERE ( 1, 5 )  IN (
        SELECT b, SUM( DISTINCT b )
        FROM t2, t3
        GROUP BY b
      );
       
      SELECT * FROM t2 AS alias1, t2 AS alias2
      WHERE EXISTS ( SELECT 1 ) AND (alias2.pk = alias1.b )
      ORDER BY alias1.b;

      Attachments

        Issue Links

          Activity

            People

              timour Timour Katchaounov (Inactive)
              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.