summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-11 17:26:51 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-11 17:26:51 +0200
commit99a9774754ea8c4e309589a2dbc7847e16e1fbde (patch)
treecdd016224c79bf9eb26601471c213824652f424d /sql/opt_range.cc
parent940db6abc8a382bab3f708bf9873eb6496e9a5e3 (diff)
parent5fbfdae130950d0a5a07d4b909f3bf1ff0498d34 (diff)
downloadmariadb-git-99a9774754ea8c4e309589a2dbc7847e16e1fbde.tar.gz
Merge mariadb-10.4.17 into 10.4
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 7a45e59b6e4..043a1e70f61 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -9605,15 +9605,9 @@ tree_or(RANGE_OPT_PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
}
bool no_imerge_from_ranges= FALSE;
- SEL_TREE *rt1= tree1;
- SEL_TREE *rt2= tree2;
/* Build the range part of the tree for the formula (1) */
if (sel_trees_can_be_ored(param, tree1, tree2, &ored_keys))
{
- if (no_merges1)
- rt1= new SEL_TREE(tree1, TRUE, param);
- if (no_merges2)
- rt2= new SEL_TREE(tree2, TRUE, param);
bool must_be_ored= sel_trees_must_be_ored(param, tree1, tree2, ored_keys);
no_imerge_from_ranges= must_be_ored;
@@ -9671,6 +9665,12 @@ tree_or(RANGE_OPT_PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
else if (!no_ranges1 && !no_ranges2 && !no_imerge_from_ranges)
{
/* Build the imerge part of the tree for the formula (1) */
+ SEL_TREE *rt1= tree1;
+ SEL_TREE *rt2= tree2;
+ if (no_merges1)
+ rt1= new SEL_TREE(tree1, TRUE, param);
+ if (no_merges2)
+ rt2= new SEL_TREE(tree2, TRUE, param);
if (!rt1 || !rt2 ||
result->merges.push_back(imerge_from_ranges) ||
imerge_from_ranges->or_sel_tree(param, rt1) ||
@@ -10336,7 +10336,7 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
if (!tmp->next_key_part)
{
SEL_ARG *key2_next= key2->next;
- if (key2->use_count)
+ if (key2_shared)
{
SEL_ARG *key2_cpy= new SEL_ARG(*key2);
if (!key2_cpy)