summaryrefslogtreecommitdiff
path: root/sql/multi_range_read.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-03-04 01:30:25 +0300
committerSergey Petrunya <psergey@askmonty.org>2011-03-04 01:30:25 +0300
commitcdd214de1c3902e794940af6911666f7e40cbb4d (patch)
tree195f76cf7a1956f0667e9c30dd2ef20d37e54190 /sql/multi_range_read.cc
parent0e090eaa5170201dcc6e00dfd0fc238b81743c2b (diff)
parent9faf5452a1ea75e21f5b6eedcbbc3ccf9606f496 (diff)
downloadmariadb-git-cdd214de1c3902e794940af6911666f7e40cbb4d.tar.gz
Merge fix for BUG#693747
Diffstat (limited to 'sql/multi_range_read.cc')
-rw-r--r--sql/multi_range_read.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index c8c7586b913..5a6cb0a99f7 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -940,7 +940,26 @@ error:
DBUG_RETURN(res);
use_default_impl:
- DBUG_ASSERT(primary_file->inited == handler::INDEX);
+ if (primary_file->inited != handler::INDEX)
+ {
+ /* We can get here when
+ - we've previously successfully done a DS-MRR scan (and so have
+ secondary_file!= NULL, secondary_file->inited= INDEX,
+ primary_file->inited=RND)
+ - for this invocation, we haven't got enough buffer space, and so we
+ have to use the default MRR implementation.
+
+ note: primary_file->ha_index_end() will call dsmrr_close() which will
+ close/destroy the secondary_file, this is intentional.
+ (Yes this is slow, but one can't expect performance with join buffer
+ so small that it can accomodate one rowid and one index tuple)
+ */
+ if ((res= primary_file->ha_rnd_end()) ||
+ (res= primary_file->ha_index_init(keyno, test(mode & HA_MRR_SORTED))))
+ {
+ DBUG_RETURN(res);
+ }
+ }
/* Call correct init function and assign to top level object */
Mrr_simple_index_reader *s= &reader_factory.simple_index_reader;
res= s->init(primary_file, seq_funcs, seq_init_param, n_ranges, mode, NULL,