summaryrefslogtreecommitdiff
path: root/storage/myisammrg
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-03-17 13:06:41 +0100
committerSergei Golubchik <serg@mariadb.org>2019-03-17 13:06:41 +0100
commitb64fde8f38515dc39e019de26db7624cc0ea7046 (patch)
tree0478ea4c3ddeee290f6d381a47efa4f9aded9c0b /storage/myisammrg
parenta89ee3cd154a67df2231f034fd8339f9225dbe64 (diff)
parent1f020299f816263e347c852eb2a494b5ef1cbf0d (diff)
downloadmariadb-git-b64fde8f38515dc39e019de26db7624cc0ea7046.tar.gz
Merge branch '10.2' into 10.3
Diffstat (limited to 'storage/myisammrg')
-rw-r--r--storage/myisammrg/ha_myisammrg.cc43
1 files changed, 19 insertions, 24 deletions
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 18860b31839..10d1de0fb7e 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -1467,51 +1467,43 @@ 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.str= thd->strmake(child_table->table_name.str,
child_table->table_name.length)))
- goto err;
+ DBUG_VOID_RETURN;
ptr->table_name.length= child_table->table_name.length;
if (child_table->db.str && !(ptr->db.str= thd->strmake(child_table->db.str,
child_table->db.length)))
- goto err;
+ DBUG_VOID_RETURN;
ptr->db.length= child_table->db.length;
- 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;
}
@@ -1519,18 +1511,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;