Commit afd1bde5 authored by unknown's avatar unknown

Bug #28477 innodb assertion and crash during alter table to add/drop partition.

The bug was repeated on MyISAM tables, so isn't InnoDB specific.
Reason of the bug is that partition-related members of TABLE_SHARE
wasn't properly updated after ALTER command. So if other thread doesn't
reread frm file, and just uses cached SHARE, it uses wrong data


sql/sql_table.cc:
  Bug #28477 innodb assertion and crash during alter table to add/drop partition.
  
  keep share members updated after table modification
sql/table.cc:
  Bug #28477 innodb assertion and crash during alter table to add/drop partition.
  
  share->partition_info_buffer_size initialization added
sql/table.h:
  Bug #28477 innodb assertion and crash during alter table to add/drop partition.
  
  partition_info_buffer_size declared in st_table_share to store
  the size of the memory available for partition_info
parent 6b3d981d
......@@ -1329,6 +1329,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
if (part_info)
{
TABLE_SHARE *share= lpt->table->s;
if (!(part_syntax_buf= generate_partition_syntax(part_info,
&syntax_len,
TRUE, TRUE)))
......@@ -1336,7 +1337,16 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
DBUG_RETURN(TRUE);
}
part_info->part_info_string= part_syntax_buf;
part_info->part_info_len= syntax_len;
share->partition_info_len= part_info->part_info_len= syntax_len;
if (share->partition_info_buffer_size < syntax_len + 1)
{
share->partition_info_buffer_size= syntax_len+1;
if (!(share->partition_info=
alloc_root(&share->mem_root, syntax_len+1)))
DBUG_RETURN(TRUE);
}
memcpy((char*) share->partition_info, part_syntax_buf, syntax_len + 1);
}
}
#endif
......
......@@ -720,7 +720,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
uint32 partition_info_len = uint4korr(next_chunk);
#ifdef WITH_PARTITION_STORAGE_ENGINE
if ((share->partition_info_len= partition_info_len))
if ((share->partition_info_buffer_size=
share->partition_info_len= partition_info_len))
{
if (!(share->partition_info=
memdup_root(&share->mem_root, next_chunk + 4,
......
......@@ -243,6 +243,7 @@ typedef struct st_table_share
bool auto_partitioned;
const char *partition_info;
uint partition_info_len;
uint partition_info_buffer_size;
const char *part_state;
uint part_state_len;
handlerton *default_part_db_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment