1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fixed bug mdev-8603.

When building different range and index-merge trees the range optimizer
could build an index-merge tree with an index scan containing less ranges
then needed. This index-merge could be chosen as the best. Following this
index-merge the executioner missed some rows in the result set.
The invalid index scan was built due to an inconsistency in the code
back-ported from mysql into 5.3 that fixed mysql bug #11765831:
the code added to key_or() could change shared keys of the second
ored tree. Partially the problem was fixed in the patch for mariadb
bug #823301, but it turned out that only partially.
This commit is contained in:
Igor Babaev
2017-01-18 11:42:41 -08:00
parent b948b5f7c6
commit f003cc8a35
5 changed files with 141 additions and 21 deletions

View File

@ -9335,6 +9335,13 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
if (!tmp->next_key_part)
{
if (key2->use_count)
{
SEL_ARG *key2_cpy= new SEL_ARG(*key2);
if (key2_cpy)
return 0;
key2= key2_cpy;
}
/*
tmp->next_key_part is empty: cut the range that is covered
by tmp from key2.
@ -9366,13 +9373,6 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
key2: [---]
tmp: [---------]
*/
if (key2->use_count)
{
SEL_ARG *key2_cpy= new SEL_ARG(*key2);
if (key2_cpy)
return 0;
key2= key2_cpy;
}
key2->copy_max_to_min(tmp);
continue;
}