summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-04-29 01:16:32 +0400
committerunknown <sergefp@mysql.com>2005-04-29 01:16:32 +0400
commit58334f8360065ba62931376f98c2f267d6115a99 (patch)
tree7eeb44b398d001527e547842929d2a9e2063d988 /sql/opt_range.cc
parent6b0a72679c62c75540b687e06998f5037cdc1a4d (diff)
downloadmariadb-git-58334f8360065ba62931376f98c2f267d6115a99.tar.gz
Fix for BUG#10244:
Make get_quick_select_for_ref() accept estimated # records as parameter and set QUICK_RANGE_SELECT::records, as this value is used to allocate buffers in Multi-Range Read. sql/opt_range.cc: Make get_quick_select_for_ref() accept estimated # records as parameter and set QUICK_RANGE_SELECT::records, as this value is used to allocate buffers in Multi-Range Read. sql/opt_range.h: Added "records" parameter to get_quick_select_for_ref() sql/sql_select.cc: Added "records" parameter to get_quick_select_for_ref()
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 95fe003770b..7dfee132ea9 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -5513,14 +5513,26 @@ bool QUICK_ROR_UNION_SELECT::check_if_keys_used(List<Item> *fields)
}
-/****************************************************************************
- Create a QUICK RANGE based on a key
- This allocates things in a new memory root, as this may be called many times
- during a query.
-****************************************************************************/
+/*
+ Create quick select from ref/ref_or_null scan.
+ SYNOPSIS
+ get_quick_select_for_ref()
+ thd Thread handle
+ table Table to access
+ ref ref[_or_null] scan parameters
+ records Estimate of number of records (needed only to construct
+ quick select)
+ NOTES
+ This allocates things in a new memory root, as this may be called many
+ times during a query.
+
+ RETURN
+ Quick select that retrieves the same rows as passed ref scan
+ NULL on error.
+*/
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
- TABLE_REF *ref)
+ TABLE_REF *ref, ha_rows records)
{
MEM_ROOT *old_root= thd->mem_root;
/* The following call may change thd->mem_root */
@@ -5537,6 +5549,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
delete quick;
goto err;
}
+ quick->records= records;
if (cp_buffer_from_ref(thd,ref) && thd->is_fatal_error ||
!(range= new QUICK_RANGE()))