[Commits] Rev 2847: Code cleanup in file:///home/psergey/dev2/maria-5.3-mwl128-dsmrr-cpk/

Sergey Petrunya psergey at askmonty.org
Mon Nov 8 07:02:02 EET 2010


At file:///home/psergey/dev2/maria-5.3-mwl128-dsmrr-cpk/

------------------------------------------------------------
revno: 2847
revision-id: psergey at askmonty.org-20101108050200-l6v9bg0rtc3zz5tj
parent: psergey at askmonty.org-20101107152127-xrb2yx1hfl84et9c
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: maria-5.3-mwl128-dsmrr-cpk
timestamp: Mon 2010-11-08 08:02:00 +0300
message:
  Code cleanup
  - Better error handling
  
  BUG#670417: Diverging results in maria-5.3-mwl128-dsmrr-cpk with join buffer
  - Don't use identical detection when ICP is on
  - Update test results
=== modified file 'mysql-test/r/myisam_mrr.result'
--- a/mysql-test/r/myisam_mrr.result	2010-11-07 15:21:27 +0000
+++ b/mysql-test/r/myisam_mrr.result	2010-11-08 05:02:00 +0000
@@ -505,7 +505,7 @@
 ON table3.col_varchar_key = table2.col_varchar_key AND 
 table3.col_varchar_key = table2.col_varchar_nokey;
 COUNT(table2.col_varchar_key)
-49
+50
 EXPLAIN SELECT 
 COUNT(table2.col_varchar_key) 
 FROM 

=== modified file 'sql/multi_range_read.cc'
--- a/sql/multi_range_read.cc	2010-11-07 15:21:27 +0000
+++ b/sql/multi_range_read.cc	2010-11-08 05:02:00 +0000
@@ -329,6 +329,7 @@
 
 int Mrr_ordered_index_reader::get_next(char **range_info)
 {
+  int res;
   DBUG_ENTER("Mrr_ordered_index_reader::get_next");
   
   if (!know_key_tuple_params)
@@ -345,22 +346,24 @@
     bool have_record= FALSE;
     if (scanning_key_val_iter)
     {
-      //psergey-todo: error handling!
-      if (kv_it.get_next())
+      if ((res= kv_it.get_next()))
       {
         kv_it.close();
         scanning_key_val_iter= FALSE;
+        if ((res != HA_ERR_KEY_NOT_FOUND && res != HA_ERR_END_OF_FILE))
+          DBUG_RETURN(res);
       }
       else
         have_record= TRUE;
     }
     else
     {
-      while (kv_it.init(this))
+      while ((res= kv_it.init(this)))
       {
-        if (key_buffer->is_empty())
+        if ((res != HA_ERR_KEY_NOT_FOUND && res != HA_ERR_END_OF_FILE) ||
+            key_buffer->is_empty())
         {
-          DBUG_RETURN(HA_ERR_END_OF_FILE);
+          DBUG_RETURN(res);
         }
       }
       scanning_key_val_iter= TRUE;
@@ -469,6 +472,7 @@
   mrr_funcs= *seq_funcs;
   know_key_tuple_params= FALSE;
   buf_manager= buf_manager_arg;
+  skip_identical_key_handling= test(mrr_funcs.skip_index_tuple);
   return 0;
 }
 
@@ -1086,10 +1090,10 @@
   @note
   to point at the start of owner_arg->key_buffer
 
-  @retval .
+  @retval FALSE OK
 
 */
-bool Key_value_records_iterator::init(Mrr_ordered_index_reader *owner_arg)
+int Key_value_records_iterator::init(Mrr_ordered_index_reader *owner_arg)
 {
   int res;
   owner= owner_arg;
@@ -1103,7 +1107,7 @@
                                    sizeof(void*));
 
   if (identical_key_it.read())
-    return TRUE;
+    return HA_ERR_END_OF_FILE;
 
   uchar *key_in_buf= cur_index_tuple;
 
@@ -1115,7 +1119,7 @@
   uchar *save_cur_index_tuple= cur_index_tuple;
   while (!identical_key_it.read())
   {
-    if (owner->skip_identical_key_handling &&
+    if (owner->skip_identical_key_handling ||
         Mrr_ordered_index_reader::key_tuple_cmp(owner, key_in_buf, 
                                                 cur_index_tuple))
       break;
@@ -1131,7 +1135,7 @@
   if (res)
   {
     close();
-    return res; /* Fatal error */
+    return res;
   }
   get_next_row= FALSE;
   return 0;
@@ -1152,8 +1156,8 @@
                                     cur_index_tuple, 
                                     owner->keypar.key_tuple_length)))
     {
-      /* EOF is EOF for iterator, also, any error means EOF on the iterator */
-      return res;
+      /* It's either HA_ERR_END_OF_FILE or some other error */
+      return res; 
     }
     identical_key_it.init(owner->key_buffer);
     get_next_row= FALSE;

=== modified file 'sql/multi_range_read.h'
--- a/sql/multi_range_read.h	2010-11-07 15:21:27 +0000
+++ b/sql/multi_range_read.h	2010-11-08 05:02:00 +0000
@@ -135,7 +135,7 @@
   
   uchar *cur_index_tuple; /* key_buffer.read() reads to here */
 public:
-  bool init(Mrr_ordered_index_reader *owner_arg);
+  int init(Mrr_ordered_index_reader *owner_arg);
   int get_next();
   void close();
 };



More information about the commits mailing list