mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 10:31:54 +01:00
The function records_in_index_intersect_extension tried to
read after the last element of the array of rec_per_key values for an index. This caused a valgrind complain and probably could result in wrong estimates of the cardinality of index intersections.
This commit is contained in:
parent
1684c3e9a0
commit
93fb6ce1fd
1 changed files with 2 additions and 1 deletions
|
@ -5050,6 +5050,7 @@ ha_rows records_in_index_intersect_extension(PARTIAL_INDEX_INTERSECTION_INFO *cu
|
||||||
KEY *key_info= ext_index_scan->key_info;
|
KEY *key_info= ext_index_scan->key_info;
|
||||||
KEY_PART_INFO* key_part= key_info->key_part;
|
KEY_PART_INFO* key_part= key_info->key_part;
|
||||||
KEY_PART_INFO* key_part_end= key_part+ext_index_scan->used_key_parts;
|
KEY_PART_INFO* key_part_end= key_part+ext_index_scan->used_key_parts;
|
||||||
|
uint key_parts= key_info->key_parts;
|
||||||
MY_BITMAP *used_fields= &ext_index_scan->used_fields;
|
MY_BITMAP *used_fields= &ext_index_scan->used_fields;
|
||||||
|
|
||||||
if (!curr->length)
|
if (!curr->length)
|
||||||
|
@ -5072,7 +5073,7 @@ ha_rows records_in_index_intersect_extension(PARTIAL_INDEX_INTERSECTION_INFO *cu
|
||||||
{
|
{
|
||||||
ulong *rec_per_key= key_info->rec_per_key+i;
|
ulong *rec_per_key= key_info->rec_per_key+i;
|
||||||
ulong f1= rec_per_key[0] ? rec_per_key[0] : 1;
|
ulong f1= rec_per_key[0] ? rec_per_key[0] : 1;
|
||||||
ulong f2= rec_per_key[1] ? rec_per_key[1] : 1;
|
ulong f2= i+1 < key_parts && rec_per_key[1] ? rec_per_key[1] : 1;
|
||||||
records= (double) records / f2 * f1;
|
records= (double) records / f2 * f1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue