Skip to content

Commit

Permalink
Fix alter table with fulltext index which refer to table causes mysql…
Browse files Browse the repository at this point in the history
…d crash

refs #2327

[groonga-dev,02130]

Reported by Naoya Murakami. Thanks!
  • Loading branch information
mmmaru777 committed Feb 20, 2014
1 parent 27a5084 commit ef94a3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ha_mroonga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13190,6 +13190,8 @@ bool ha_mroonga::storage_inplace_alter_table(
TABLE_SHARE tmp_table_share;
char **key_parser;
uint *key_parser_length;
char **index_table;
uint *index_table_length;
KEY *p_key_info = &table->key_info[table_share->primary_key];
bool have_multiple_column_index = false;
memset(index_tables, 0, sizeof(grn_obj *) * ha_alter_info->key_count);
Expand All @@ -13199,6 +13201,8 @@ bool ha_mroonga::storage_inplace_alter_table(
if (!(tmp_share = (MRN_SHARE *)
my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&tmp_share, sizeof(*tmp_share),
&index_table, sizeof(char *) *(tmp_table_share.keys),
&index_table_length, sizeof(uint) *(tmp_table_share.keys),
&key_parser, sizeof(char *) * (tmp_table_share.keys),
&key_parser_length, sizeof(uint) * (tmp_table_share.keys),
NullS))
Expand All @@ -13209,8 +13213,8 @@ bool ha_mroonga::storage_inplace_alter_table(
}
tmp_share->engine = NULL;
tmp_share->table_share = &tmp_table_share;
tmp_share->index_table = NULL;
tmp_share->index_table_length = NULL;
tmp_share->index_table = index_table;
tmp_share->index_table_length = index_table_length;
tmp_share->key_parser = key_parser;
tmp_share->key_parser_length = key_parser_length;
bitmap_clear_all(table->read_set);
Expand Down
2 changes: 1 addition & 1 deletion mrn_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length,
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
DBUG_PRINT("info", ("mroonga "title_name" start")); \
if (!share->param_name[param_pos]) \
if (share->param_name && !share->param_name[param_pos]) \
{ \
if ((share->param_name[param_pos] = mrn_get_string_between_quote( \
start_ptr))) \
Expand Down

0 comments on commit ef94a3c

Please sign in to comment.