Bug #39665 Maria: assertion in block format during table scan
Submitted: 26 Sep 2008 12:02 Modified: 8 Jan 2009 11:09
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S3 (Non-critical)
Version:5.1-maria OS:Linux
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[26 Sep 2008 12:02] Guilhem Bichot
Description:
I'm running the testcase of BUG#39210. I patched the code to avoid the deadlock, so the testcase does not deadlock anymore, but it frequently crashes (after running for 30 minutes), after printing some corruption messages:

start of test:
# 11:34:44 Loading Validator GenTest::Validator::ErrorMessageCorruption.

after 12 minutes
# 11:46:49 Query: SELECT COUNT( * ) FROM `E` AS X WHERE X . `varchar_nokey` < '2:21:51' LIMIT 9 failed: 1194 Table 'E' is marked as crashed and should be repaired

after 20 more minutes:
# 12:06:37 Query: UPDATE `B` AS X SET `int_key` = '21:37:30' WHERE X . `datetime_key` < '7:2:12' ORDER BY X . `time_key` LIMIT 1 failed: 2013 Lost connection to MySQL server during query
which is this crash:
#8  0xb7d597bb in __assert_fail () from /lib/libc.so.6
#9  0x0860f0ce in _ma_scan_block_record (info=0x992e4f8, record=0x98193b8 "", record_pos=4, skip_deleted=1 '\001') at ma_blockrec.c:5146
#10 0x085f9578 in maria_scan (info=0x992e4f8, record=0x98193b8 "") at ma_scan.c:54
#11 0x085dbe8e in ha_maria::rnd_next (this=0x99a3c00, buf=0x98193b8 "") at ha_maria.cc:2104
#12 0x0839df03 in rr_sequential (info=0x9a0b950) at records.cc:362
#13 0x082fd572 in join_init_read_record (tab=0x9a0b910) at sql_select.cc:11899
#14 0x082fce30 in sub_select (join=0x9918918, join_tab=0x9a0b910, end_of_records=false) at sql_select.cc:11227
#15 0x082fcc4b in evaluate_join_record (join=0x9918918, join_tab=0x9a0b788, error=0) at sql_select.cc:11343
#16 0x082fce65 in sub_select (join=0x9918918, join_tab=0x9a0b788, end_of_records=false) at sql_select.cc:11234
#17 0x08304d98 in do_select (join=0x9918918, fields=0x9919aac, table=0x0, procedure=0x0) at sql_select.cc:10984
#18 0x0831cc3f in JOIN::exec (this=0x9918918) at sql_select.cc:2201
#19 0x083182b3 in mysql_select (thd=0x9902bd8, rref_pointer_array=0x9904094, tables=0x990e010, wild_num=0, fields=@0x9904020, conds=0x0, og_num=1, order=0x995bbf8, group=0x0, having=0x0, proc_param=0x0,
    select_options=2149337600, result=0x99eeaf8, unit=0x9903d10, select_lex=0x9903f88) at sql_select.cc:2379
#20 0x0831cf36 in handle_select (thd=0x9902bd8, lex=0x9903cb4, result=0x99eeaf8, setup_tables_done_option=0) at sql_select.cc:279
#21 0x08299711 in execute_sqlcom_select (thd=0x9902bd8, all_tables=0x990e010) at sql_parse.cc:4774
#22 0x0829aeef in mysql_execute_command (thd=0x9902bd8) at sql_parse.cc:2072
#23 0x082a3b19 in mysql_parse (thd=0x9902bd8, inBuf=0x98999c8 "SELECT COUNT( * ) FROM `E` AS X LEFT JOIN `DD` AS Y ON ( X . `datetime_nokey` = Y . `datetime_nokey` ) ORDER BY X . `pk`", length=120,
    found_semicolon=0xb223c27c) at sql_parse.cc:5652

assertion corresponds to condition
length < share->base.min_block_length
being unfortunately true.

How to repeat:
Run testcase of BUG#39210. You may need to patch your Maria code to avoid the deadlock. I'm attaching the patch. I *believe* that this patch is not the cause of the crash, it probably just removes the deadlock (which happened after seconds), allowing the test to run enough minutes.
[26 Sep 2008 12:03] Guilhem Bichot
patch to avoid deadlocks in test

Attachment: no_deadlock.patch (text/x-patch), 13.79 KiB.

[26 Sep 2008 21:01] Guilhem Bichot
The testcase of BUG#39210 is grammar file maria_stress.yy; I just got the same assertion with maria_dml_alter.yy.
[13 Oct 2008 15:46] Guilhem Bichot
Monty, please don't look at it now. It may just be due to pagecache_read(PAGECACHE_LOCK_LEFT_UNLOCKED) not waiting for write-locks to be gone, thus full table scan may be reading an inconsistent page, hence the assertion because it finds unexpected content.
Sanja will fix the page cache, so I assign this bug to him for now.
[17 Oct 2008 13:55] Guilhem Bichot
http://lists.mysql.com/maria/239 Fixed by Sanja in 5.1-maria.
[26 Oct 2008 22:20] Bugs System
Pushed into 6.0.8-alpha  (revid:sanja@sun.com-20081016194412-16a5e1kn17c5ndoa) (version source revid:guilhem@mysql.com-20081020191322-i0e65e3k8044kkce) (pib:5)
[8 Jan 2009 11:09] MC Brown
Test case failure. No documentation needed.