summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-01-17 22:56:12 +0200
committerVarun Gupta <varun.gupta@mariadb.com>2019-01-18 23:36:47 +0530
commit2061e00c200cc994130c00d58632aecba336273b (patch)
tree84cc7fd9482a468679843dc8480b7ca4502b0bd8 /sql/opt_range.cc
parent19a7656fb12bfae7472658056f400bb81ab99c2f (diff)
downloadmariadb-git-2061e00c200cc994130c00d58632aecba336273b.tar.gz
MDEV-14440: Assertion `inited==RND' failed in handler::ha_rnd_end
In the function QUICK_RANGE_SELECT::init_ror_merged_scan we create a seperate handler if the handler in head->file cannot be reused. The flag free_file tells us if we have a seperate handler or not. There are cases where you might create a handler and then there might be a failure(running ALTER) and then we have to revert the handler back to the original one. The code does that but it does not reset the flag 'free_file' in this case. Also backported f2c418079def.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index b1f8366d83b..ef40e0b6daa 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2161,6 +2161,7 @@ failure:
head->column_bitmaps_set(save_read_set, save_write_set);
delete file;
file= save_file;
+ free_file= false;
DBUG_RETURN(1);
}
@@ -7140,6 +7141,8 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree,
if (ror_intersect_add(intersect, cpk_scan, TRUE) &&
(intersect->total_cost < min_cost))
intersect_best= intersect; //just set pointer here
+ else
+ cpk_scan= 0; // Don't use cpk_scan
}
else
cpk_scan= 0; // Don't use cpk_scan