summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-01-11 13:27:16 +0200
committerMichael Widenius <monty@askmonty.org>2011-01-11 13:27:16 +0200
commit9ae7fb96b064b9bc9b0a8299a50422d0b5be76cf (patch)
tree8e6e06fbd8a5d4e5befce04416220d18bf2ecffd /storage
parentfcd3f2cd4b9da71592242d6e09a8493432b6bec2 (diff)
downloadmariadb-git-9ae7fb96b064b9bc9b0a8299a50422d0b5be76cf.tar.gz
Fixed wrong test in maria_rsame() that caused ma_test_all to fail.
storage/maria/ma_rsame.c: Fixed wrong test of index usage storage/maria/ma_search.c: Fixed test to avoid compiler warnings. Safety fix to ensure that my_error is properly set in case of errors.
Diffstat (limited to 'storage')
-rw-r--r--storage/maria/ma_rsame.c7
-rw-r--r--storage/maria/ma_search.c6
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 */