diff options
Diffstat (limited to 'storage/maria/ma_rnext_same.c')
-rw-r--r-- | storage/maria/ma_rnext_same.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/storage/maria/ma_rnext_same.c b/storage/maria/ma_rnext_same.c index cbd81d20816..c35d8ae0222 100644 --- a/storage/maria/ma_rnext_same.c +++ b/storage/maria/ma_rnext_same.c @@ -30,6 +30,7 @@ int maria_rnext_same(MARIA_HA *info, uchar *buf) int error; uint inx,not_used[2]; MARIA_KEYDEF *keyinfo; + ICP_RESULT icp_res= ICP_MATCH; DBUG_ENTER("maria_rnext_same"); if ((int) (inx= info->lastinx) < 0 || @@ -79,8 +80,19 @@ int maria_rnext_same(MARIA_HA *info, uchar *buf) info->cur_row.lastpos= HA_OFFSET_ERROR; break; } + /* + If we are at the last key on the key page, allow writers to + access the index. + */ + if (info->int_keypos >= info->int_maxpos && + ma_yield_and_check_if_killed(info, inx)) + { + error= 1; + break; + } /* Skip rows that are inserted by other threads since we got a lock */ - if ((info->s->row_is_visible)(info)) + if ((info->s->row_is_visible)(info) && + ((icp_res= ma_check_index_cond(info, inx, buf)) != ICP_NO_MATCH)) break; } } @@ -90,13 +102,15 @@ int maria_rnext_same(MARIA_HA *info, uchar *buf) info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update|= HA_STATE_NEXT_FOUND | HA_STATE_RNEXT_SAME; - if (error) + if (error || icp_res != ICP_MATCH) { + fast_ma_writeinfo(info); if (my_errno == HA_ERR_KEY_NOT_FOUND) - my_errno=HA_ERR_END_OF_FILE; + my_errno= HA_ERR_END_OF_FILE; } else if (!buf) { + fast_ma_writeinfo(info); DBUG_RETURN(info->cur_row.lastpos == HA_OFFSET_ERROR ? my_errno : 0); } else if (!(*info->read_record)(info, buf, info->cur_row.lastpos)) |