diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-06-03 11:56:50 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-06-03 13:47:30 +0530 |
commit | e900c63f78e6368932d069650ad2ba2bd7e8a3df (patch) | |
tree | 16ce9350f3fff6e4932ba58730d0aa819e63148d /sql/sql_class.h | |
parent | e485ac2b6014b2b6b521870e04d9f16a18630e31 (diff) | |
download | mariadb-git-10.1-mdev22715.tar.gz |
MDEV-22728: SIGFPE in Unique::get_cost_calc_buff_size from prepare_search_best_index_intersect on optimized builds10.1-mdev22715
For low sort_buffer_size, in the cost calculation of using the Unique object the elements in the tree were evaluated to 0, make sure to have atleast 1 element in the Unique tree.
Also for the function Unique::get allocate memory for atleast MERGEBUFF2+1 keys.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 9071a2db516..7ca3896a69d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5216,6 +5216,9 @@ public: { ulonglong max_elems_in_tree= max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size); + + if (max_elems_in_tree == 0) + max_elems_in_tree= 1; return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree)); } |