diff options
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 809dd65d52b..93ced79005f 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1045,7 +1045,8 @@ bool Item_sum_count_distinct::setup(THD *thd) } } - init_tree(&tree, min(max_heap_table_size, sortbuff_size/16), 0, + init_tree(&tree, min(thd->variables.max_heap_table_size, + thd->variables.sortbuff_size/16), 0, key_length, compare_key, 0, NULL, cmp_arg); use_tree = 1; @@ -1055,8 +1056,8 @@ bool Item_sum_count_distinct::setup(THD *thd) but this has to be handled - otherwise someone can crash the server with a DoS attack */ - max_elements_in_tree = ((key_length) ? max_heap_table_size/key_length : - 1); + max_elements_in_tree = ((key_length) ? + thd->variables.max_heap_table_size/key_length : 1); } return 0; } @@ -1107,7 +1108,7 @@ bool Item_sum_count_distinct::add() */ if (tree.elements_in_tree > max_elements_in_tree) { - if(tree_to_myisam()) + if (tree_to_myisam()) return 1; } else if (!tree_insert(&tree, table->record[0] + rec_offset, 0, tree.custom_arg)) |