Bug #12186 | NULL VARCHAR UCS2 column in InnoDB table crashes the server | ||
---|---|---|---|
Submitted: | 26 Jul 2005 19:52 | Modified: | 28 Jul 2005 11:32 |
Reporter: | Hakan Küçükyılmaz | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S1 (Critical) |
Version: | 5.0.11 | OS: | Linux (Linux) |
Assigned to: | Marko Mäkelä | CPU Architecture: | Any |
[26 Jul 2005 19:52]
Hakan Küçükyılmaz
[26 Jul 2005 20:24]
Kolbe Kegel
Simplified test case: CREATE TABLE TMP_OSQLJVER1 ( FVC8 VARCHAR(8) default NULL ) ENGINE=InnoDB DEFAULT CHARSET=ucs2; INSERT INTO TMP_OSQLJVER1 VALUES (); SELECT * FROM TMP_OSQLJVER1; Also, ALTER TABLE on this table will crash the server: ALTER TABLE TMP_OSQLJVER1 MODIFY FVC8 CHAR(8); ALTER TABLE TMP_OSQLJVER1 ADD i INT; Notes: * Behavior does not occur with utf8 character set * Behavior only occurs with VARCHAR columns (not CHAR, TEXT, or VARBINARY columns) * Behavior also occurs on Windows * Behavior is NOT present in MyISAM storage engine * Behavior is present in MySQL 5.0.9 * Behavior is NOT present in MySQL 4.1.13
[27 Jul 2005 8:04]
Hakan Küçükyılmaz
lmy001:~ # resolve_stack_dump -s /tmp/mysqld.sym -n /tmp/mysqld.stack | c++filt 0x8154c78 handle_segfault + 272 0x4005a96c _end + 934076172 0x829b0cf row_sel_store_mysql_rec + 1063 0x829d7ce row_search_for_mysql + 7950 0x820ae44 ha_innobase::index_read(char*, char const*, unsigned int, ha_rkey_function) + 286 0x820b268 ha_innobase::index_next_same(char*, char const*, unsigned int) + 10 0x820b3c2 ha_innobase::rnd_init(bool) + 20 0x81fa559 rr_sequential(st_read_record*) + 13 0x81ac4d1 test_if_quick_select(st_join_table*) + 45 0x81ab48d sub_select(JOIN*, st_join_table*, bool) + 65 0x81ab024 do_select(JOIN*, List<Item>*, st_table*, Procedure*) + 488 0x819caf2 JOIN::exec() + 5608 0x819d706 _Z12mysql_selectP3THDPPP4ItemP13st_table_listjR4ListIS1_ES2_jP8st_orderSB_S2_SB_mP13select_resultP18st_select_lex_unitP13st_sel + 300 0x81990d2 handle_select(THD*, st_lex*, select_result*, unsigned long) + 58 0x8169547 mysql_execute_command(THD*) + 1501 0x8170640 mysql_parse(THD*, char*, unsigned int) + 148 0x8167d0a dispatch_command(enum_server_command, THD*, char*, unsigned int) + 1376 0x8167714 do_command(THD*) + 314 0x8166a58 handle_one_connection + 590 0x40054f60 _end + 934053120 0x401e7327 _end + 935700679
[27 Jul 2005 11:41]
Marko Mäkelä
This bug was introduced in MySQL 5.0.3 with true VARCHAR columns. When padding a NULL true VARCHAR column with blanks, InnoDB does not set the field length bytes. I don't know if the padding is needed any more. I would tend to believe that NULL true VARCHAR columns could just be set to length zero, but this should be tested. See Bug #154.
[27 Jul 2005 13:23]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/27639
[28 Jul 2005 10:48]
Marko Mäkelä
I made a simpler and more correct patch, which is available at the following location: http://lists.mysql.com/internals/27673
[28 Jul 2005 11:10]
Heikki Tuuri
Marko, please update this comment: /* MySQL pads all non-BLOB and non-TEXT string types with space ' ' */ Does this patch also fix Bug #8552? Regards, Heikki
[28 Jul 2005 11:21]
Marko Mäkelä
Heikki, I fixed that comment in <http://lists.mysql.com/internals/27674>. Bug #8552 is still alive and kicking: checksum table TMP_OSQLJVER1; -- 2286516652 alter table TMP_OSQLJVER1 row_format=redundant; checksum table TMP_OSQLJVER1; -- 4133951980 alter table TMP_OSQLJVER1 row_format=default; checksum table TMP_OSQLJVER1; -- 4133951980 alter table TMP_OSQLJVER1 row_format=fixed; checksum table TMP_OSQLJVER1; -- 4133951980 alter table TMP_OSQLJVER1 row_format=compact; checksum table TMP_OSQLJVER1; -- 4133951980 alter table TMP_OSQLJVER1 row_format=default engine=myisam; checksum table TMP_OSQLJVER1; -- 425803963 alter table TMP_OSQLJVER1 row_format=fixed engine=myisam; checksum table TMP_OSQLJVER1; -- 4133951980 checksum table TMP_OSQLJVER1; -- 4133951980
[28 Jul 2005 11:32]
Marko Mäkelä
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html Additional info: The fix should be included in the 5.0.11 release.