[Commits] Rev 3009: Fixed wrong test in maria_rsame() that caused ma_test_all to fail. in lp:maria/5.1

Michael Widenius monty at askmonty.org
Tue Jan 11 13:27:17 EET 2011


At lp:maria/5.1

------------------------------------------------------------
revno: 3009
revision-id: monty at askmonty.org-20110111112716-cdj5v8hdwo5y4nz9
parent: monty at askmonty.org-20110111101803-27t2nwaw26nqki5j
committer: Michael Widenius <monty at askmonty.org>
branch nick: maria-5.1
timestamp: Tue 2011-01-11 13:27:16 +0200
message:
  Fixed wrong test in maria_rsame() that caused ma_test_all to fail.
-------------- next part --------------
=== modified file 'storage/maria/ma_rsame.c'
--- a/storage/maria/ma_rsame.c	2011-01-10 21:22:40 +0000
+++ b/storage/maria/ma_rsame.c	2011-01-11 11:27:16 +0000
@@ -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 *r
 {
   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)

=== modified file 'storage/maria/ma_search.c'
--- a/storage/maria/ma_search.c	2011-01-11 10:18:03 +0000
+++ b/storage/maria/ma_search.c	2011-01-11 11:27:16 +0000
@@ -44,8 +44,12 @@ int _ma_check_index(MARIA_HA *info, int
     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 */
 



More information about the commits mailing list