mirror of
https://github.com/MariaDB/server.git
synced 2026-05-02 13:15:32 +02:00
Merge branch '10.1' into 10.2
This commit is contained in:
commit
8c67ffffe8
19 changed files with 207 additions and 61 deletions
|
|
@ -318,6 +318,9 @@ double Unique::get_use_cost(uint *buffer, size_t nkeys, uint key_size,
|
|||
max_elements_in_tree= ((size_t) max_in_memory_size /
|
||||
ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
|
||||
|
||||
if (max_elements_in_tree == 0)
|
||||
max_elements_in_tree= 1;
|
||||
|
||||
n_full_trees= nkeys / max_elements_in_tree;
|
||||
last_tree_elems= nkeys % max_elements_in_tree;
|
||||
|
||||
|
|
@ -786,7 +789,12 @@ bool Unique::get(TABLE *table)
|
|||
/* Not enough memory; Save the result to file && free memory used by tree */
|
||||
if (flush())
|
||||
DBUG_RETURN(1);
|
||||
size_t buff_sz= (max_in_memory_size / full_size + 1) * full_size;
|
||||
/*
|
||||
merge_buffer must fit at least MERGEBUFF2 + 1 keys, because
|
||||
merge_index() can merge that many BUFFPEKs at once. The extra space for
|
||||
one key for Sort_param::unique_buff
|
||||
*/
|
||||
size_t buff_sz= MY_MAX(MERGEBUFF2+1, max_in_memory_size/full_size+1) * full_size;
|
||||
if (!(sort_buffer= (uchar*) my_malloc(buff_sz,
|
||||
MYF(MY_THREAD_SPECIFIC|MY_WME))))
|
||||
DBUG_RETURN(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue