Commit 4ef446f2 authored by Michael Widenius's avatar Michael Widenius

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.
parent fe37e5dc
......@@ -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)
......
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment