Commit ababd6a9 authored by Aleksey Midenkov's avatar Aleksey Midenkov

SQL: destroy Vers_min_max_stats [#346]

parent 941e8b7b
...@@ -962,8 +962,9 @@ bool partition_info::vers_setup_expression(THD * thd, uint32 alter_add) ...@@ -962,8 +962,9 @@ bool partition_info::vers_setup_expression(THD * thd, uint32 alter_add)
DBUG_ASSERT(partitions.elements > alter_add + 1); DBUG_ASSERT(partitions.elements > alter_add + 1);
Vers_min_max_stats** old_array= table->s->stat_trx; Vers_min_max_stats** old_array= table->s->stat_trx;
table->s->stat_trx= static_cast<Vers_min_max_stats**>( table->s->stat_trx= static_cast<Vers_min_max_stats**>(
alloc_root(&table->s->mem_root, sizeof(void *) * partitions.elements * num_columns)); alloc_root(&table->s->mem_root, sizeof(void *) * (partitions.elements * num_columns + 1)));
memcpy(table->s->stat_trx, old_array, sizeof(void *) * (partitions.elements - alter_add) * num_columns); memcpy(table->s->stat_trx, old_array, sizeof(void *) * (partitions.elements - alter_add) * num_columns);
table->s->stat_trx[partitions.elements * num_columns]= NULL;
} }
else else
{ {
...@@ -1185,7 +1186,8 @@ bool partition_info::vers_setup_stats(THD * thd, bool is_create_table_ind) ...@@ -1185,7 +1186,8 @@ bool partition_info::vers_setup_stats(THD * thd, bool is_create_table_ind)
{ {
DBUG_ASSERT(partitions.elements > 1); DBUG_ASSERT(partitions.elements > 1);
table->s->stat_trx= static_cast<Vers_min_max_stats**>( table->s->stat_trx= static_cast<Vers_min_max_stats**>(
alloc_root(&table->s->mem_root, sizeof(void *) * partitions.elements * num_columns)); alloc_root(&table->s->mem_root, sizeof(void *) * (partitions.elements * num_columns + 1)));
table->s->stat_trx[partitions.elements * num_columns]= NULL;
dont_stat= false; dont_stat= false;
} }
......
...@@ -8478,6 +8478,20 @@ LEX_CSTRING *fk_option_name(enum_fk_option opt) ...@@ -8478,6 +8478,20 @@ LEX_CSTRING *fk_option_name(enum_fk_option opt)
return names + opt; return names + opt;
} }
void TABLE_SHARE::vers_destroy()
{
mysql_mutex_destroy(&LOCK_rotation);
mysql_cond_destroy(&COND_rotation);
mysql_rwlock_destroy(&LOCK_stat_serial);
if (stat_trx)
{
for (Vers_min_max_stats** p= stat_trx; *p; ++p)
{
delete *p;
}
}
}
TR_table::TR_table(THD* _thd, bool rw) : TR_table::TR_table(THD* _thd, bool rw) :
thd(_thd), open_tables_backup(NULL) thd(_thd), open_tables_backup(NULL)
{ {
......
...@@ -769,12 +769,7 @@ struct TABLE_SHARE ...@@ -769,12 +769,7 @@ struct TABLE_SHARE
mysql_rwlock_init(key_rwlock_LOCK_stat_serial, &LOCK_stat_serial); mysql_rwlock_init(key_rwlock_LOCK_stat_serial, &LOCK_stat_serial);
} }
void vers_destroy() void vers_destroy();
{
mysql_mutex_destroy(&LOCK_rotation);
mysql_cond_destroy(&COND_rotation);
mysql_rwlock_destroy(&LOCK_stat_serial);
}
Field *vers_start_field() Field *vers_start_field()
{ {
......
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