mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merge
myisam/mi_check.c: Auto merged sql/mysqld.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/table.h: Auto merged
This commit is contained in:
@ -30,6 +30,7 @@
|
||||
#include <hash.h>
|
||||
#include <ft_global.h>
|
||||
#include <assert.h>
|
||||
#include <my_bitmap.h>
|
||||
|
||||
const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
|
||||
"MAYBE_REF","ALL","range","index","fulltext" };
|
||||
@ -3287,14 +3288,28 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
KEY_PART_INFO *key_part_info;
|
||||
Item_result_field **copy_func;
|
||||
MI_COLUMNDEF *recinfo;
|
||||
uint temp_pool_slot;
|
||||
|
||||
DBUG_ENTER("create_tmp_table");
|
||||
DBUG_PRINT("enter",("distinct: %d save_sum_fields: %d allow_distinct_limit: %d group: %d",
|
||||
(int) distinct, (int) save_sum_fields,
|
||||
(int) allow_distinct_limit,test(group)));
|
||||
|
||||
statistic_increment(created_tmp_tables, &LOCK_status);
|
||||
sprintf(path,"%s%s%lx_%lx_%x",mysql_tmpdir,tmp_file_prefix,current_pid,
|
||||
thd->thread_id, thd->tmp_table++);
|
||||
|
||||
if(use_temp_pool) {
|
||||
temp_pool_slot = bitmap_set_next(temp_pool, TEMP_POOL_SIZE);
|
||||
if(temp_pool_slot != MY_BIT_NONE) // we got a slot
|
||||
sprintf(path, "%s%s_%lx_%i", mysql_tmpdir, tmp_file_prefix,
|
||||
current_pid, temp_pool_slot);
|
||||
else // if we run out of slots in the pool, fall back to old behavior
|
||||
sprintf(path,"%s%s%lx_%lx_%x",mysql_tmpdir,tmp_file_prefix,current_pid,
|
||||
thd->thread_id, thd->tmp_table++);
|
||||
} else {
|
||||
sprintf(path,"%s%s%lx_%lx_%x",mysql_tmpdir,tmp_file_prefix,current_pid,
|
||||
thd->thread_id, thd->tmp_table++);
|
||||
};
|
||||
|
||||
if (group)
|
||||
{
|
||||
if (!param->quick_group)
|
||||
@ -3324,10 +3339,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
param->group_length : 0,
|
||||
NullS))
|
||||
{
|
||||
bitmap_clear_bit(temp_pool, TEMP_POOL_SIZE, temp_pool_slot);
|
||||
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||
}
|
||||
if (!(param->copy_field=copy=new Copy_field[field_count]))
|
||||
{
|
||||
bitmap_clear_bit(temp_pool, TEMP_POOL_SIZE, temp_pool_slot);
|
||||
my_free((gptr) table,MYF(0)); /* purecov: inspected */
|
||||
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||
}
|
||||
@ -3347,6 +3364,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
table->map=1;
|
||||
table->tmp_table=1;
|
||||
table->db_low_byte_first=1; // True for HEAP and MyISAM
|
||||
table->temp_pool_slot = temp_pool_slot;
|
||||
|
||||
|
||||
/* Calculate which type of fields we will store in the temporary table */
|
||||
|
||||
@ -3670,7 +3689,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
DBUG_RETURN(table);
|
||||
|
||||
err:
|
||||
free_tmp_table(thd,table); /* purecov: inspected */
|
||||
free_tmp_table(thd,table); /* purecov: inspected */
|
||||
bitmap_clear_bit(temp_pool, TEMP_POOL_SIZE, temp_pool_slot);
|
||||
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||
}
|
||||
|
||||
@ -3817,6 +3837,9 @@ free_tmp_table(THD *thd, TABLE *entry)
|
||||
delete *ptr;
|
||||
my_free((gptr) entry->record[0],MYF(0));
|
||||
free_io_cache(entry);
|
||||
|
||||
bitmap_clear_bit(temp_pool, TEMP_POOL_SIZE, entry->temp_pool_slot);
|
||||
|
||||
my_free((gptr) entry,MYF(0));
|
||||
thd->proc_info=save_proc_info;
|
||||
|
||||
|
Reference in New Issue
Block a user