summaryrefslogtreecommitdiff
path: root/storage/maria/ma_rnext.c
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2009-12-15 10:16:46 +0300
committerSergey Petrunya <psergey@askmonty.org>2009-12-15 10:16:46 +0300
commit96e092dc73529978053c1e41aa09b70fd2c7c408 (patch)
treeb6e8286b05a0b2e8772ec6da055337812d60b3e8 /storage/maria/ma_rnext.c
parente4e1ae0d13da399d53bd91df791b149f3eae796b (diff)
downloadmariadb-git-96e092dc73529978053c1e41aa09b70fd2c7c408.tar.gz
Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface" WL#2475 "Batched range read functions for MyISAM/InnoDb" "Index condition pushdown for MyISAM/InnoDB" Igor's fix from sp1r-igor@olga.mysql.com-20080330055902-07614: There could be observed the following problems: 1. EXPLAIN did not mention pushdown conditions from on expressions in the 'extra' column. As a result if a query had no where conditions pushed down to a table, but had on conditions pushed to this table the 'extra' column in the EXPLAIN for the table missed 'using where'. 2. Conditions for ref access were not eliminated from on expressions though such conditions were eliminated from the where condition.
Diffstat (limited to 'storage/maria/ma_rnext.c')
-rw-r--r--storage/maria/ma_rnext.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/storage/maria/ma_rnext.c b/storage/maria/ma_rnext.c
index be960eccfe0..bdba5ff3a17 100644
--- a/storage/maria/ma_rnext.c
+++ b/storage/maria/ma_rnext.c
@@ -30,6 +30,7 @@ int maria_rnext(MARIA_HA *info, uchar *buf, int inx)
uint flag;
MARIA_SHARE *share= info->s;
MARIA_KEYDEF *keyinfo;
+ int icp_res= 1;
DBUG_ENTER("maria_rnext");
if ((inx = _ma_check_index(info,inx)) < 0)
@@ -90,7 +91,8 @@ int maria_rnext(MARIA_HA *info, uchar *buf, int inx)
if (!error)
{
- while (!(*share->row_is_visible)(info))
+ while (!(*share->row_is_visible)(info) ||
+ ((icp_res= ma_check_index_cond(info, inx, buf)) == 0))
{
/* Skip rows inserted by other threads since we got a lock */
if ((error= _ma_search_next(info, &info->last_key,
@@ -105,8 +107,11 @@ int maria_rnext(MARIA_HA *info, uchar *buf, int inx)
/* Don't clear if database-changed */
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
info->update|= HA_STATE_NEXT_FOUND;
+
+ if (icp_res == 2)
+ my_errno=HA_ERR_END_OF_FILE; /* got beyond the end of scanned range */
- if (error)
+ if (error || icp_res != 1)
{
if (my_errno == HA_ERR_KEY_NOT_FOUND)
my_errno=HA_ERR_END_OF_FILE;