Bug #42509 Maria write_block_record: Assertion `data_length < ((block_size) * 3 / 4)'
Submitted: 1 Feb 2009 9:20 Modified: 26 May 2010 17:51
Reporter: Philip Stoev Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S2 (Serious)
Version:6.0-maria OS:Any
Assigned to: CPU Architecture:Any

[1 Feb 2009 9:20] Philip Stoev
Description:
When executing INSERTs against a complex table containing partitions and many indexes, Maria asserted as follows:

mysqld: ma_blockrec.c:2864: write_block_record: Assertion `data_length < ((block_size) *3 / 4)' failed.

#6  0x000000315a42bec9 in __assert_fail () from /lib64/libc.so.6
#7  0x0000000000bb175c in write_block_record (info=0x318fa98, old_record=0x0, record=0x30f85f0 "", row=0x318faf0, bitmap_blocks=0x318faf0,
    head_block_is_read=0 '\0', row_pos=0x7f4df25a8f40, undo_lsn=1, old_record_checksum=0) at ma_blockrec.c:2864
#8  0x0000000000bb2e89 in allocate_and_write_block_record (info=0x318fa98, record=0x30f85f0 "", row=0x318faf0, undo_lsn=1) at ma_blockrec.c:3396
#9  0x0000000000bb3004 in _ma_write_init_block_record (info=0x318fa98, record=0x30f85f0 "") at ma_blockrec.c:3439
#10 0x0000000000bc1dcb in maria_write (info=0x318fa98, record=0x30f85f0 "") at ma_write.c:151
#11 0x0000000000b7a16c in ha_maria::write_row (this=0x30f43c0, buf=0x30f85f0 "") at ha_maria.cc:923
#12 0x000000000080c567 in handler::ha_write_row (this=0x30f43c0, buf=0x30f85f0 "") at handler.cc:5438
#13 0x000000000081abbb in ha_partition::write_row (this=0x30e5d90, buf=0x30f85f0 "") at ha_partition.cc:2981
#14 0x000000000080c567 in handler::ha_write_row (this=0x30e5d90, buf=0x30f85f0 "") at handler.cc:5438
#15 0x0000000000774d52 in write_record (thd=0x7f4e00eb35e8, table=0x30f3ad8, info=0x7f4df25a94f0) at sql_insert.cc:1609
#16 0x0000000000779239 in mysql_insert (thd=0x7f4e00eb35e8, table_list=0x3016bd8, fields=@0x7f4e00eb5b08, values_list=@0x7f4e00eb5b50,
    update_fields=@0x7f4e00eb5b38, update_values=@0x7f4e00eb5b20, duplic=DUP_ERROR, ignore=true) at sql_insert.cc:835
#17 0x00000000006d488b in mysql_execute_command (thd=0x7f4e00eb35e8) at sql_parse.cc:3113
#18 0x00000000006d9f57 in mysql_parse (thd=0x7f4e00eb35e8,
    inBuf=0x3067650 "INSERT IGNORE INTO table10_maria_key_pk_parts_2_int_autoinc VALUES  ('good', 'p', 'b', 'c', 'v', 'd,v,e,r,j,p,p,m', 'i', 'n', 'q,d,i,b,c,j,i', 'g', 'tell', 'h', 'a,k,f,i,n,t,b', 'e', 'it\\'s', 'if', 'v"..., length=24431, found_semicolon=0x7f4df25aaf00) at sql_parse.cc:5735
#19 0x00000000006dab42 in dispatch_command (command=COM_QUERY, thd=0x7f4e00eb35e8,
    packet=0x3028ee9 "INSERT IGNORE INTO table10_maria_key_pk_parts_2_int_autoinc VALUES  ('good', 'p', 'b', 'c', 'v', 'd,v,e,r,j,p,p,m', 'i', 'n', 'q,d,i,b,c,j,i', 'g', 'tell', 'h', 'a,k,f,i,n,t,b', 'e', 'it\\'s', 'if', 'v"..., packet_length=24432) at sql_parse.cc:1007
#20 0x00000000006dc06b in do_command (thd=0x7f4e00eb35e8) at sql_parse.cc:690
#21 0x00000000006ca181 in handle_one_connection (arg=0x7f4e00eb35e8) at sql_connect.cc:1145
#22 0x000000315b0073da in start_thread () from /lib64/libpthread.so.0
#23 0x000000315a4e627d in clone () from /lib64/libc.so.6

2859            if ((cur_block >= end_block))
2860              goto crashed;
2861    #endif
2862            if (cur_block->used & BLOCKUSED_TAIL)
2863            {
2864              DBUG_ASSERT(data_length < MAX_TAIL_SIZE(block_size)); <<<< 
2865              /* tail written to full tail page */
2866              cur_block->used|= BLOCKUSED_USED;
2867              head_tail_block= cur_block;
2868            }

(gdb) print data_length
$1 = 6375
(gdb) print block_size
$2 = 8192

How to repeat:
A test case will be uploaded shortly.

Suggested fix:
Use a tool such as mysqlslap in order to probe extreme use cases.
[1 Feb 2009 9:23] Philip Stoev
Test case for bug 42509

Attachment: bug42509.test (application/octet-stream, text), 69.23 KiB.

[1 Feb 2009 9:24] Philip Stoev
A test case has been uploaded. It appears that at least two tables, partitioning, and many indexes are required to trigger the bug.
[12 Mar 2009 13:28] Guilhem Bichot
still happens