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