summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-07-30 23:08:05 -0700
committerIgor Babaev <igor@askmonty.org>2012-07-30 23:08:05 -0700
commit3116e3ad6164c96edc2a27c3438f325c4dc464f3 (patch)
treea46cf41ad73a7f87c4679ea9d26d90af27b84753 /sql/opt_range.cc
parente13cd5abc1fc194eca36ed3ea145a114a3001627 (diff)
parent257fd9d3d9b5755128e0a226c26e5b5a0464b9ca (diff)
downloadmariadb-git-3116e3ad6164c96edc2a27c3438f325c4dc464f3.tar.gz
Merge 5.5 -> 5.5-mwl248.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 7a8beb76c0c..e373e5197fe 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2008,7 +2008,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
if (reuse_handler)
{
DBUG_PRINT("info", ("Reusing handler 0x%lx", (long) file));
- if (init() || reset())
+ if (init())
{
DBUG_RETURN(1);
}
@@ -2043,7 +2043,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
if (file->ha_external_lock(thd, F_RDLCK))
goto failure;
- if (init() || reset())
+ if (init())
{
file->ha_external_lock(thd, F_UNLCK);
file->ha_close();
@@ -2090,7 +2090,18 @@ end:
head->key_read= org_key_read;
bitmap_copy(&column_bitmap, head->read_set);
head->column_bitmaps_set(&column_bitmap, &column_bitmap);
-
+
+ if (reset())
+ {
+ if (!reuse_handler)
+ {
+ file->ha_external_lock(thd, F_UNLCK);
+ file->ha_close();
+ goto failure;
+ }
+ else
+ DBUG_RETURN(1);
+ }
DBUG_RETURN(0);
failure: