diff options
author | evgen@moonbone.local <> | 2005-09-16 01:19:43 +0400 |
---|---|---|
committer | evgen@moonbone.local <> | 2005-09-16 01:19:43 +0400 |
commit | 097ca8ad90341df316c47473f1174af31afe3bc4 (patch) | |
tree | a9e1d436a1bedcafce2bfe785ab45cc8b9317b45 /sql/opt_range.cc | |
parent | d0f585f11f6147ea6cdae8e317f51686af29f029 (diff) | |
download | mariadb-git-097ca8ad90341df316c47473f1174af31afe3bc4.tar.gz |
Fix bug #12291 Table wasn't reinited for index scan after sequential scan
Optimizer did choose "Range checked for each record" for one of the tables.
For first few loops over that table it choose sequential access, on later
stage it choose to use index. Because table was previously initialized for
sequential access, it skips intitialization for index access, and when
server tries to retrieve data error occurs.
QUICK_RANGE_SELECT::init() changes so if file already initialized for
sequential access, it calls ha_rnd_end() and initializes file for index
access.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index cb250251155..edb4289e76f 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -750,10 +750,9 @@ int QUICK_RANGE_SELECT::init() { DBUG_ENTER("QUICK_RANGE_SELECT::init"); - if (file->inited == handler::NONE) - DBUG_RETURN(error= file->ha_index_init(index)); - error= 0; - DBUG_RETURN(0); + if (file->inited != handler::NONE) + file->ha_index_or_rnd_end(); + DBUG_RETURN(error= file->ha_index_init(index)); } |