diff options
-rw-r--r-- | storage/maria/ma_rsame.c | 7 | ||||
-rw-r--r-- | storage/maria/ma_search.c | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/storage/maria/ma_rsame.c b/storage/maria/ma_rsame.c index 4bd218a01df..a5953cd09cb 100644 --- a/storage/maria/ma_rsame.c +++ b/storage/maria/ma_rsame.c @@ -19,7 +19,7 @@ Find current row with read on position or read on key @notes - If inx >= 0 find record using key + If inx >= 0 find record using key else re-read row on last position @warning This function is not row version safe. @@ -29,6 +29,7 @@ @retval 0 Ok @retval HA_ERR_KEY_NOT_FOUND Row is deleted @retval HA_ERR_END_OF_FILE End of file + @retval HA_ERR_WRONG_INDEX Wrong inx argument */ @@ -36,10 +37,10 @@ int maria_rsame(MARIA_HA *info, uchar *record, int inx) { DBUG_ENTER("maria_rsame"); - if (inx >= 0 && !_ma_check_index(info, inx)) + if (inx >= 0 && _ma_check_index(info, inx) < 0) { DBUG_PRINT("error", ("wrong index usage")); - DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX); + DBUG_RETURN(my_errno); } if (info->cur_row.lastpos == HA_OFFSET_ERROR || info->update & HA_STATE_DELETED) diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c index f8ec1292523..cf64612f30d 100644 --- a/storage/maria/ma_search.c +++ b/storage/maria/ma_search.c @@ -44,8 +44,12 @@ int _ma_check_index(MARIA_HA *info, int inx) info->update= ((info->update & (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED)) | HA_STATE_NEXT_FOUND | HA_STATE_PREV_FOUND); } - if (info->opt_flag & WRITE_CACHE_USED && flush_io_cache(&info->rec_cache)) + if ((info->opt_flag & WRITE_CACHE_USED) && flush_io_cache(&info->rec_cache)) + { + if (unlikely(!my_errno)) + my_errno= HA_ERR_INTERNAL_ERROR; /* Impossible */ return(-1); + } return(inx); } /* _ma_check_index */ |