fix gcc 8 compiler warnings
There were two newly enabled warnings: 1. cast for a function pointers. Affected sql_analyse.h, mi_write.c and ma_write.cc, mf_iocache-t.cc, mysqlbinlog.cc, encryption.cc, etc 2. memcpy/memset of nontrivial structures. Fixed as: * the warning disabled for InnoDB * TABLE, TABLE_SHARE, and TABLE_LIST got a new method reset() which does the bzero(), which is safe for these classes, but any other bzero() will still cause a warning * Table_scope_and_contents_source_st uses `TABLE_LIST *` (trivial) instead of `SQL_I_List<TABLE_LIST>` (not trivial) so it's safe to bzero now. * added casts in debug_sync.cc and sql_select.cc (for JOIN) * move assignment method for MDL_request instead of memcpy() * PARTIAL_INDEX_INTERSECT_INFO::init() instead of bzero() * remove constructor from READ_RECORD() to make it trivial * replace some memcpy() with c++ copy assignments
This commit is contained in:
parent
ddfa722a03
commit
3d2d060b62
@ -2867,16 +2867,25 @@ void *sql_alloc(size_t size)
|
||||
return alloc_root(&s_mem_root, size);
|
||||
}
|
||||
|
||||
uint e_key_get_latest_version_func(uint) { return 1; }
|
||||
uint e_key_get_func(uint, uint, uchar*, uint*) { return 1; }
|
||||
uint e_ctx_size_func(uint, uint) { return 1; }
|
||||
int e_ctx_init_func(void *, const uchar*, uint, const uchar*, uint,
|
||||
int, uint, uint) { return 1; }
|
||||
int e_ctx_update_func(void *, const uchar*, uint, uchar*, uint*) { return 1; }
|
||||
int e_ctx_finish_func(void *, uchar*, uint*) { return 1; }
|
||||
uint e_encrypted_length_func(uint, uint, uint) { return 1; }
|
||||
|
||||
uint dummy1() { return 1; }
|
||||
struct encryption_service_st encryption_handler=
|
||||
{
|
||||
(uint(*)(uint))dummy1,
|
||||
(uint(*)(uint, uint, uchar*, uint*))dummy1,
|
||||
(uint(*)(uint, uint))dummy1,
|
||||
(int (*)(void*, const uchar*, uint, const uchar*, uint, int, uint, uint))dummy1,
|
||||
(int (*)(void*, const uchar*, uint, uchar*, uint*))dummy1,
|
||||
(int (*)(void*, uchar*, uint*))dummy1,
|
||||
(uint (*)(uint, uint, uint))dummy1
|
||||
e_key_get_latest_version_func,
|
||||
e_key_get_func,
|
||||
e_ctx_size_func,
|
||||
e_ctx_init_func,
|
||||
e_ctx_update_func,
|
||||
e_ctx_finish_func,
|
||||
e_encrypted_length_func
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -584,7 +584,7 @@ static void debug_sync_remove_action(st_debug_sync_control *ds_control,
|
||||
memmove(save_action, action, sizeof(st_debug_sync_action));
|
||||
|
||||
/* Move actions down. */
|
||||
memmove(ds_control->ds_action + dsp_idx,
|
||||
memmove((void*)(ds_control->ds_action + dsp_idx),
|
||||
ds_control->ds_action + dsp_idx + 1,
|
||||
(ds_control->ds_active - dsp_idx) *
|
||||
sizeof(st_debug_sync_action));
|
||||
@ -595,8 +595,8 @@ static void debug_sync_remove_action(st_debug_sync_control *ds_control,
|
||||
produced by the shift. Again do not use an assignment operator to
|
||||
avoid string allocation/copy.
|
||||
*/
|
||||
memmove(ds_control->ds_action + ds_control->ds_active, save_action,
|
||||
sizeof(st_debug_sync_action));
|
||||
memmove((void*)(ds_control->ds_action + ds_control->ds_active),
|
||||
save_action, sizeof(st_debug_sync_action));
|
||||
}
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -25,6 +25,10 @@ struct encryption_service_st encryption_handler;
|
||||
|
||||
extern "C" {
|
||||
|
||||
uint no_get_key(uint, uint, uchar*, uint*)
|
||||
{
|
||||
return ENCRYPTION_KEY_VERSION_INVALID;
|
||||
}
|
||||
uint no_key(uint)
|
||||
{
|
||||
return ENCRYPTION_KEY_VERSION_INVALID;
|
||||
@ -47,6 +51,11 @@ static unsigned int get_length(unsigned int slen, unsigned int key_id,
|
||||
return my_aes_get_size(MY_AES_CBC, slen);
|
||||
}
|
||||
|
||||
uint ctx_size(unsigned int, unsigned int)
|
||||
{
|
||||
return MY_AES_CTX_SIZE;
|
||||
}
|
||||
|
||||
} /* extern "C" */
|
||||
|
||||
int initialize_encryption_plugin(st_plugin_int *plugin)
|
||||
@ -72,8 +81,7 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
|
||||
if (handle->crypt_ctx_size)
|
||||
encryption_handler.encryption_ctx_size_func= handle->crypt_ctx_size;
|
||||
else
|
||||
encryption_handler.encryption_ctx_size_func=
|
||||
(uint (*)(unsigned int, unsigned int))my_aes_ctx_size;
|
||||
encryption_handler.encryption_ctx_size_func= ctx_size;
|
||||
|
||||
encryption_handler.encryption_ctx_init_func=
|
||||
handle->crypt_ctx_init ? handle->crypt_ctx_init : ctx_init;
|
||||
@ -102,8 +110,7 @@ int finalize_encryption_plugin(st_plugin_int *plugin)
|
||||
|
||||
if (used)
|
||||
{
|
||||
encryption_handler.encryption_key_get_func=
|
||||
(uint (*)(uint, uint, uchar*, uint*))no_key;
|
||||
encryption_handler.encryption_key_get_func= no_get_key;
|
||||
encryption_handler.encryption_key_get_latest_version_func= no_key;
|
||||
encryption_handler.encryption_ctx_size_func= zero_size;
|
||||
}
|
||||
|
@ -1687,7 +1687,6 @@ struct Table_scope_and_contents_source_st
|
||||
uint options; /* OR of HA_CREATE_ options */
|
||||
uint merge_insert_method;
|
||||
uint extra_size; /* length of extra data segment */
|
||||
SQL_I_List<TABLE_LIST> merge_list;
|
||||
handlerton *db_type;
|
||||
/**
|
||||
Row type of the table definition.
|
||||
@ -1716,6 +1715,7 @@ struct Table_scope_and_contents_source_st
|
||||
TABLE_LIST *pos_in_locked_tables;
|
||||
MDL_ticket *mdl_ticket;
|
||||
bool table_was_deleted;
|
||||
TABLE_LIST *merge_list;
|
||||
|
||||
void init()
|
||||
{
|
||||
|
10
sql/mdl.h
10
sql/mdl.h
@ -475,6 +475,16 @@ public:
|
||||
DBUG_ASSERT(ticket == NULL);
|
||||
type= type_arg;
|
||||
}
|
||||
void move_from(MDL_request &from)
|
||||
{
|
||||
type= from.type;
|
||||
duration= from.duration;
|
||||
ticket= from.ticket;
|
||||
next_in_list= from.next_in_list;
|
||||
prev_in_list= from.prev_in_list;
|
||||
key.mdl_key_init(&from.key);
|
||||
from.ticket= NULL; // that's what "move" means
|
||||
}
|
||||
|
||||
/*
|
||||
This is to work around the ugliness of TABLE_LIST
|
||||
|
@ -1340,8 +1340,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
|
||||
- Use rowids from unique to run a disk-ordered sweep
|
||||
*/
|
||||
|
||||
QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT(THD *thd_param,
|
||||
TABLE *table)
|
||||
QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT(THD *thd_param, TABLE *table)
|
||||
:unique(NULL), pk_quick_select(NULL), thd(thd_param)
|
||||
{
|
||||
DBUG_ENTER("QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT");
|
||||
@ -5111,6 +5110,16 @@ typedef struct st_partial_index_intersect_info
|
||||
key_map filtered_scans; /* scans to be filtered by cpk conditions */
|
||||
|
||||
MY_BITMAP *intersect_fields; /* bitmap of fields used in intersection */
|
||||
|
||||
void init()
|
||||
{
|
||||
common_info= NULL;
|
||||
intersect_fields= NULL;
|
||||
records_sent_to_unique= records= length= in_memory= use_cpk_filter= 0;
|
||||
cost= index_read_cost= in_memory_cost= 0.0;
|
||||
filtered_scans.init();
|
||||
filtered_scans.clear_all();
|
||||
}
|
||||
} PARTIAL_INDEX_INTERSECT_INFO;
|
||||
|
||||
|
||||
@ -5247,8 +5256,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
|
||||
if (!n_index_scans)
|
||||
return 1;
|
||||
|
||||
bzero(init, sizeof(*init));
|
||||
init->filtered_scans.init();
|
||||
init->init();
|
||||
init->common_info= common;
|
||||
init->cost= cutoff_cost;
|
||||
|
||||
|
@ -47,7 +47,7 @@ partition_info *partition_info::get_clone(THD *thd)
|
||||
mem_alloc_error(sizeof(partition_info));
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
memcpy(clone, this, sizeof(partition_info));
|
||||
*clone= *this;
|
||||
memset(&(clone->read_partitions), 0, sizeof(clone->read_partitions));
|
||||
memset(&(clone->lock_partitions), 0, sizeof(clone->lock_partitions));
|
||||
clone->bitmaps_are_initialized= FALSE;
|
||||
@ -63,7 +63,7 @@ partition_info *partition_info::get_clone(THD *thd)
|
||||
mem_alloc_error(sizeof(partition_element));
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
memcpy(part_clone, part, sizeof(partition_element));
|
||||
*part_clone= *part;
|
||||
part_clone->subpartitions.empty();
|
||||
while ((subpart= (subpart_it++)))
|
||||
{
|
||||
@ -73,7 +73,7 @@ partition_info *partition_info::get_clone(THD *thd)
|
||||
mem_alloc_error(sizeof(partition_element));
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
memcpy(subpart_clone, subpart, sizeof(partition_element));
|
||||
*subpart_clone= *subpart;
|
||||
part_clone->subpartitions.push_back(subpart_clone, mem_root);
|
||||
}
|
||||
clone->partitions.push_back(part_clone, mem_root);
|
||||
@ -1897,12 +1897,11 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
|
||||
TABLE_LIST table_list;
|
||||
THD *thd= current_thd;
|
||||
|
||||
bzero(&table_list, sizeof(table_list));
|
||||
table_list.reset();
|
||||
table_list.db= table_arg->s->db.str;
|
||||
table_list.table_name= table_arg->s->table_name.str;
|
||||
|
||||
if (check_single_table_access(thd,
|
||||
SELECT_ACL, &table_list, TRUE))
|
||||
if (check_single_table_access(thd, SELECT_ACL, &table_list, TRUE))
|
||||
{
|
||||
my_message(ER_NO_PARTITION_FOR_GIVEN_VALUE,
|
||||
ER_THD(thd, ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), errflag);
|
||||
|
@ -69,8 +69,6 @@ struct READ_RECORD
|
||||
*/
|
||||
Copy_field *copy_field;
|
||||
Copy_field *copy_field_end;
|
||||
public:
|
||||
READ_RECORD() {}
|
||||
};
|
||||
|
||||
bool init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
|
||||
|
@ -8538,11 +8538,13 @@ static int open_grant_tables(THD *thd, TABLE_LIST *tables,
|
||||
}
|
||||
|
||||
int prev= -1;
|
||||
bzero(tables, sizeof(TABLE_LIST) * TABLES_MAX);
|
||||
for (int cur=TABLES_MAX-1, mask= 1 << cur; mask; cur--, mask >>= 1)
|
||||
{
|
||||
if ((tables_to_open & mask) == 0)
|
||||
{
|
||||
tables[cur].table= NULL;
|
||||
continue;
|
||||
}
|
||||
tables[cur].init_one_table(C_STRING_WITH_LEN("mysql"),
|
||||
acl_table_names[cur].str,
|
||||
acl_table_names[cur].length,
|
||||
|
@ -233,7 +233,7 @@ bool Sql_cmd_alter_table::execute(THD *thd)
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
|
||||
/* If it is a merge table, check privileges for merge children. */
|
||||
if (create_info.merge_list.first)
|
||||
if (create_info.merge_list)
|
||||
{
|
||||
/*
|
||||
The user must have (SELECT_ACL | UPDATE_ACL | DELETE_ACL) on the
|
||||
@ -271,7 +271,7 @@ bool Sql_cmd_alter_table::execute(THD *thd)
|
||||
*/
|
||||
|
||||
if (check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
|
||||
create_info.merge_list.first, FALSE, UINT_MAX, FALSE))
|
||||
create_info.merge_list, FALSE, UINT_MAX, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
@ -282,9 +282,9 @@ bool Sql_cmd_alter_table::execute(THD *thd)
|
||||
{
|
||||
// Rename of table
|
||||
TABLE_LIST tmp_table;
|
||||
memset(&tmp_table, 0, sizeof(tmp_table));
|
||||
tmp_table.table_name= lex->name.str;
|
||||
tmp_table.db= select_lex->db;
|
||||
tmp_table.init_one_table(select_lex->db, strlen(select_lex->db),
|
||||
lex->name.str, lex->name.length,
|
||||
lex->name.str, TL_IGNORE);
|
||||
tmp_table.grant.privilege= priv;
|
||||
if (check_grant(thd, INSERT_ACL | CREATE_ACL, &tmp_table, FALSE,
|
||||
UINT_MAX, FALSE))
|
||||
|
@ -298,9 +298,9 @@ bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num)
|
||||
} // get_ev_num_info
|
||||
|
||||
|
||||
void free_string(String *s)
|
||||
void free_string(void* str, TREE_FREE, void*)
|
||||
{
|
||||
s->free();
|
||||
((String*)str)->free();
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)),
|
||||
int compare_decimal2(int* len, const char *s, const char *t);
|
||||
Procedure *proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
||||
List<Item> &field_list);
|
||||
void free_string(String*);
|
||||
void free_string(void* str, TREE_FREE, void*);
|
||||
class analyse;
|
||||
|
||||
class field_info :public Sql_alloc
|
||||
@ -121,8 +121,7 @@ public:
|
||||
must_be_blob(0), was_zero_fill(0),
|
||||
was_maybe_zerofill(0), can_be_still_num(1)
|
||||
{ init_tree(&tree, 0, 0, sizeof(String), (qsort_cmp2) sortcmp2,
|
||||
(tree_element_free) free_string, NULL,
|
||||
MYF(MY_THREAD_SPECIFIC)); };
|
||||
free_string, NULL, MYF(MY_THREAD_SPECIFIC)); };
|
||||
|
||||
void add();
|
||||
void get_opt_type(String*, ha_rows);
|
||||
|
@ -359,8 +359,6 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen)
|
||||
sql_handler->reset();
|
||||
}
|
||||
sql_handler->table= table;
|
||||
memcpy(&sql_handler->mdl_request, &tables->mdl_request,
|
||||
sizeof(tables->mdl_request));
|
||||
|
||||
if (!(sql_handler->lock= get_lock_data(thd, &sql_handler->table, 1,
|
||||
GET_LOCK_STORE_LOCKS)))
|
||||
@ -374,6 +372,8 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen)
|
||||
if (error)
|
||||
goto err;
|
||||
|
||||
sql_handler->mdl_request.move_from(tables->mdl_request);
|
||||
|
||||
/* Always read all columns */
|
||||
table->read_set= &table->s->all_set;
|
||||
if (table->vcol_set)
|
||||
@ -403,9 +403,6 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen)
|
||||
*/
|
||||
table->open_by_handler= 1;
|
||||
|
||||
/* Safety, cleanup the pointer to satisfy MDL assertions. */
|
||||
tables->mdl_request.ticket= NULL;
|
||||
|
||||
if (! reopen)
|
||||
my_ok(thd);
|
||||
DBUG_PRINT("exit",("OK"));
|
||||
|
@ -4319,14 +4319,12 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
|
||||
DBUG_ASSERT(thd->is_current_stmt_binlog_format_row());
|
||||
DBUG_ASSERT(tables && *tables && count > 0);
|
||||
|
||||
char buf[2048];
|
||||
String query(buf, sizeof(buf), system_charset_info);
|
||||
StringBuffer<2048> query(system_charset_info);
|
||||
int result;
|
||||
TABLE_LIST tmp_table_list;
|
||||
|
||||
memset(&tmp_table_list, 0, sizeof(tmp_table_list));
|
||||
tmp_table_list.reset();
|
||||
tmp_table_list.table = *tables;
|
||||
query.length(0); // Have to zero it since constructor doesn't
|
||||
|
||||
result= show_create_table(thd, &tmp_table_list, &query,
|
||||
create_info, WITH_DB_NAME);
|
||||
|
@ -8948,7 +8948,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
|
||||
goto err;
|
||||
|
||||
/* If it is a merge table, check privileges for merge children. */
|
||||
if (lex->create_info.merge_list.first)
|
||||
if (lex->create_info.merge_list)
|
||||
{
|
||||
/*
|
||||
The user must have (SELECT_ACL | UPDATE_ACL | DELETE_ACL) on the
|
||||
@ -8986,8 +8986,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
|
||||
*/
|
||||
|
||||
if (check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
|
||||
lex->create_info.merge_list.first,
|
||||
FALSE, UINT_MAX, FALSE))
|
||||
lex->create_info.merge_list, FALSE, UINT_MAX, FALSE))
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -2329,7 +2329,7 @@ void JOIN::restore_tmp()
|
||||
{
|
||||
DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join));
|
||||
DBUG_ASSERT(tmp_join != this);
|
||||
memcpy(tmp_join, this, (size_t) sizeof(JOIN));
|
||||
memcpy((void*)tmp_join, this, (size_t) sizeof(JOIN));
|
||||
}
|
||||
|
||||
|
||||
@ -3610,7 +3610,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
|
||||
DBUG_RETURN(1);
|
||||
|
||||
/* The following should be optimized to only clear critical things */
|
||||
bzero(stat, sizeof(JOIN_TAB)* table_count);
|
||||
bzero((void*)stat, sizeof(JOIN_TAB)* table_count);
|
||||
/* Initialize POSITION objects */
|
||||
for (i=0 ; i <= table_count ; i++)
|
||||
(void) new ((char*) (join->positions + i)) POSITION;
|
||||
@ -8758,7 +8758,7 @@ get_best_combination(JOIN *join)
|
||||
1. Put into main join order a JOIN_TAB that represents a lookup or scan
|
||||
in the temptable.
|
||||
*/
|
||||
bzero(j, sizeof(JOIN_TAB));
|
||||
bzero((void*)j, sizeof(JOIN_TAB));
|
||||
j->join= join;
|
||||
j->table= NULL; //temporary way to tell SJM tables from others.
|
||||
j->ref.key = -1;
|
||||
@ -9360,7 +9360,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table)
|
||||
row_limit= unit->select_limit_cnt;
|
||||
do_send_rows= row_limit ? 1 : 0;
|
||||
|
||||
bzero(join_tab, sizeof(JOIN_TAB));
|
||||
bzero((void*)join_tab, sizeof(JOIN_TAB));
|
||||
join_tab->table=temp_table;
|
||||
join_tab->set_select_cond(NULL, __LINE__);
|
||||
join_tab->type= JT_ALL; /* Map through all records */
|
||||
@ -17275,11 +17275,11 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list)
|
||||
NullS))
|
||||
return 0;
|
||||
|
||||
bzero(table, sizeof(*table));
|
||||
bzero(share, sizeof(*share));
|
||||
table->reset();
|
||||
table->field= field;
|
||||
table->s= share;
|
||||
table->temp_pool_slot= MY_BIT_NONE;
|
||||
share->reset();
|
||||
share->blob_field= blob_field;
|
||||
share->fields= field_count;
|
||||
setup_tmp_table_column_bitmaps(table, bitmaps);
|
||||
|
@ -199,7 +199,6 @@ class SJ_TMP_TABLE;
|
||||
class JOIN_TAB_RANGE;
|
||||
|
||||
typedef struct st_join_table {
|
||||
st_join_table() {} /* Remove gcc warning */
|
||||
TABLE *table;
|
||||
KEYUSE *keyuse; /**< pointer to first used key */
|
||||
KEY *hj_key; /**< descriptor of the used best hash join key
|
||||
|
@ -6266,7 +6266,7 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
|
||||
{
|
||||
TABLE_LIST table_list;
|
||||
uint view_access;
|
||||
memset(&table_list, 0, sizeof(table_list));
|
||||
table_list.reset();
|
||||
table_list.db= tables->db;
|
||||
table_list.table_name= tables->table_name;
|
||||
table_list.grant.privilege= thd->col_access;
|
||||
|
@ -1818,7 +1818,7 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, char *db, char *name)
|
||||
bool result= 0;
|
||||
DBUG_ENTER("drop_all_triggers");
|
||||
|
||||
bzero(&table, sizeof(table));
|
||||
table.reset();
|
||||
init_sql_alloc(&table.mem_root, 8192, 0, MYF(0));
|
||||
|
||||
if (Table_triggers_list::check_n_load(thd, db, name, &table, 1))
|
||||
@ -2038,7 +2038,7 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
|
||||
LEX_STRING *err_trigname;
|
||||
DBUG_ENTER("change_table_name");
|
||||
|
||||
bzero(&table, sizeof(table));
|
||||
table.reset();
|
||||
init_sql_alloc(&table.mem_root, 8192, 0, MYF(0));
|
||||
|
||||
/*
|
||||
|
@ -214,7 +214,8 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
|
||||
LEX *lex= thd->lex;
|
||||
TABLE_LIST decoy;
|
||||
|
||||
memcpy (&decoy, view, sizeof (TABLE_LIST));
|
||||
decoy= *view;
|
||||
decoy.mdl_request.key.mdl_key_init(&view->mdl_request.key);
|
||||
if (tdc_open_view(thd, &decoy, decoy.alias, OPEN_VIEW_NO_PARSE))
|
||||
return TRUE;
|
||||
|
||||
@ -2133,7 +2134,7 @@ mysql_rename_view(THD *thd,
|
||||
view definition parsing or use temporary 'view_def'
|
||||
object for it.
|
||||
*/
|
||||
bzero(&view_def, sizeof(view_def));
|
||||
view_def.reset();
|
||||
view_def.timestamp.str= view_def.timestamp_buffer;
|
||||
view_def.view_suid= TRUE;
|
||||
|
||||
|
@ -5671,7 +5671,7 @@ create_table_option:
|
||||
from the global list.
|
||||
*/
|
||||
LEX *lex=Lex;
|
||||
lex->create_info.merge_list= lex->select_lex.table_list;
|
||||
lex->create_info.merge_list= lex->select_lex.table_list.first;
|
||||
lex->select_lex.table_list= lex->save_list;
|
||||
/*
|
||||
When excluding union list from the global list we assume that
|
||||
@ -5680,7 +5680,7 @@ create_table_option:
|
||||
*/
|
||||
TABLE_LIST *last_non_sel_table= lex->create_last_non_select_table;
|
||||
DBUG_ASSERT(last_non_sel_table->next_global ==
|
||||
lex->create_info.merge_list.first);
|
||||
lex->create_info.merge_list);
|
||||
last_non_sel_table->next_global= 0;
|
||||
Lex->query_tables_last= &last_non_sel_table->next_global;
|
||||
|
||||
|
15
sql/table.h
15
sql/table.h
@ -789,6 +789,8 @@ struct TABLE_SHARE
|
||||
/** Instrumentation for this table share. */
|
||||
PSI_table_share *m_psi;
|
||||
|
||||
inline void reset() { bzero((void*)this, sizeof(*this)); }
|
||||
|
||||
/*
|
||||
Set share's table cache key and update its db and table name appropriately.
|
||||
|
||||
@ -1337,6 +1339,7 @@ public:
|
||||
bool histograms_are_read;
|
||||
MDL_ticket *mdl_ticket;
|
||||
|
||||
inline void reset() { bzero((void*)this, sizeof(*this)); }
|
||||
void init(THD *thd, TABLE_LIST *tl);
|
||||
bool fill_item_list(List<Item> *item_list) const;
|
||||
void reset_item_list(List<Item> *item_list) const;
|
||||
@ -1763,6 +1766,7 @@ struct TABLE_LIST
|
||||
Prepare TABLE_LIST that consists of one table instance to use in
|
||||
open_and_lock_tables
|
||||
*/
|
||||
inline void reset() { bzero((void*)this, sizeof(*this)); }
|
||||
inline void init_one_table(const char *db_name_arg,
|
||||
size_t db_length_arg,
|
||||
const char *table_name_arg,
|
||||
@ -1778,7 +1782,7 @@ struct TABLE_LIST
|
||||
else
|
||||
mdl_type= MDL_SHARED_READ;
|
||||
|
||||
bzero((char*) this, sizeof(*this));
|
||||
reset();
|
||||
db= (char*) db_name_arg;
|
||||
db_length= db_length_arg;
|
||||
table_name= (char*) table_name_arg;
|
||||
@ -2272,8 +2276,7 @@ struct TABLE_LIST
|
||||
|
||||
@sa check_and_update_table_version()
|
||||
*/
|
||||
inline
|
||||
bool is_table_ref_id_equal(TABLE_SHARE *s) const
|
||||
inline bool is_table_ref_id_equal(TABLE_SHARE *s) const
|
||||
{
|
||||
return (m_table_ref_type == s->get_table_ref_type() &&
|
||||
m_table_ref_version == s->get_table_ref_version());
|
||||
@ -2285,12 +2288,10 @@ struct TABLE_LIST
|
||||
|
||||
@sa check_and_update_table_version()
|
||||
*/
|
||||
inline
|
||||
void set_table_ref_id(TABLE_SHARE *s)
|
||||
inline void set_table_ref_id(TABLE_SHARE *s)
|
||||
{ set_table_ref_id(s->get_table_ref_type(), s->get_table_ref_version()); }
|
||||
|
||||
inline
|
||||
void set_table_ref_id(enum_table_ref_type table_ref_type_arg,
|
||||
inline void set_table_ref_id(enum_table_ref_type table_ref_type_arg,
|
||||
ulong table_ref_version_arg)
|
||||
{
|
||||
m_table_ref_type= table_ref_type_arg;
|
||||
|
@ -1537,16 +1537,11 @@ my_offset_tzs_get_key(Time_zone_offset *entry,
|
||||
static void
|
||||
tz_init_table_list(TABLE_LIST *tz_tabs)
|
||||
{
|
||||
bzero(tz_tabs, sizeof(TABLE_LIST) * MY_TZ_TABLES_COUNT);
|
||||
|
||||
for (int i= 0; i < MY_TZ_TABLES_COUNT; i++)
|
||||
{
|
||||
tz_tabs[i].alias= tz_tabs[i].table_name= tz_tables_names[i].str;
|
||||
tz_tabs[i].table_name_length= tz_tables_names[i].length;
|
||||
tz_tabs[i].db= tz_tables_db_name.str;
|
||||
tz_tabs[i].db_length= tz_tables_db_name.length;
|
||||
tz_tabs[i].lock_type= TL_READ;
|
||||
|
||||
tz_tabs[i].init_one_table(tz_tables_db_name.str, tz_tables_db_name.length,
|
||||
tz_tables_names[i].str, tz_tables_names[i].length,
|
||||
NULL, TL_READ);
|
||||
if (i != MY_TZ_TABLES_COUNT - 1)
|
||||
tz_tabs[i].next_global= tz_tabs[i].next_local= &tz_tabs[i+1];
|
||||
if (i != 0)
|
||||
|
@ -526,7 +526,7 @@ BOOL PlugSubSet(void *memp, uint size)
|
||||
/***********************************************************************/
|
||||
/* Use it to export a function that do throwing. */
|
||||
/***********************************************************************/
|
||||
void *DoThrow(int n)
|
||||
static void *DoThrow(int n)
|
||||
{
|
||||
throw n;
|
||||
} /* end of DoThrow */
|
||||
|
@ -84,6 +84,8 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEB
|
||||
|
||||
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
|
||||
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-class-memaccess")
|
||||
|
||||
IF(NOT MSVC)
|
||||
|
||||
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
|
||||
|
@ -1675,14 +1675,15 @@ static int keys_compare(bulk_insert_param *param, uchar *key1, uchar *key2)
|
||||
}
|
||||
|
||||
|
||||
static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param)
|
||||
static void keys_free(void* key_arg, TREE_FREE mode, void *param_arg)
|
||||
{
|
||||
/*
|
||||
Probably I can use info->lastkey here, but I'm not sure,
|
||||
and to be safe I'd better use local lastkey.
|
||||
*/
|
||||
bulk_insert_param *param= (bulk_insert_param*)param_arg;
|
||||
MARIA_SHARE *share= param->info->s;
|
||||
uchar lastkey[MARIA_MAX_KEY_BUFF];
|
||||
uchar lastkey[MARIA_MAX_KEY_BUFF], *key= (uchar*)key_arg;
|
||||
uint keylen;
|
||||
MARIA_KEYDEF *keyinfo= share->keyinfo + param->keynr;
|
||||
MARIA_KEY tmp_key;
|
||||
@ -1694,7 +1695,7 @@ static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param)
|
||||
mysql_rwlock_wrlock(&keyinfo->root_lock);
|
||||
keyinfo->version++;
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
case free_free:
|
||||
/* Note: keylen doesn't contain transid lengths */
|
||||
keylen= _ma_keylength(keyinfo, key);
|
||||
@ -1709,13 +1710,14 @@ static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param)
|
||||
copying middle key up if tree is growing
|
||||
*/
|
||||
memcpy(lastkey, key, tmp_key.data_length + tmp_key.ref_length);
|
||||
return _ma_ck_write_btree(param->info, &tmp_key);
|
||||
_ma_ck_write_btree(param->info, &tmp_key);
|
||||
return;
|
||||
case free_end:
|
||||
if (share->lock_key_trees)
|
||||
mysql_rwlock_unlock(&keyinfo->root_lock);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1771,8 +1773,7 @@ int maria_init_bulk_insert(MARIA_HA *info, size_t cache_size, ha_rows rows)
|
||||
init_tree(&info->bulk_insert[i],
|
||||
cache_size * key[i].maxlength,
|
||||
cache_size * key[i].maxlength, 0,
|
||||
(qsort_cmp2)keys_compare,
|
||||
(tree_element_free) keys_free, (void *)params++, MYF(0));
|
||||
(qsort_cmp2) keys_compare, keys_free, (void *)params++, MYF(0));
|
||||
}
|
||||
else
|
||||
info->bulk_insert[i].root=0;
|
||||
|
@ -2982,9 +2982,9 @@ int ha_mroonga::create_share_for_create() const
|
||||
TABLE_LIST *table_list = MRN_LEX_GET_TABLE_LIST(lex);
|
||||
MRN_DBUG_ENTER_METHOD();
|
||||
wrap_handler_for_create = NULL;
|
||||
memset(&table_for_create, 0, sizeof(TABLE));
|
||||
table_for_create.reset();
|
||||
table_share_for_create.reset();
|
||||
memset(&share_for_create, 0, sizeof(MRN_SHARE));
|
||||
memset(&table_share_for_create, 0, sizeof(TABLE_SHARE));
|
||||
if (table_share) {
|
||||
table_share_for_create.comment = table_share->comment;
|
||||
table_share_for_create.connect_string = table_share->connect_string;
|
||||
@ -14535,8 +14535,8 @@ enum_alter_inplace_result ha_mroonga::wrapper_check_if_supported_inplace_alter(
|
||||
) {
|
||||
DBUG_RETURN(HA_ALTER_ERROR);
|
||||
}
|
||||
memcpy(wrap_altered_table, altered_table, sizeof(TABLE));
|
||||
memcpy(wrap_altered_table_share, altered_table->s, sizeof(TABLE_SHARE));
|
||||
*wrap_altered_table= *altered_table;
|
||||
*wrap_altered_table_share= *altered_table->s;
|
||||
mrn_init_sql_alloc(ha_thd(), &(wrap_altered_table_share->mem_root));
|
||||
|
||||
n_keys = ha_alter_info->index_drop_count;
|
||||
|
@ -929,13 +929,14 @@ static int keys_compare(bulk_insert_param *param, uchar *key1, uchar *key2)
|
||||
}
|
||||
|
||||
|
||||
static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param)
|
||||
static void keys_free(void* key_arg, TREE_FREE mode, void *param_arg)
|
||||
{
|
||||
/*
|
||||
Probably I can use info->lastkey here, but I'm not sure,
|
||||
and to be safe I'd better use local lastkey.
|
||||
*/
|
||||
uchar lastkey[HA_MAX_KEY_BUFF];
|
||||
bulk_insert_param *param= (bulk_insert_param*)param_arg;
|
||||
uchar lastkey[HA_MAX_KEY_BUFF], *key= (uchar*)key_arg;
|
||||
uint keylen;
|
||||
MI_KEYDEF *keyinfo;
|
||||
|
||||
@ -946,19 +947,20 @@ static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param)
|
||||
mysql_rwlock_wrlock(¶m->info->s->key_root_lock[param->keynr]);
|
||||
param->info->s->keyinfo[param->keynr].version++;
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
case free_free:
|
||||
keyinfo=param->info->s->keyinfo+param->keynr;
|
||||
keylen=_mi_keylength(keyinfo, key);
|
||||
memcpy(lastkey, key, keylen);
|
||||
return _mi_ck_write_btree(param->info,param->keynr,lastkey,
|
||||
keylen - param->info->s->rec_reflength);
|
||||
_mi_ck_write_btree(param->info, param->keynr, lastkey,
|
||||
keylen - param->info->s->rec_reflength);
|
||||
return;
|
||||
case free_end:
|
||||
if (param->info->s->concurrent_insert)
|
||||
mysql_rwlock_unlock(¶m->info->s->key_root_lock[param->keynr]);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1014,8 +1016,7 @@ int mi_init_bulk_insert(MI_INFO *info, size_t cache_size, ha_rows rows)
|
||||
init_tree(&info->bulk_insert[i],
|
||||
cache_size * key[i].maxlength,
|
||||
cache_size * key[i].maxlength, 0,
|
||||
(qsort_cmp2)keys_compare,
|
||||
(tree_element_free) keys_free, (void *)params++, MYF(0));
|
||||
(qsort_cmp2)keys_compare, keys_free, (void *)params++, MYF(0));
|
||||
}
|
||||
else
|
||||
info->bulk_insert[i].root=0;
|
||||
|
@ -63,7 +63,7 @@ static int test_if_open(struct file_info *key,element_count count,
|
||||
static void fix_blob_pointers(MI_INFO *isam,uchar *record);
|
||||
static int test_when_accessed(struct file_info *key,element_count count,
|
||||
struct st_access_param *access_param);
|
||||
static void file_info_free(struct file_info *info);
|
||||
static void file_info_free(void*, TREE_FREE, void *);
|
||||
static int close_some_file(TREE *tree);
|
||||
static int reopen_closed_file(TREE *tree,struct file_info *file_info);
|
||||
static int find_record_with_key(struct file_info *file_info,uchar *record);
|
||||
@ -330,8 +330,7 @@ static int examine_log(char * file_name, char **table_names)
|
||||
init_io_cache(&cache,file,0,READ_CACHE,start_offset,0,MYF(0));
|
||||
bzero((uchar*) com_count,sizeof(com_count));
|
||||
init_tree(&tree,0,0,sizeof(file_info),(qsort_cmp2) file_info_compare,
|
||||
(tree_element_free) file_info_free, NULL,
|
||||
MYF(MY_TREE_WITH_DELETE));
|
||||
file_info_free, NULL, MYF(MY_TREE_WITH_DELETE));
|
||||
(void) init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,KEY_CACHE_SIZE,
|
||||
0, 0, 0, 0);
|
||||
|
||||
@ -751,8 +750,9 @@ static int test_when_accessed (struct file_info *key,
|
||||
}
|
||||
|
||||
|
||||
static void file_info_free(struct file_info *fileinfo)
|
||||
static void file_info_free(void* arg, TREE_FREE mode, void *unused)
|
||||
{
|
||||
struct file_info *fileinfo= arg;
|
||||
DBUG_ENTER("file_info_free");
|
||||
if (update)
|
||||
{
|
||||
|
@ -1466,49 +1466,41 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
|
||||
|
||||
if (!(create_info->used_fields & HA_CREATE_USED_UNION))
|
||||
{
|
||||
TABLE_LIST *child_table;
|
||||
THD *thd=current_thd;
|
||||
|
||||
create_info->merge_list.next= &create_info->merge_list.first;
|
||||
create_info->merge_list.elements=0;
|
||||
TABLE_LIST *child_table, *end= NULL;
|
||||
THD *thd=ha_thd();
|
||||
|
||||
if (children_l != NULL)
|
||||
{
|
||||
for (child_table= children_l;;
|
||||
child_table= child_table->next_global)
|
||||
for (child_table= children_l;; child_table= child_table->next_global)
|
||||
{
|
||||
TABLE_LIST *ptr;
|
||||
|
||||
if (!(ptr= (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
|
||||
goto err;
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
if (!(ptr->table_name= thd->strmake(child_table->table_name,
|
||||
child_table->table_name_length)))
|
||||
goto err;
|
||||
if (child_table->db && !(ptr->db= thd->strmake(child_table->db,
|
||||
child_table->db_length)))
|
||||
goto err;
|
||||
DBUG_VOID_RETURN;
|
||||
if (child_table->db &&
|
||||
!(ptr->db= thd->strmake(child_table->db, child_table->db_length)))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
create_info->merge_list.elements++;
|
||||
(*create_info->merge_list.next)= ptr;
|
||||
create_info->merge_list.next= &ptr->next_local;
|
||||
if (create_info->merge_list)
|
||||
end->next_local= ptr;
|
||||
else
|
||||
create_info->merge_list= ptr;
|
||||
end= ptr;
|
||||
|
||||
if (&child_table->next_global == children_last_l)
|
||||
break;
|
||||
}
|
||||
}
|
||||
*create_info->merge_list.next=0;
|
||||
}
|
||||
if (!(create_info->used_fields & HA_CREATE_USED_INSERT_METHOD))
|
||||
{
|
||||
create_info->merge_insert_method = file->merge_insert_method;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
err:
|
||||
create_info->merge_list.elements=0;
|
||||
create_info->merge_list.first=0;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
@ -1516,18 +1508,21 @@ int ha_myisammrg::create_mrg(const char *name, HA_CREATE_INFO *create_info)
|
||||
{
|
||||
char buff[FN_REFLEN];
|
||||
const char **table_names, **pos;
|
||||
TABLE_LIST *tables= create_info->merge_list.first;
|
||||
THD *thd= current_thd;
|
||||
TABLE_LIST *tables= create_info->merge_list;
|
||||
THD *thd= ha_thd();
|
||||
size_t dirlgt= dirname_length(name);
|
||||
uint ntables= 0;
|
||||
DBUG_ENTER("ha_myisammrg::create_mrg");
|
||||
|
||||
for (tables= create_info->merge_list; tables; tables= tables->next_local)
|
||||
ntables++;
|
||||
|
||||
/* Allocate a table_names array in thread mem_root. */
|
||||
if (!(table_names= (const char**)
|
||||
thd->alloc((create_info->merge_list.elements+1) * sizeof(char*))))
|
||||
if (!(pos= table_names= (const char**) thd->alloc((ntables + 1) * sizeof(char*))))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */
|
||||
|
||||
/* Create child path names. */
|
||||
for (pos= table_names; tables; tables= tables->next_local)
|
||||
for (tables= create_info->merge_list; tables; tables= tables->next_local)
|
||||
{
|
||||
const char *table_name= buff;
|
||||
|
||||
|
@ -348,7 +348,9 @@ static int discover_table_existence(handlerton *hton, const char *db,
|
||||
return !parse_table_name(table_name, strlen(table_name), &from, &to, &step);
|
||||
}
|
||||
|
||||
static int dummy_ret_int() { return 0; }
|
||||
static int dummy_commit_rollback(handlerton *, THD *, bool) { return 0; }
|
||||
|
||||
static int dummy_savepoint(handlerton *, THD *, void *) { return 0; }
|
||||
|
||||
/*****************************************************************************
|
||||
Example of a simple group by handler for queries like:
|
||||
@ -487,10 +489,9 @@ static int init(void *p)
|
||||
hton->create= create_handler;
|
||||
hton->discover_table= discover_table;
|
||||
hton->discover_table_existence= discover_table_existence;
|
||||
hton->commit= hton->rollback=
|
||||
(int (*)(handlerton *, THD *, bool)) &dummy_ret_int;
|
||||
hton->commit= hton->rollback= dummy_commit_rollback;
|
||||
hton->savepoint_set= hton->savepoint_rollback= hton->savepoint_release=
|
||||
(int (*)(handlerton *, THD *, void *)) &dummy_ret_int;
|
||||
dummy_savepoint;
|
||||
hton->create_group_by= create_group_by_handler;
|
||||
return 0;
|
||||
}
|
||||
|
@ -89,6 +89,8 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEB
|
||||
|
||||
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
|
||||
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-class-memaccess")
|
||||
|
||||
IF(NOT MSVC)
|
||||
|
||||
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
|
||||
|
@ -49,6 +49,12 @@ uint encryption_key_get_func(uint, uint, uchar* key, uint* size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint encryption_ctx_size_func(unsigned int, unsigned int)
|
||||
{
|
||||
return MY_AES_CTX_SIZE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_EncryptAes128Gcm
|
||||
enum my_aes_mode aes_mode= MY_AES_GCM;
|
||||
#else
|
||||
@ -72,7 +78,7 @@ struct encryption_service_st encryption_handler=
|
||||
{
|
||||
encryption_key_get_latest_version_func,
|
||||
encryption_key_get_func,
|
||||
(uint (*)(unsigned int, unsigned int))my_aes_ctx_size,
|
||||
encryption_ctx_size_func,
|
||||
encryption_ctx_init_func,
|
||||
my_aes_crypt_update,
|
||||
my_aes_crypt_finish,
|
||||
|
Loading…
x
Reference in New Issue
Block a user