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

Assertion `empty_size == empty_size_on_page' failure in ma_blockrec.c or ER_NOT_KEYFILE on query with DISTINCT and GROUP BY

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.1, 5.5.30, 5.1.67, 5.2.14, 5.3.12
    • 10.0.3, 5.5.31, 5.1.73, 5.2.15, 5.3.13
    • None
    • None

    Description

      CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
      INSERT t1 VALUES (3,2004),(2,2006),(1,2007),(3,2008),(2,2005),(2,2001);
      SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;

      mysqld: ma_blockrec.c:701: check_directory: Assertion `empty_size == empty_size_on_page' failed.
      mysqld got signal 6 ;

      #7  0x00007f5cfcba5192 in __GI___assert_fail (assertion=0xd8b680 "empty_size == empty_size_on_page", file=0xd8b5b6 "ma_blockrec.c", line=701, function=0xd8d720 "check_directory") at assert.c:103
      #8  0x00000000009ea8da in check_directory (buff=0x7f5cf054d038 "", block_size=8192, min_row_length=0, real_empty_size=73376) at ma_blockrec.c:701
      #9  0x00000000009f3349 in delete_dir_entry (buff=0x7f5cf054d038 "", block_size=8192, record_number=3, empty_space_res=0x7f5cefd4943c) at ma_blockrec.c:4099
      #10 0x00000000009f3557 in delete_head_or_tail (info=0x7f5ce003a438, page=1, record_number=3, head=1 '\001', from_update=0 '\000') at ma_blockrec.c:4161
      #11 0x00000000009f3a8c in _ma_delete_block_record (info=0x7f5ce003a438, record=0x7f5ce001b248 "\376\376\326\a") at ma_blockrec.c:4280
      #12 0x0000000000961d41 in maria_delete (info=0x7f5ce003a438, record=0x7f5ce001b248 "\376\376\326\a") at ma_delete.c:109
      #13 0x000000000094025b in ha_maria::delete_row (this=0x7f5ce001b0b8, buf=0x7f5ce001b248 "\376\376\326\a") at ha_maria.cc:2125
      #14 0x00000000007ce044 in handler::ha_delete_row (this=0x7f5ce001b0b8, buf=0x7f5ce001b248 "\376\376\326\a") at handler.cc:4829
      #15 0x000000000071eb81 in remove_dup_with_compare (thd=0x3a98c98, table=0x7f5ce0032d60, first_field=0x7f5ce00339d0, offset=6, having=0x0) at sql_select.cc:14645
      #16 0x000000000071e897 in remove_duplicates (join=0x7f5ce0030d70, entry=0x7f5ce0032d60, fields=..., having=0x0) at sql_select.cc:14575
      #17 0x00000000006feafa in JOIN::exec (this=0x7f5ce0030d70) at sql_select.cc:2158
      #18 0x00000000006fffe7 in mysql_select (thd=0x3a98c98, rref_pointer_array=0x3a9b030, tables=0x7f5ce001cd60, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f5ce001d1a0, having=0x0, proc_param=0x0, select_options=2147764737, result=0x7f5ce001d270, unit=0x3a9aa30, select_lex=0x3a9ae58) at sql_select.cc:2576
      #19 0x00000000006f7e69 in handle_select (thd=0x3a98c98, lex=0x3a9a990, result=0x7f5ce001d270, setup_tables_done_option=0) at sql_select.cc:280
      #20 0x0000000000695116 in execute_sqlcom_select (thd=0x3a98c98, all_tables=0x7f5ce001cd60) at sql_parse.cc:5247
      #21 0x000000000068bf90 in mysql_execute_command (thd=0x3a98c98) at sql_parse.cc:2386
      #22 0x00000000006978f9 in mysql_parse (thd=0x3a98c98, rawbuf=0x7f5ce001c690 "SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b", length=50, found_semicolon=0x7f5cefd4a900) at sql_parse.cc:6222
      #23 0x0000000000689729 in dispatch_command (command=COM_QUERY, thd=0x3a98c98, packet=0x3b05969 "SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b", packet_length=50) at sql_parse.cc:1294
      #24 0x0000000000688624 in do_command (thd=0x3a98c98) at sql_parse.cc:906
      #25 0x00000000006855bb in handle_one_connection (arg=0x3a98c98) at sql_connect.cc:1238
      #26 0x00007f5cfcf3ce9a in start_thread (arg=0x7f5cefd4b700) at pthread_create.c:308
      #27 0x00007f5cfcc69cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      revision-id: holyfoot@askmonty.org-20130310190805-3jncxhq14nr7vw66
      revno: 3188
      branch-nick: 5.1

      Built with BUILD/compile-pentium-debug-max-no-ndb

      Also reproducible on current 5.2, 5.3, 5.5, 10.0 trees.

      With a slightly different dataset, there is no assertion failure, but ER_NOT_KEYFILE is produced instead:

      CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
      INSERT t1 VALUES (3,1),(2,2),(1,3),(3,4),(2,5),(2,6);
      SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;

      Result:

      MariaDB [test]> SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;
      ERROR 1034 (HY000): Incorrect key file for table '/home/elenst/bzr/5.1/data/tmp/#sql_1245_0'; try to repair it

      Yet another test case, now without GROUP_CONCAT:

      CREATE TABLE t1 (a INT, b VARCHAR(1)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (7,'q'),(2,NULL),(7,'g'),(6,'x');
      SELECT DISTINCT MAX( a ) FROM t1 GROUP BY b ORDER BY DES_DECRYPT( b ); 

      Result:

      query 'SELECT DISTINCT MAX( a ) FROM t1 GROUP BY b ORDER BY DES_DECRYPT( b )' failed: 1034: Incorrect key file for table '5.3/mysql-test/var/tmp/mysqld.1/#sql_5791_0'; try to repair it

      Attachments

        Activity

          People

            monty Michael Widenius
            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.