diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-03-15 20:00:28 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-03-15 21:00:41 +0100 |
commit | 0508d327aef520d3131ff8a85ed610337149fffc (patch) | |
tree | 7e04769f49b4aded9053adcad442fe00eb487d98 /storage/myisammrg | |
parent | bb8c82c66abddf796e8d44f817518e5ab38ae6e4 (diff) | |
parent | 34db9958e28c325b0f708f78b7ff029de810d5ea (diff) | |
download | mariadb-git-0508d327aef520d3131ff8a85ed610337149fffc.tar.gz |
Merge branch '10.1' into 10.2
Diffstat (limited to 'storage/myisammrg')
-rw-r--r-- | storage/myisammrg/ha_myisammrg.cc | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index cd2ba4c763f..74e741f9b9f 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -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; |