Assertion `page->size <= share->max_index_block_size' failed at ma_page.c:196: _ma_write_keypage on column charset modification

Bug #905716 reported by Elena Stepanova
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
Medium
Michael Widenius

Bug Description

#8 0x4023f014 in __assert_fail () from /lib/libc.so.6
#9 0x0863a81c in _ma_write_keypage (page=0x4894c2f4,
    lock=PAGECACHE_LOCK_LEFT_WRITELOCKED, level=3) at ma_page.c:196
#10 0x08601fea in w_search (info=0x94c23e0, comp_flag=131076, key=0x4894ce7c,
    page_pos=8192, father_page=0x0, father_keypos=0x0, insert_last=0 '\000')
    at ma_write.c:730
#11 0x086015ea in _ma_ck_real_write_btree (info=0x94c23e0, key=0x4894ce7c,
    root=0x4894cd88, comp_flag=131076) at ma_write.c:524
#12 0x0860147b in _ma_ck_write_btree_with_log (info=0x94c23e0, key=0x4894ce7c,
    root=0x94d5d80, comp_flag=131076) at ma_write.c:491
#13 0x086012eb in _ma_ck_write_btree (info=0x94c23e0, key=0x4894ce7c)
    at ma_write.c:451
#14 0x0860125a in _ma_ck_write (info=0x94c23e0, key=0x4894ce7c)
    at ma_write.c:436
#15 0x08600b85 in maria_write (info=0x94c23e0, record=0x94bc600 "\376@\006")
    at ma_write.c:189
#16 0x08595998 in ha_maria::write_row (this=0x9478f50,
    buf=0x94bc600 "\376@\006") at ha_maria.cc:1135
#17 0x08438821 in handler::ha_write_row (this=0x9478f50,
    buf=0x94bc600 "\376@\006") at handler.cc:4918
#18 0x0846281c in copy_data_between_tables (thd=0x93eaa98, from=0x94796b0,
    to=0x94baf98, create=..., ignore=false, order_num=0, order=0x0,
    copied=0x4894e678, deleted=0x4894e670, keys_onoff=LEAVE_AS_IS,
    error_if_not_empty=false) at sql_table.cc:8110
#19 0x08460d5d in mysql_alter_table (thd=0x93eaa98, new_db=0x9459f18 "test",
    new_name=0x9459cb0 "t1", create_info=0x4894eab4, table_list=0x9459cd8,
    alter_info=0x4894eb4c, order_num=0, order=0x0, ignore=false,
    require_online=false) at sql_table.cc:7534
#20 0x082e4e7f in mysql_execute_command (thd=0x93eaa98) at sql_parse.cc:2965
#21 0x082ee463 in mysql_parse (thd=0x93eaa98,
    rawbuf=0x9459bf8 "ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`",
    length=51, found_semicolon=0x4894f234) at sql_parse.cc:6149
#22 0x082e0e66 in dispatch_command (command=COM_QUERY, thd=0x93eaa98,
    packet=0x94443b9 "ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`",
    packet_length=51) at sql_parse.cc:1227
#23 0x082e0310 in do_command (thd=0x93eaa98) at sql_parse.cc:922
#24 0x082dd2d5 in handle_one_connection (arg=0x93eaa98) at sql_connect.cc:1193
#25 0x400c2b25 in start_thread () from /lib/libpthread.so.0
#26 0x402ee34e in clone () from /lib/libc.so.6

bzr version-info
revision-id: <email address hidden>
date: 2011-12-16 08:05:14 -0800
build-date: 2011-12-17 19:44:33 +0400
revno: 3358
branch-nick: maria-5.3

Also reproducible on 5.1.60, 5.2.10, 5.3.2 release versions.

So far I could only get it while modifying charset to ucs2.

Test case:

CREATE TABLE t1 ( a VARCHAR(800),KEY(a) )
  ENGINE=Aria DEFAULT CHARACTER SET latin1;

INSERT INTO t1 VALUES
  (REPEAT('abc ',200)), (REPEAT('def ',200)),
  (REPEAT('ghi ',200)), (REPEAT('jkl ',200));
INSERT INTO t1 SELECT * FROM t1;

# check table is not needed to reproduce the problem,
# but shows that by this time the table appears to be okay.
CHECK TABLE t1;
ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`;

Revision history for this message
Elena Stepanova (elenst) wrote :

On Windows (release build, don't have Windows debug at hand) it does not crash, but ALTER fails with "1034: Incorrect key file for table '#sql-1b00_1'; try to repair it", even although before that the table looked okay:

CREATE TABLE t1 ( a VARCHAR(800),KEY(a) )
ENGINE=Aria DEFAULT CHARACTER SET latin1;
INSERT INTO t1 VALUES
(REPEAT('abc ',200)), (REPEAT('def ',200)),
(REPEAT('ghi ',200)), (REPEAT('jkl ',200));
INSERT INTO t1 SELECT * FROM t1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`;
main.test [ fail ]
        Test ended at 2011-12-18 01:13:56

CURRENT_TEST: main.test
mysqltest: At line 10: query 'ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2
`' failed: 1034: Incorrect key file for table '#sql-1b00_1'; try to repair it

Warnings from just before the error:
Warning 1071 Specified key was too long; max key length is 1208 bytes
Warning 1071 Specified key was too long; max key length is 1208 bytes

On Linux x86_64, it sometimes crashes/asserts, sometimes throws the error.
On Linux 32-bit, it always crashed for me, although possibly it's not 100% probability either.

description: updated
Michael Widenius (monty)
Changed in maria:
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Michael Widenius (monty) wrote :

Bug was that Aria allowed a too long key to be created (compared to the length of the internal buffers).
This is now fixed by limit the max key length to 1000 (as with MyISAM)

Changed in maria:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.