mirror of
https://github.com/MariaDB/server.git
synced 2025-07-10 04:22:00 +03:00
Remove mem_alloc_error()
As thd->alloc() and new automatically calls my_error(ER_OUTOFMEORY) there is no reason to call mem_alloc_error() Other things: - Fixed bug in mysql_unpack_partition() where lex.part_info was changed even if it would be a null pointer
This commit is contained in:
@ -1769,7 +1769,6 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
!(m_reorged_file= (handler**) thd->calloc(sizeof(handler*)*
|
||||
(m_reorged_parts + 1))))
|
||||
{
|
||||
mem_alloc_error(sizeof(handler*)*(m_reorged_parts+1));
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
||||
@ -1802,7 +1801,6 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
thd->calloc(sizeof(handler*)*
|
||||
(2*(num_remain_partitions + 1))))))
|
||||
{
|
||||
mem_alloc_error(sizeof(handler*)*2*(num_remain_partitions+1));
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
m_added_file= &new_file_array[num_remain_partitions + 1];
|
||||
@ -1894,7 +1892,6 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
thd->mem_root,
|
||||
part_elem->engine_type)))
|
||||
{
|
||||
mem_alloc_error(sizeof(handler));
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
if ((*new_file)->set_ha_share_ref(&p_share_refs->ha_shares[j]))
|
||||
@ -2922,10 +2919,8 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root)
|
||||
DBUG_ENTER("ha_partition::new_handlers_from_part_info");
|
||||
|
||||
if (!(m_file= (handler **) alloc_root(mem_root, alloc_len)))
|
||||
{
|
||||
mem_alloc_error(alloc_len);
|
||||
goto error_end;
|
||||
}
|
||||
goto error;
|
||||
|
||||
m_file_tot_parts= m_tot_parts;
|
||||
bzero((char*) m_file, alloc_len);
|
||||
DBUG_ASSERT(m_part_info->num_parts > 0);
|
||||
@ -2966,8 +2961,6 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root)
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
error:
|
||||
mem_alloc_error(sizeof(handler));
|
||||
error_end:
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
@ -48,11 +48,9 @@ partition_info *partition_info::get_clone(THD *thd)
|
||||
List_iterator<partition_element> part_it(partitions);
|
||||
partition_element *part;
|
||||
partition_info *clone= new (mem_root) partition_info(*this);
|
||||
if (!clone)
|
||||
{
|
||||
mem_alloc_error(sizeof(partition_info));
|
||||
if (unlikely(!clone))
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
|
||||
memset(&(clone->read_partitions), 0, sizeof(clone->read_partitions));
|
||||
memset(&(clone->lock_partitions), 0, sizeof(clone->lock_partitions));
|
||||
clone->bitmaps_are_initialized= FALSE;
|
||||
@ -64,20 +62,16 @@ partition_info *partition_info::get_clone(THD *thd)
|
||||
partition_element *subpart;
|
||||
partition_element *part_clone= new (mem_root) partition_element();
|
||||
if (!part_clone)
|
||||
{
|
||||
mem_alloc_error(sizeof(partition_element));
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
|
||||
memcpy(part_clone, part, sizeof(partition_element));
|
||||
part_clone->subpartitions.empty();
|
||||
while ((subpart= (subpart_it++)))
|
||||
{
|
||||
partition_element *subpart_clone= new (mem_root) partition_element();
|
||||
if (!subpart_clone)
|
||||
{
|
||||
mem_alloc_error(sizeof(partition_element));
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
|
||||
memcpy(subpart_clone, subpart, sizeof(partition_element));
|
||||
part_clone->subpartitions.push_back(subpart_clone, mem_root);
|
||||
}
|
||||
@ -88,20 +82,15 @@ partition_info *partition_info::get_clone(THD *thd)
|
||||
(part_elem_value *)alloc_root(mem_root, sizeof(part_elem_value) *
|
||||
part->list_val_list.elements);
|
||||
if (!new_val_arr)
|
||||
{
|
||||
mem_alloc_error(sizeof(part_elem_value) * part->list_val_list.elements);
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
|
||||
p_column_list_val *new_colval_arr=
|
||||
(p_column_list_val*)alloc_root(mem_root, sizeof(p_column_list_val) *
|
||||
num_columns *
|
||||
part->list_val_list.elements);
|
||||
if (!new_colval_arr)
|
||||
{
|
||||
mem_alloc_error(sizeof(p_column_list_val) * num_columns *
|
||||
part->list_val_list.elements);
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
|
||||
part_elem_value *val;
|
||||
while ((val= list_val_it++))
|
||||
{
|
||||
@ -394,10 +383,6 @@ char *partition_info::create_default_partition_names(THD *thd, uint part_no,
|
||||
move_ptr+= MAX_PART_NAME_SIZE;
|
||||
} while (++i < num_parts_arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
mem_alloc_error(num_parts_arg*MAX_PART_NAME_SIZE);
|
||||
}
|
||||
DBUG_RETURN(ptr);
|
||||
}
|
||||
|
||||
@ -422,13 +407,8 @@ char *partition_info::create_default_subpartition_name(THD *thd, uint subpart_no
|
||||
DBUG_ENTER("create_default_subpartition_name");
|
||||
|
||||
if (likely(ptr != NULL))
|
||||
{
|
||||
my_snprintf(ptr, size_alloc, "%ssp%u", part_name, subpart_no);
|
||||
}
|
||||
else
|
||||
{
|
||||
mem_alloc_error(size_alloc);
|
||||
}
|
||||
|
||||
DBUG_RETURN(ptr);
|
||||
}
|
||||
|
||||
@ -505,10 +485,7 @@ bool partition_info::set_up_default_partitions(THD *thd, handler *file,
|
||||
default_name+=MAX_PART_NAME_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mem_alloc_error(sizeof(partition_element));
|
||||
goto end;
|
||||
}
|
||||
} while (++i < num_parts);
|
||||
result= FALSE;
|
||||
end:
|
||||
@ -574,10 +551,7 @@ bool partition_info::set_up_default_subpartitions(THD *thd, handler *file,
|
||||
subpart_elem->partition_name= ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
mem_alloc_error(sizeof(partition_element));
|
||||
goto end;
|
||||
}
|
||||
} while (++j < num_subparts);
|
||||
} while (++i < num_parts);
|
||||
result= FALSE;
|
||||
@ -1506,11 +1480,9 @@ bool partition_info::set_part_expr(THD *thd, char *start_token, Item *item_ptr,
|
||||
size_t expr_len= end_token - start_token;
|
||||
char *func_string= (char*) thd->memdup(start_token, expr_len);
|
||||
|
||||
if (!func_string)
|
||||
{
|
||||
mem_alloc_error(expr_len);
|
||||
if (unlikely(!func_string))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (is_subpart)
|
||||
{
|
||||
list_of_subpart_fields= FALSE;
|
||||
@ -1665,7 +1637,6 @@ bool partition_info::set_up_charset_field_preps(THD *thd)
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
error:
|
||||
mem_alloc_error(size);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
@ -1972,10 +1943,8 @@ bool partition_info::init_column_part(THD *thd)
|
||||
if (!(list_val=
|
||||
(part_elem_value*) thd->calloc(sizeof(part_elem_value))) ||
|
||||
p_elem->list_val_list.push_back(list_val, thd->mem_root))
|
||||
{
|
||||
mem_alloc_error(sizeof(part_elem_value));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if (num_columns)
|
||||
loc_num_columns= num_columns;
|
||||
else
|
||||
@ -1983,10 +1952,8 @@ bool partition_info::init_column_part(THD *thd)
|
||||
if (!(col_val_array=
|
||||
(part_column_list_val*) thd->calloc(loc_num_columns *
|
||||
sizeof(part_column_list_val))))
|
||||
{
|
||||
mem_alloc_error(loc_num_columns * sizeof(part_elem_value));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
list_val->col_val_array= col_val_array;
|
||||
list_val->added_items= 0;
|
||||
curr_list_val= list_val;
|
||||
@ -2202,7 +2169,6 @@ bool partition_info::fix_column_value_functions(THD *thd,
|
||||
thd->variables.sql_mode= save_sql_mode;
|
||||
if (!(val_ptr= (uchar*) thd->memdup(field->ptr, len)))
|
||||
{
|
||||
mem_alloc_error(len);
|
||||
result= TRUE;
|
||||
goto end;
|
||||
}
|
||||
@ -2717,11 +2683,9 @@ bool partition_info::vers_init_info(THD * thd)
|
||||
column_list= TRUE;
|
||||
num_columns= 1;
|
||||
vers_info= new (thd->mem_root) Vers_part_info;
|
||||
if (!vers_info)
|
||||
{
|
||||
mem_alloc_error(sizeof(Vers_part_info));
|
||||
if (unlikely(!vers_info))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ static bool set_up_field_array(THD *thd, TABLE *table,
|
||||
if (field->flags & GET_FIXED_FIELDS_FLAG)
|
||||
num_fields++;
|
||||
}
|
||||
if (num_fields > MAX_REF_PARTS)
|
||||
if (unlikely(num_fields > MAX_REF_PARTS))
|
||||
{
|
||||
char *err_str;
|
||||
if (is_sub_part)
|
||||
@ -359,15 +359,13 @@ static bool set_up_field_array(THD *thd, TABLE *table,
|
||||
We are using hidden key as partitioning field
|
||||
*/
|
||||
DBUG_ASSERT(!is_sub_part);
|
||||
DBUG_RETURN(result);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
size_field_array= (num_fields+1)*sizeof(Field*);
|
||||
field_array= (Field**) thd->calloc(size_field_array);
|
||||
if (unlikely(!field_array))
|
||||
{
|
||||
mem_alloc_error(size_field_array);
|
||||
result= TRUE;
|
||||
}
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
ptr= table->field;
|
||||
while ((field= *(ptr++)))
|
||||
{
|
||||
@ -490,7 +488,6 @@ static bool create_full_part_field_array(THD *thd, TABLE *table,
|
||||
field_array= (Field**) thd->calloc(size_field_array);
|
||||
if (unlikely(!field_array))
|
||||
{
|
||||
mem_alloc_error(size_field_array);
|
||||
result= TRUE;
|
||||
goto end;
|
||||
}
|
||||
@ -515,14 +512,12 @@ static bool create_full_part_field_array(THD *thd, TABLE *table,
|
||||
if (!(bitmap_buf= (my_bitmap_map*)
|
||||
thd->alloc(bitmap_buffer_size(table->s->fields))))
|
||||
{
|
||||
mem_alloc_error(bitmap_buffer_size(table->s->fields));
|
||||
result= TRUE;
|
||||
goto end;
|
||||
}
|
||||
if (my_bitmap_init(&part_info->full_part_field_set, bitmap_buf,
|
||||
table->s->fields, FALSE))
|
||||
if (unlikely(my_bitmap_init(&part_info->full_part_field_set, bitmap_buf,
|
||||
table->s->fields, FALSE)))
|
||||
{
|
||||
mem_alloc_error(table->s->fields);
|
||||
result= TRUE;
|
||||
goto end;
|
||||
}
|
||||
@ -1088,12 +1083,11 @@ static bool set_up_partition_bitmaps(THD *thd, partition_info *part_info)
|
||||
DBUG_ASSERT(!part_info->bitmaps_are_initialized);
|
||||
|
||||
/* Allocate for both read and lock_partitions */
|
||||
if (!(bitmap_buf= (uint32*) alloc_root(&part_info->table->mem_root,
|
||||
bitmap_bytes * 2)))
|
||||
{
|
||||
mem_alloc_error(bitmap_bytes * 2);
|
||||
if (unlikely(!(bitmap_buf=
|
||||
(uint32*) alloc_root(&part_info->table->mem_root,
|
||||
bitmap_bytes * 2))))
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
my_bitmap_init(&part_info->read_partitions, bitmap_buf, bitmap_bits, FALSE);
|
||||
/* Use the second half of the allocated buffer for lock_partitions */
|
||||
my_bitmap_init(&part_info->lock_partitions, bitmap_buf + (bitmap_bytes / 4),
|
||||
@ -1291,11 +1285,9 @@ static bool check_range_constants(THD *thd, partition_info *part_info)
|
||||
uint size_entries= sizeof(part_column_list_val) * num_column_values;
|
||||
part_info->range_col_array= (part_column_list_val*)
|
||||
thd->calloc(part_info->num_parts * size_entries);
|
||||
if (part_info->range_col_array == NULL)
|
||||
{
|
||||
mem_alloc_error(part_info->num_parts * size_entries);
|
||||
if (unlikely(part_info->range_col_array == NULL))
|
||||
goto end;
|
||||
}
|
||||
|
||||
loc_range_col_array= part_info->range_col_array;
|
||||
i= 0;
|
||||
do
|
||||
@ -1329,11 +1321,9 @@ static bool check_range_constants(THD *thd, partition_info *part_info)
|
||||
|
||||
part_info->range_int_array= (longlong*)
|
||||
thd->alloc(part_info->num_parts * sizeof(longlong));
|
||||
if (part_info->range_int_array == NULL)
|
||||
{
|
||||
mem_alloc_error(part_info->num_parts * sizeof(longlong));
|
||||
if (unlikely(part_info->range_int_array == NULL))
|
||||
goto end;
|
||||
}
|
||||
|
||||
i= 0;
|
||||
do
|
||||
{
|
||||
@ -4455,26 +4445,24 @@ bool mysql_unpack_partition(THD *thd,
|
||||
thd->variables.character_set_client= system_charset_info;
|
||||
|
||||
Parser_state parser_state;
|
||||
if (parser_state.init(thd, part_buf, part_info_len))
|
||||
if (unlikely(parser_state.init(thd, part_buf, part_info_len)))
|
||||
goto end;
|
||||
|
||||
if (init_lex_with_single_table(thd, table, &lex))
|
||||
if (unlikely(init_lex_with_single_table(thd, table, &lex)))
|
||||
goto end;
|
||||
|
||||
*work_part_info_used= FALSE;
|
||||
lex.part_info= new partition_info();
|
||||
lex.part_info->table= table; /* Indicates MYSQLparse from this place */
|
||||
if (!lex.part_info)
|
||||
{
|
||||
mem_alloc_error(sizeof(partition_info));
|
||||
|
||||
if (unlikely(!(lex.part_info= new partition_info())))
|
||||
goto end;
|
||||
}
|
||||
|
||||
lex.part_info->table= table; /* Indicates MYSQLparse from this place */
|
||||
part_info= lex.part_info;
|
||||
DBUG_PRINT("info", ("Parse: %s", part_buf));
|
||||
|
||||
thd->m_statement_psi= NULL;
|
||||
if (parse_sql(thd, & parser_state, NULL) ||
|
||||
part_info->fix_parser_data(thd))
|
||||
if (unlikely(parse_sql(thd, & parser_state, NULL)) ||
|
||||
unlikely(part_info->fix_parser_data(thd)))
|
||||
{
|
||||
thd->free_items();
|
||||
thd->m_statement_psi= parent_locker;
|
||||
@ -5328,23 +5316,19 @@ that are reorganised.
|
||||
partition_element *part_elem= alt_it++;
|
||||
if (*fast_alter_table)
|
||||
part_elem->part_state= PART_TO_BE_ADDED;
|
||||
if (tab_part_info->partitions.push_back(part_elem, thd->mem_root))
|
||||
{
|
||||
mem_alloc_error(1);
|
||||
if (unlikely(tab_part_info->partitions.push_back(part_elem,
|
||||
thd->mem_root)))
|
||||
goto err;
|
||||
}
|
||||
} while (++part_count < num_new_partitions);
|
||||
tab_part_info->num_parts+= num_new_partitions;
|
||||
if (tab_part_info->part_type == VERSIONING_PARTITION)
|
||||
{
|
||||
DBUG_ASSERT(now_part);
|
||||
if (tab_part_info->partitions.push_back(now_part, thd->mem_root))
|
||||
{
|
||||
mem_alloc_error(1);
|
||||
if (unlikely(tab_part_info->partitions.push_back(now_part,
|
||||
thd->mem_root)))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
If we specify partitions explicitly we don't use defaults anymore.
|
||||
Using ADD PARTITION also means that we don't have the default number
|
||||
@ -5675,12 +5659,10 @@ the generated partition syntax in a correct manner.
|
||||
else
|
||||
tab_max_range= part_elem->range_value;
|
||||
if (*fast_alter_table &&
|
||||
tab_part_info->temp_partitions.push_back(part_elem,
|
||||
thd->mem_root))
|
||||
{
|
||||
mem_alloc_error(1);
|
||||
unlikely(tab_part_info->temp_partitions.
|
||||
push_back(part_elem, thd->mem_root)))
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (*fast_alter_table)
|
||||
part_elem->part_state= PART_TO_BE_REORGED;
|
||||
if (!found_first)
|
||||
@ -7541,27 +7523,6 @@ void append_row_to_str(String &str, const uchar *row, TABLE *table)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SYNOPSIS
|
||||
mem_alloc_error()
|
||||
size Size of memory attempted to allocate
|
||||
None
|
||||
|
||||
RETURN VALUES
|
||||
None
|
||||
|
||||
DESCRIPTION
|
||||
A routine to use for all the many places in the code where memory
|
||||
allocation error can happen, a tremendous amount of them, needs
|
||||
simple routine that signals this error.
|
||||
*/
|
||||
|
||||
void mem_alloc_error(size_t size)
|
||||
{
|
||||
my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR),
|
||||
static_cast<int>(size));
|
||||
}
|
||||
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
/**
|
||||
Return comma-separated list of used partitions in the provided given string.
|
||||
|
@ -133,7 +133,6 @@ Item* convert_charset_partition_constant(Item *item, CHARSET_INFO *cs);
|
||||
@param[in] table Table containing read_set and fields for the row.
|
||||
*/
|
||||
void append_row_to_str(String &str, const uchar *row, TABLE *table);
|
||||
void mem_alloc_error(size_t size);
|
||||
void truncate_partition_filename(char *path);
|
||||
|
||||
/*
|
||||
|
@ -342,10 +342,7 @@ static bool exchange_name_with_ddl_log(THD *thd,
|
||||
DBUG_ENTER("exchange_name_with_ddl_log");
|
||||
|
||||
if (unlikely(!(file= get_new_handler(NULL, thd->mem_root, ht))))
|
||||
{
|
||||
mem_alloc_error(sizeof(handler));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/* prepare the action entry */
|
||||
exchange_entry.entry_type= DDL_LOG_ENTRY_CODE;
|
||||
|
@ -29,8 +29,7 @@
|
||||
#include "lock.h" // mysql_unlock_tables
|
||||
#include "strfunc.h" // find_type2, find_set
|
||||
#include "sql_truncate.h" // regenerate_locked_table
|
||||
#include "sql_partition.h" // mem_alloc_error,
|
||||
// generate_partition_syntax,
|
||||
#include "sql_partition.h" // generate_partition_syntax,
|
||||
// partition_info
|
||||
// NOT_A_PARTITION_ID
|
||||
#include "sql_db.h" // load_db_opt_by_name
|
||||
@ -1146,12 +1145,9 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
|
||||
}
|
||||
hton= plugin_data(plugin, handlerton*);
|
||||
file= get_new_handler((TABLE_SHARE*)0, &mem_root, hton);
|
||||
if (!file)
|
||||
{
|
||||
mem_alloc_error(sizeof(handler));
|
||||
if (unlikely(!file))
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
switch (ddl_log_entry->action_type)
|
||||
{
|
||||
case DDL_LOG_REPLACE_ACTION:
|
||||
@ -4492,12 +4488,10 @@ handler *mysql_create_frm_image(THD *thd,
|
||||
|
||||
db_options= create_info->table_options_with_row_type();
|
||||
|
||||
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root,
|
||||
create_info->db_type)))
|
||||
{
|
||||
mem_alloc_error(sizeof(handler));
|
||||
if (unlikely(!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root,
|
||||
create_info->db_type))))
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
partition_info *part_info= thd->work_part_info;
|
||||
|
||||
@ -4510,11 +4504,9 @@ handler *mysql_create_frm_image(THD *thd,
|
||||
object with the default settings.
|
||||
*/
|
||||
thd->work_part_info= part_info= new partition_info();
|
||||
if (!part_info)
|
||||
{
|
||||
mem_alloc_error(sizeof(partition_info));
|
||||
if (unlikely(!part_info))
|
||||
goto err;
|
||||
}
|
||||
|
||||
file->set_auto_partitions(part_info);
|
||||
part_info->default_engine_type= create_info->db_type;
|
||||
part_info->is_auto_partitioned= TRUE;
|
||||
@ -4685,14 +4677,11 @@ handler *mysql_create_frm_image(THD *thd,
|
||||
engines in partition clauses.
|
||||
*/
|
||||
delete file;
|
||||
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root,
|
||||
engine_type)))
|
||||
{
|
||||
mem_alloc_error(sizeof(handler));
|
||||
if (unlikely(!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root,
|
||||
engine_type))))
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
Unless table's storage engine supports partitioning natively
|
||||
don't allow foreign keys on partitioned tables (they won't
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "sql_priv.h"
|
||||
#include "sql_parse.h" /* comp_*_creator */
|
||||
#include "sql_table.h" /* primary_key_name */
|
||||
#include "sql_partition.h" /* mem_alloc_error, partition_info, HASH_PARTITION */
|
||||
#include "sql_partition.h" /* partition_info, HASH_PARTITION */
|
||||
#include "sql_acl.h" /* *_ACL */
|
||||
#include "sql_class.h" /* Key_part_spec, enum_filetype, Diag_condition_item_name */
|
||||
#include "slave.h"
|
||||
@ -764,11 +764,8 @@ bool LEX::set_bincmp(CHARSET_INFO *cs, bool bin)
|
||||
Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
|
||||
{
|
||||
Virtual_column_info *v= new (thd->mem_root) Virtual_column_info();
|
||||
if (!v)
|
||||
{
|
||||
mem_alloc_error(sizeof(Virtual_column_info));
|
||||
if (unlikely(!v))
|
||||
return 0;
|
||||
}
|
||||
v->expr= expr;
|
||||
v->utf8= 0; /* connection charset */
|
||||
return v;
|
||||
@ -5316,7 +5313,7 @@ part_field_item:
|
||||
if (unlikely(part_info->part_field_list.push_back($1.str,
|
||||
thd->mem_root)))
|
||||
MYSQL_YYABORT;
|
||||
if (part_info->num_columns > MAX_REF_PARTS)
|
||||
if (unlikely(part_info->num_columns > MAX_REF_PARTS))
|
||||
my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
|
||||
"list of partition fields"));
|
||||
}
|
||||
@ -5393,6 +5390,7 @@ sub_part_field_item:
|
||||
if (unlikely(part_info->subpart_field_list.push_back($1.str,
|
||||
thd->mem_root)))
|
||||
MYSQL_YYABORT;
|
||||
|
||||
if (unlikely(part_info->subpart_field_list.elements > MAX_REF_PARTS))
|
||||
my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
|
||||
"list of subpartition fields"));
|
||||
@ -5470,6 +5468,7 @@ part_definition:
|
||||
if (unlikely(!p_elem) ||
|
||||
unlikely(part_info->partitions.push_back(p_elem, thd->mem_root)))
|
||||
MYSQL_YYABORT;
|
||||
|
||||
p_elem->part_state= PART_NORMAL;
|
||||
p_elem->id= part_info->partitions.elements - 1;
|
||||
part_info->curr_part_elem= p_elem;
|
||||
@ -5819,6 +5818,7 @@ sub_part_definition:
|
||||
if (unlikely(!sub_p_elem) ||
|
||||
unlikely(curr_part->subpartitions.push_back(sub_p_elem, thd->mem_root)))
|
||||
MYSQL_YYABORT;
|
||||
|
||||
sub_p_elem->id= curr_part->subpartitions.elements - 1;
|
||||
part_info->curr_part_elem= sub_p_elem;
|
||||
part_info->use_default_subpartitions= FALSE;
|
||||
@ -8049,6 +8049,7 @@ add_partition_rule:
|
||||
lex->part_info= new (thd->mem_root) partition_info();
|
||||
if (unlikely(!lex->part_info))
|
||||
MYSQL_YYABORT;
|
||||
|
||||
lex->alter_info.partition_flags|= ALTER_PARTITION_ADD;
|
||||
DBUG_ASSERT(!Lex->create_info.if_not_exists());
|
||||
lex->create_info.set($3);
|
||||
@ -8078,6 +8079,7 @@ reorg_partition_rule:
|
||||
lex->part_info= new (thd->mem_root) partition_info();
|
||||
if (unlikely(!lex->part_info))
|
||||
MYSQL_YYABORT;
|
||||
|
||||
lex->no_write_to_binlog= $3;
|
||||
}
|
||||
reorg_parts_rule
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "sql_priv.h"
|
||||
#include "sql_parse.h" /* comp_*_creator */
|
||||
#include "sql_table.h" /* primary_key_name */
|
||||
#include "sql_partition.h" /* mem_alloc_error, partition_info, HASH_PARTITION */
|
||||
#include "sql_partition.h" /* partition_info, HASH_PARTITION */
|
||||
#include "sql_acl.h" /* *_ACL */
|
||||
#include "sql_class.h" /* Key_part_spec, enum_filetype, Diag_condition_item_name */
|
||||
#include "slave.h"
|
||||
@ -5135,10 +5135,8 @@ partitioning:
|
||||
LEX *lex= Lex;
|
||||
lex->part_info= new (thd->mem_root) partition_info();
|
||||
if (unlikely(!lex->part_info))
|
||||
{
|
||||
mem_alloc_error(sizeof(partition_info));
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
|
||||
if (lex->sql_command == SQLCOM_ALTER_TABLE)
|
||||
{
|
||||
lex->alter_info.partition_flags|= ALTER_PARTITION_INFO;
|
||||
@ -5255,10 +5253,8 @@ part_field_item:
|
||||
part_info->num_columns++;
|
||||
if (unlikely(part_info->part_field_list.push_back($1.str,
|
||||
thd->mem_root)))
|
||||
{
|
||||
mem_alloc_error(1);
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
|
||||
if (unlikely(part_info->num_columns > MAX_REF_PARTS))
|
||||
my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
|
||||
"list of partition fields"));
|
||||
@ -5335,10 +5331,8 @@ sub_part_field_item:
|
||||
partition_info *part_info= Lex->part_info;
|
||||
if (unlikely(part_info->subpart_field_list.push_back($1.str,
|
||||
thd->mem_root)))
|
||||
{
|
||||
mem_alloc_error(1);
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
|
||||
if (unlikely(part_info->subpart_field_list.elements > MAX_REF_PARTS))
|
||||
my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
|
||||
"list of subpartition fields"));
|
||||
@ -5713,10 +5707,8 @@ sub_part_definition:
|
||||
}
|
||||
if (unlikely(!sub_p_elem) ||
|
||||
unlikely(curr_part->subpartitions.push_back(sub_p_elem, thd->mem_root)))
|
||||
{
|
||||
mem_alloc_error(sizeof(partition_element));
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
|
||||
part_info->curr_part_elem= sub_p_elem;
|
||||
part_info->use_default_subpartitions= FALSE;
|
||||
part_info->use_default_num_subpartitions= FALSE;
|
||||
@ -7923,6 +7915,7 @@ reorg_partition_rule:
|
||||
lex->part_info= new (thd->mem_root) partition_info();
|
||||
if (unlikely(!lex->part_info))
|
||||
MYSQL_YYABORT;
|
||||
|
||||
lex->no_write_to_binlog= $3;
|
||||
}
|
||||
reorg_parts_rule
|
||||
|
Reference in New Issue
Block a user