List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:January 15 2010 2:12pm
Subject:bzr commit into mysql-5.1-bugteam branch (joro:3316) Bug#46175
View as plain text  
#At file:///home/kgeorge/mysql/work/B46175-5.1-bugteam/ based on revid:joro@stripped

 3316 Georgi Kodinov	2010-01-15
      Bug #46175: NULL read_view and consistent read assertion
      
      The optimizer must not continue executing the current query
      if e.g. the storage engine reports an error.
      This is somewhat hard to implement with Item::val_xxx()
      because they do not have means to return error code.
      This is why we need to check the thread's error state after
      a call to one of the Item::val_xxx() methods.
      
      Fixed store_key_item::copy_inner() to return an error state 
      if an error happened during the call to Item::save_in_field() 
      because it calls Item::val_xxx().
      Also added similar checks to related places.

    modified:
      sql/item.cc
      sql/sql_select.h
=== modified file 'sql/item.cc'
--- a/sql/item.cc	2009-12-08 09:26:11 +0000
+++ b/sql/item.cc	2010-01-15 14:09:20 +0000
@@ -5141,7 +5141,7 @@ int Item::save_in_field(Field *field, bo
     field->set_notnull();
     error=field->store(nr, unsigned_flag);
   }
-  return error;
+  return error ? error : (field->table->in_use->is_error() ? 2 : 0);
 }
 
 

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2009-12-08 09:26:11 +0000
+++ b/sql/sql_select.h	2010-01-15 14:09:20 +0000
@@ -709,6 +709,12 @@ public:
     my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
                                                      table->write_set);
     int res= item->save_in_field(to_field, 1);
+    /*
+     Item::save_in_field() may call Item::val_xxx(). And if this is a subquery
+     we need to check for errors executing it and react accordingly
+    */
+    if (!res && table->in_use->is_error())
+      res= 2;
     dbug_tmp_restore_column_map(table->write_set, old_map);
     null_key= to_field->is_null() || item->null_value;
     return (err != 0 || res > 2 ? STORE_KEY_FATAL : (store_key_result) res); 
@@ -742,6 +748,12 @@ protected:  
         if (!err)
           err= res;
       }
+      /*
+        Item::save_in_field() may call Item::val_xxx(). And if this is a subquery
+        we need to check for errors executing it and react accordingly
+        */
+      if (!err && to_field->table->in_use->is_error())
+        err= 2;
     }
     null_key= to_field->is_null() || item->null_value;
     return (err > 2 ?  STORE_KEY_FATAL : (store_key_result) err);


Attachment: [text/bzr-bundle] bzr/joro@sun.com-20100115140920-wjbo6jzev3auxkvz.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (joro:3316) Bug#46175Georgi Kodinov15 Jan