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

Assertion `length <= column->length' fails in write_block_record with functions in select list, GROUP BY, ORDER BY



    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.3.12, 5.5.34, 10.0.6
    • 5.5.35, 10.0.8
    • None
    • None


      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(2);
      SELECT VAR_POP('foo') FROM t1 GROUP BY VALUES(a), ExtractValue('bar','qux') ORDER BY VERSION();

      If the server is built as usual, with Aria temporary tables, the test case above causes an assertion failure:

      mysqld: ma_blockrec.c:2772: write_block_record: Assertion `length <= column->length' failed.
      131217 21:21:02 [ERROR] mysqld got signal 6 ;

      #6  0x00007fc352d06621 in *__GI___assert_fail (assertion=0xdd9212 "length <= column->length", file=<optimized out>, line=2772, function=0xdda7a0 "write_block_record") at assert.c:81
      #7  0x0000000000a599f1 in write_block_record (info=0x20513b8, old_record=0x0, record=0x2049b50 "\376", row=0x2051410, bitmap_blocks=0x2051410, head_block_is_read=0 '\000', row_pos=0x7fc34a222140, undo_lsn=1, old_record_checksum=0) at ma_blockrec.c:2772
      #8  0x0000000000a5ba8d in allocate_and_write_block_record (info=0x20513b8, record=0x2049b50 "\376", row=0x2051410, undo_lsn=1) at ma_blockrec.c:3534
      #9  0x0000000000a5bba1 in _ma_write_init_block_record (info=0x20513b8, record=0x2049b50 "\376") at ma_blockrec.c:3574
      #10 0x0000000000a45731 in maria_write (info=0x20513b8, record=0x2049b50 "\376") at ma_write.c:157
      #11 0x00000000009a82e7 in ha_maria::write_row (this=0x2049450, buf=0x2049b50 "\376") at ha_maria.cc:1171
      #12 0x00000000005d0a6d in handler::ha_write_tmp_row (this=0x2049450, buf=0x2049b50 "\376") at sql_class.h:3823
      #13 0x0000000000753d2e in end_update (join=0x201a798, join_tab=0x20464c8, end_of_records=false) at sql_select.cc:17641
      #14 0x0000000000750add in evaluate_join_record (join=0x201a798, join_tab=0x20461a8, error=0) at sql_select.cc:16469
      #15 0x00000000007502c4 in sub_select (join=0x201a798, join_tab=0x20461a8, end_of_records=false) at sql_select.cc:16271
      #16 0x000000000074f9c5 in do_select (join=0x201a798, fields=0x0, table=0x2047d90, procedure=0x0) at sql_select.cc:15924
      #17 0x000000000072d122 in JOIN::exec (this=0x201a798) at sql_select.cc:2335
      #18 0x000000000072f66d in mysql_select (thd=0x1f95bc8, rref_pointer_array=0x1f988b8, tables=0x2019ca0, wild_num=0, fields=..., conds=0x0, og_num=3, order=0x201a6a0, group=0x201a2c0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x201a778, unit=0x1f98158, select_lex=0x1f98660) at sql_select.cc:3009
      #19 0x00000000007260cd in handle_select (thd=0x1f95bc8, lex=0x1f980b8, result=0x201a778, setup_tables_done_option=0) at sql_select.cc:288
      #20 0x00000000006b4db4 in execute_sqlcom_select (thd=0x1f95bc8, all_tables=0x2019ca0) at sql_parse.cc:5172
      #21 0x00000000006abf50 in mysql_execute_command (thd=0x1f95bc8) at sql_parse.cc:2305
      #22 0x00000000006b771b in mysql_parse (thd=0x1f95bc8, rawbuf=0x2019900 "SELECT VAR_POP('foo') FROM t1 GROUP BY VALUES(a), ExtractValue('bar','qux') ORDER BY VERSION()", length=94, found_semicolon=0x7fc34a223cb8) at sql_parse.cc:6173
      #23 0x00000000006a9730 in dispatch_command (command=COM_QUERY, thd=0x1f95bc8, packet=0x2010499 "SELECT VAR_POP('foo') FROM t1 GROUP BY VALUES(a), ExtractValue('bar','qux') ORDER BY VERSION()", packet_length=94) at sql_parse.cc:1243
      #24 0x00000000006a8a1c in do_command (thd=0x1f95bc8) at sql_parse.cc:923
      #25 0x00000000006a58a5 in handle_one_connection (arg=0x1f95bc8) at sql_connect.cc:1231
      #26 0x00007fc353a12b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
      #27 0x00007fc352db5a7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      Stack trace from

      revision-id: igor@askmonty.org-20131212215533-9n040xfc9onhho5o
      revno: 3736
      branch-nick: 5.3

      If the server is built without Aria temporary tables, there is no assertion failure, but the result is still strange:

      query 'SELECT VAR_POP('foo') FROM t1 GROUP BY VALUES(a), ExtractValue('bar','qux') ORDER BY VERSION()' failed: 1062: Duplicate entry 'NULL' for key 'group_key'




            serg Sergei Golubchik
            elenst Elena Stepanova
            0 Vote for this issue
            3 Start watching this issue



              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.