Bug #41493 Maria: two recovery failures (wrong logging of BLOB pages)
Submitted: 16 Dec 2008 9:49 Modified: 7 May 2009 8:29
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, 6.0-maria OS:Linux
Assigned to: Guilhem Bichot CPU Architecture:Any

[16 Dec 2008 9:49] Guilhem Bichot
Description:
First problem, 5.1-maria:
# 06:52:03 081216  6:52:03 [Note] mysqld: Maria engine: starting recovery
# 06:52:03 recovered pages: 0% 19% 29% 42% 58% 75% 93%mysqld: ma_blockrec.c:6242: _ma_apply_redo_purge_row_head_or_tail: Assertion `(buff[7] & 7) == (uchar) page_type' failed.

Second problem: 6.0-maria:
# 21:52:48 081215 21:52:48 [Note] mysqld: Maria engine: starting recovery
# 21:52:48 recovered pages: 0% 15% 25% 37% 50% 61% 71% 81% 91%
# 21:52:48 Got error 127 when executing record redo_insert_row_head

How to repeat:
see pushbuild2; test maria_mostly_selects
[18 Dec 2008 15:55] Guilhem Bichot
Worked on first crash, found something mysterious in log, sent question to Monty.
[19 Dec 2008 10:36] Guilhem Bichot
Second failure has same ingredients.
[13 Jan 2009 13:17] Guilhem Bichot
Here's a small repeatable testcase:
use test;
CREATE TABLE `t1` (
`blob` blob,
`blob_key` blob
) ENGINE=maria ROW_FORMAT=page
;

INSERT INTO `t1` VALUES (NULL,repeat('A',5198));
INSERT INTO `t1` VALUES (NULL,repeat('B',65535));
INSERT INTO `t1` VALUES (repeat('K',5198),repeat('L',2325));
INSERT INTO `t1` VALUES (repeat('C',65535),NULL);
INSERT INTO `t1` VALUES (NULL,repeat('D',65535));
INSERT INTO `t1` VALUES (repeat('E',65535),repeat('F',16111));
INSERT INTO `t1` VALUES (repeat('G',65535),repeat('H',65535));

check table t1 extended;

INSERT INTO `t1` VALUES (repeat('I',5198),repeat('J',65535));

check table t1 extended;

When I run this, the table is not corrupted; then I do:
cd var/master-data/
rm -ff test/t1.*
/m/bzrrepos/mysql-maria/storage/maria/maria_read_log -a
/m/bzrrepos/mysql-maria/storage/maria/maria_chk -e test/t1
Checking MARIA file: test/t1
Data records:       8   Deleted blocks:       0
- check file-size
- check key delete-chain
- check index reference
- check records and index references
maria_chk: error: Page         1:  Row   6 is crashed

And I see that sequence in the output of maria_read_log (due to the last INSERT):
   Rec#0 LSN (1,0x69700) short_trid 45404 redo_new_row_tail(num_type:4) len 5206
   For table of short id 32, './test/t1' page 55, applying record
   Rec#0 LSN (1,0x6ab68) short_trid 45404 redo_insert_row_tail(num_type:2) len 103
   For table of short id 32, './test/t1' page 10, applying record
   Rec#0 LSN (1,0x6abd5) short_trid 45404 redo_insert_row_head(num_type:1) len 44
   For table of short id 32, './test/t1' page 1, applying record
   Rec#0 LSN (1,0x6ac07) short_trid 45404 redo_insert_row_blobs(num_type:5) len 65457
   For table of short id 32, './test/t1', applying record
where the redo_insert_row_blobs starts from page 55 (which is a tail page!?!).
Next is investigating why such record was logged.
[13 Jan 2009 15:08] Guilhem Bichot
In the testcase above, for the last INSERT, at runtime the REDO_INSERT_ROW_BLOBS has a page range [55,62] (8 pages) though the pagecache_*() calls of write_full_pages() rather cover [56,63].
[15 Jan 2009 15:19] Guilhem Bichot
http://lists.mysql.com/maria/394
[15 Jan 2009 17:41] Guilhem Bichot
queued to 5.1-maria
[17 Feb 2009 11:47] Bugs System
Pushed into 6.0.10-alpha (revid:serg@mysql.com-20090217113558-vpsqsyjule7nz0gk) (version source revid:guilhem@mysql.com-20090213163054-rsg204z5qzcekbfe) (merge vers: 6.0.10-alpha) (pib:6)
[7 May 2009 8:29] MC Brown
A note has been added to the 6.0.10 changelog: 

Recovery of Maria tables with BLOB columns could fail to complete correctly.