summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2006-11-29 23:07:15 +0200
committerunknown <monty@narttu.mysql.fi>2006-11-29 23:07:15 +0200
commitc0c013e5b75b88081b6a8a693a777aaf6a574a66 (patch)
tree0db898dfb17cf8ad28801621ce4c81f19c7e9cc9 /sql
parent6bcbd7df1e3402fbc8b6730868115a2bb253f7a7 (diff)
parent42fd48da99b2ba2641697ebb567af555fb270e9e (diff)
downloadmariadb-git-c0c013e5b75b88081b6a8a693a777aaf6a574a66.tar.gz
Merge mysql.com:/home/my/mysql-5.0
into mysql.com:/home/my/mysql-5.1 BitKeeper/etc/ignore: auto-union include/heap.h: Auto merged include/my_pthread.h: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/type_bit.result: Auto merged sql/item_sum.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_select.cc: Auto merged storage/heap/ha_heap.cc: Auto merged mysys/my_thr_init.c: Manual merge sql/mysqld.cc: Manual merge sql/sql_class.h: Manual merge sql/table.cc: Manual merge
Diffstat (limited to 'sql')
-rw-r--r--sql/item_sum.cc4
-rw-r--r--sql/mysqld.cc15
-rw-r--r--sql/set_var.cc4
-rw-r--r--sql/sql_class.h17
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/table.cc1
-rw-r--r--sql/uniques.cc4
7 files changed, 28 insertions, 19 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index ea6a950f07c..dbab465bef2 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -3430,8 +3430,8 @@ bool Item_func_group_concat::setup(THD *thd)
duplicate values (according to the syntax of this function). If there
is no DISTINCT or ORDER BY clauses, we don't create this tree.
*/
- init_tree(tree, min(thd->variables.max_heap_table_size,
- thd->variables.sortbuff_size/16), 0,
+ init_tree(tree, (uint) min(thd->variables.max_heap_table_size,
+ thd->variables.sortbuff_size/16), 0,
tree_key_length, compare_key, 0, NULL, (void*) this);
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index de94c37c27e..b87523eb00c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -68,6 +68,12 @@
#define IF_PURIFY(A,B) (B)
#endif
+#if SIZEOF_CHARP == 4
+#define MAX_MEM_TABLE_SIZE ~(ulong) 0
+#else
+#define MAX_MEM_TABLE_SIZE ~(ulonglong) 0
+#endif
+
/* stack traces are only supported on linux intel */
#if defined(__linux__) && defined(__i386__) && defined(USE_PSTACK)
#define HAVE_STACK_TRACE_ON_SEGV
@@ -5950,8 +5956,9 @@ The minimum value for this variable is 4096.",
{"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
"Don't allow creation of heap tables bigger than this.",
(gptr*) &global_system_variables.max_heap_table_size,
- (gptr*) &max_system_variables.max_heap_table_size, 0, GET_ULONG,
- REQUIRED_ARG, 16*1024*1024L, 16384, ~0L, MALLOC_OVERHEAD, 1024, 0},
+ (gptr*) &max_system_variables.max_heap_table_size, 0, GET_ULL,
+ REQUIRED_ARG, 16*1024*1024L, 16384, MAX_MEM_TABLE_SIZE,
+ MALLOC_OVERHEAD, 1024, 0},
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Joins that are probably going to read more than max_join_size records return an error.",
(gptr*) &global_system_variables.max_join_size,
@@ -6237,8 +6244,8 @@ The minimum value for this variable is 4096.",
{"tmp_table_size", OPT_TMP_TABLE_SIZE,
"If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.",
(gptr*) &global_system_variables.tmp_table_size,
- (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULONG,
- REQUIRED_ARG, 16*1024*1024L, 1024, ~0L, 0, 1, 0}, /* See max_heap_table_size . */
+ (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL,
+ REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
"Allocation block size for transactions to be stored in binary log",
(gptr*) &global_system_variables.trans_alloc_block_size,
diff --git a/sql/set_var.cc b/sql/set_var.cc
index dc78eb2f509..fe1961ee33c 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -299,7 +299,7 @@ sys_var_thd_ulong sys_max_delayed_threads("max_delayed_threads",
fix_max_connections);
sys_var_thd_ulong sys_max_error_count("max_error_count",
&SV::max_error_count);
-sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size",
+sys_var_thd_ulonglong sys_max_heap_table_size("max_heap_table_size",
&SV::max_heap_table_size);
sys_var_thd_ulong sys_pseudo_thread_id("pseudo_thread_id",
&SV::pseudo_thread_id,
@@ -473,7 +473,7 @@ sys_var_thd_enum sys_tx_isolation("tx_isolation",
&tx_isolation_typelib,
fix_tx_isolation,
check_tx_isolation);
-sys_var_thd_ulong sys_tmp_table_size("tmp_table_size",
+sys_var_thd_ulonglong sys_tmp_table_size("tmp_table_size",
&SV::tmp_table_size);
sys_var_bool_ptr sys_timed_mutexes("timed_mutexes",
&timed_mutexes);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 218c56959a3..166b078ce62 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -183,6 +183,8 @@ struct system_variables
{
ulonglong myisam_max_extra_sort_file_size;
ulonglong myisam_max_sort_file_size;
+ ulonglong max_heap_table_size;
+ ulonglong tmp_table_size;
ha_rows select_limit;
ha_rows max_join_size;
ulong auto_increment_increment, auto_increment_offset;
@@ -191,7 +193,6 @@ struct system_variables
ulong long_query_time;
ulong max_allowed_packet;
ulong max_error_count;
- ulong max_heap_table_size;
ulong max_length_for_sort_data;
ulong max_sort_length;
ulong max_tmp_tables;
@@ -215,7 +216,6 @@ struct system_variables
ulong div_precincrement;
ulong sortbuff_size;
handlerton *table_type;
- ulong tmp_table_size;
ulong tx_isolation;
ulong completion_type;
/* Determines which non-standard SQL behaviour should be enabled */
@@ -2060,7 +2060,8 @@ class user_var_entry
class Unique :public Sql_alloc
{
DYNAMIC_ARRAY file_ptrs;
- ulong max_elements, max_in_memory_size;
+ ulong max_elements;
+ ulonglong max_in_memory_size;
IO_CACHE file;
TREE tree;
byte *record_pointers;
@@ -2070,7 +2071,7 @@ class Unique :public Sql_alloc
public:
ulong elements;
Unique(qsort_cmp2 comp_func, void *comp_func_fixed_arg,
- uint size_arg, ulong max_in_memory_size_arg);
+ uint size_arg, ulonglong max_in_memory_size_arg);
~Unique();
ulong elements_in_tree() { return tree.elements_in_tree; }
inline bool unique_add(void *ptr)
@@ -2084,13 +2085,13 @@ public:
bool get(TABLE *table);
static double get_use_cost(uint *buffer, uint nkeys, uint key_size,
- ulong max_in_memory_size);
+ ulonglong max_in_memory_size);
inline static int get_cost_calc_buff_size(ulong nkeys, uint key_size,
- ulong max_in_memory_size)
+ ulonglong max_in_memory_size)
{
- register ulong max_elems_in_tree=
+ register ulonglong max_elems_in_tree=
(1 + max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
- return sizeof(uint)*(1 + nkeys/max_elems_in_tree);
+ return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree));
}
void reset();
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 9a4e93dfb94..84b8866507e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -9518,7 +9518,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
param->recinfo=recinfo;
store_record(table,s->default_values); // Make empty default record
- if (thd->variables.tmp_table_size == ~(ulong) 0) // No limit
+ if (thd->variables.tmp_table_size == ~ (ulonglong) 0) // No limit
share->max_rows= ~(ha_rows) 0;
else
share->max_rows= (((share->db_type == heap_hton) ?
diff --git a/sql/table.cc b/sql/table.cc
index 926b44dedbc..1b25d7861fd 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1078,6 +1078,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
goto err;
}
field= key_part->field= share->field[key_part->fieldnr-1];
+ key_part->type= field->key_type();
if (field->null_ptr)
{
key_part->null_offset=(uint) ((byte*) field->null_ptr -
diff --git a/sql/uniques.cc b/sql/uniques.cc
index ad074f8b2b0..ac603791376 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -55,7 +55,7 @@ int unique_write_to_ptrs(gptr key, element_count count, Unique *unique)
}
Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
- uint size_arg, ulong max_in_memory_size_arg)
+ uint size_arg, ulonglong max_in_memory_size_arg)
:max_in_memory_size(max_in_memory_size_arg), size(size_arg), elements(0)
{
my_b_clear(&file);
@@ -260,7 +260,7 @@ static double get_merge_many_buffs_cost(uint *buffer,
*/
double Unique::get_use_cost(uint *buffer, uint nkeys, uint key_size,
- ulong max_in_memory_size)
+ ulonglong max_in_memory_size)
{
ulong max_elements_in_tree;
ulong last_tree_elems;