cleanup: use my_multi_malloc(), etc
This commit is contained in:
parent
5a9484b784
commit
641f81baf4
@ -7728,7 +7728,6 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
|
||||
bool is_com_multi,
|
||||
bool is_next_command)
|
||||
{
|
||||
int error __attribute__((unused));
|
||||
DBUG_ENTER("mysql_parse");
|
||||
DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on(););
|
||||
|
||||
@ -7808,6 +7807,7 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
|
||||
(char *) thd->security_ctx->host_or_ip,
|
||||
0);
|
||||
|
||||
int error __attribute__((unused));
|
||||
error= mysql_execute_command(thd);
|
||||
MYSQL_QUERY_EXEC_DONE(error);
|
||||
}
|
||||
|
@ -17490,8 +17490,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
|
||||
No need to change table name to lower case as we are only creating
|
||||
MyISAM, Aria or HEAP tables here
|
||||
*/
|
||||
fn_format(path, path, mysql_tmpdir, "",
|
||||
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
|
||||
if (group)
|
||||
{
|
||||
@ -18673,14 +18672,10 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
|
||||
}
|
||||
}
|
||||
|
||||
if (unlikely((error= maria_create(share->path.str,
|
||||
file_type,
|
||||
share->keys, &keydef,
|
||||
(uint) (*recinfo-start_recinfo),
|
||||
start_recinfo,
|
||||
share->uniques, &uniquedef,
|
||||
&create_info,
|
||||
create_flags))))
|
||||
if (unlikely((error= maria_create(share->path.str, file_type, share->keys,
|
||||
&keydef, (uint) (*recinfo-start_recinfo),
|
||||
start_recinfo, share->uniques, &uniquedef,
|
||||
&create_info, create_flags))))
|
||||
{
|
||||
table->file->print_error(error,MYF(0)); /* purecov: inspected */
|
||||
table->db_stat=0;
|
||||
@ -18881,8 +18876,7 @@ create_internal_tmp_table_from_heap(THD *thd, TABLE *table,
|
||||
if (is_duplicate)
|
||||
*is_duplicate= FALSE;
|
||||
|
||||
if (table->s->db_type() != heap_hton ||
|
||||
error != HA_ERR_RECORD_FILE_FULL)
|
||||
if (table->s->db_type() != heap_hton || error != HA_ERR_RECORD_FILE_FULL)
|
||||
{
|
||||
/*
|
||||
We don't want this error to be converted to a warning, e.g. in case of
|
||||
|
@ -8165,7 +8165,7 @@ mark_all_fields_used_in_query(THD *thd,
|
||||
0<decimals<10 and 0<=length<100 .
|
||||
|
||||
@param
|
||||
thd thread handler
|
||||
thd thread handler
|
||||
|
||||
@param table_list Used to pass I_S table information(fields info, tables
|
||||
parameters etc) and table name.
|
||||
@ -8332,11 +8332,10 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
||||
tmp_table_param->schema_table= 1;
|
||||
SELECT_LEX *select_lex= thd->lex->current_select;
|
||||
bool keep_row_order= is_show_command(thd);
|
||||
if (!(table= create_tmp_table(thd, tmp_table_param,
|
||||
field_list, (ORDER*) 0, 0, 0,
|
||||
(select_lex->options | thd->variables.option_bits |
|
||||
TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR,
|
||||
&table_list->alias, false, keep_row_order)))
|
||||
if (!(table= create_tmp_table(thd, tmp_table_param, field_list, (ORDER*) 0, 0,
|
||||
0, (select_lex->options | thd->variables.option_bits |
|
||||
TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR,
|
||||
&table_list->alias, false, keep_row_order)))
|
||||
DBUG_RETURN(0);
|
||||
my_bitmap_map* bitmaps=
|
||||
(my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count));
|
||||
@ -8794,10 +8793,10 @@ bool optimize_schema_tables_reads(JOIN *join)
|
||||
cond= tab->cache_select->cond;
|
||||
}
|
||||
if (optimize_for_get_all_tables(thd, table_list, cond))
|
||||
DBUG_RETURN(TRUE); // Handle OOM
|
||||
DBUG_RETURN(1); // Handle OOM
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
@ -8862,13 +8861,10 @@ bool get_schema_tables_result(JOIN *join,
|
||||
continue;
|
||||
|
||||
/*
|
||||
If schema table is already processed and
|
||||
the statement is not a subselect then
|
||||
we don't need to fill this table again.
|
||||
If schema table is already processed and
|
||||
schema_table_state != executed_place then
|
||||
table is already processed and
|
||||
we should skip second data processing.
|
||||
If schema table is already processed and the statement is not a
|
||||
subselect then we don't need to fill this table again. If schema table
|
||||
is already processed and schema_table_state != executed_place then
|
||||
table is already processed and we should skip second data processing.
|
||||
*/
|
||||
if (table_list->schema_table_state &&
|
||||
(!is_subselect || table_list->schema_table_state != executed_place))
|
||||
@ -8930,8 +8926,7 @@ bool get_schema_tables_result(JOIN *join,
|
||||
It also means that an audit plugin cannot process the error correctly
|
||||
either. See also thd->clear_error()
|
||||
*/
|
||||
thd->get_stmt_da()->push_warning(thd,
|
||||
thd->get_stmt_da()->sql_errno(),
|
||||
thd->get_stmt_da()->push_warning(thd, thd->get_stmt_da()->sql_errno(),
|
||||
thd->get_stmt_da()->get_sqlstate(),
|
||||
Sql_condition::WARN_LEVEL_ERROR,
|
||||
thd->get_stmt_da()->message());
|
||||
|
@ -26,12 +26,8 @@
|
||||
#include "ha_heap.h"
|
||||
#include "sql_base.h" // enum_tdc_remove_table_type
|
||||
|
||||
static handler *heap_create_handler(handlerton *hton,
|
||||
TABLE_SHARE *table,
|
||||
MEM_ROOT *mem_root);
|
||||
static int
|
||||
heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
|
||||
HP_CREATE_INFO *hp_create_info);
|
||||
static handler *heap_create_handler(handlerton *, TABLE_SHARE *, MEM_ROOT *);
|
||||
static int heap_prepare_hp_create_info(TABLE *, bool, HP_CREATE_INFO *);
|
||||
|
||||
|
||||
int heap_panic(handlerton *hton, ha_panic_function flag)
|
||||
@ -603,16 +599,15 @@ ha_rows ha_heap::records_in_range(uint inx, key_range *min_key,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
|
||||
HP_CREATE_INFO *hp_create_info)
|
||||
static int heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
|
||||
HP_CREATE_INFO *hp_create_info)
|
||||
{
|
||||
uint key, parts, mem_per_row= 0, keys= table_arg->s->keys;
|
||||
TABLE_SHARE *share= table_arg->s;
|
||||
uint key, parts, mem_per_row= 0, keys= share->keys;
|
||||
uint auto_key= 0, auto_key_type= 0;
|
||||
ha_rows max_rows;
|
||||
HP_KEYDEF *keydef;
|
||||
HA_KEYSEG *seg;
|
||||
TABLE_SHARE *share= table_arg->s;
|
||||
bool found_real_auto_increment= 0;
|
||||
|
||||
bzero(hp_create_info, sizeof(*hp_create_info));
|
||||
@ -620,11 +615,11 @@ heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
|
||||
for (key= parts= 0; key < keys; key++)
|
||||
parts+= table_arg->key_info[key].user_defined_key_parts;
|
||||
|
||||
if (!(keydef= (HP_KEYDEF*) my_malloc(keys * sizeof(HP_KEYDEF) +
|
||||
parts * sizeof(HA_KEYSEG),
|
||||
MYF(MY_WME | MY_THREAD_SPECIFIC))))
|
||||
if (!my_multi_malloc(MYF(MY_WME | MY_THREAD_SPECIFIC),
|
||||
&keydef, keys * sizeof(HP_KEYDEF),
|
||||
&seg, parts * sizeof(HA_KEYSEG),
|
||||
NULL))
|
||||
return my_errno;
|
||||
seg= reinterpret_cast<HA_KEYSEG*>(keydef + keys);
|
||||
for (key= 0; key < keys; key++)
|
||||
{
|
||||
KEY *pos= table_arg->key_info+key;
|
||||
|
Loading…
x
Reference in New Issue
Block a user