List:Commits« Previous MessageNext Message »
From:Luis Soares Date:June 3 2010 11:45pm
Subject:bzr commit into mysql-5.1-bugteam branch (luis.soares:3412) Bug#53893
View as plain text  
#At file:///home/lsoares/Workspace/bzr/work/bugfixing/53893/post-push-fix/mysql-5.1-bugteam-gca/ based on revid:luis.soares@stripped

 3412 Luis Soares	2010-06-04
      BUG#53893: RBR: nullable unique key can lead to out-of-sync slave
        
      Post-push fix.
        
      There was a valgrind issue on the loop that checks whether there
      are NULL fields in the UNIQUE KEY or not. In detail, for the last 
      iteration the server may read out of the key_part array boundaries,
      making valgrind to output warnings.
      
      We fix this by correcting the loop, ie, moving the part that reads
      from the key_part to be inside the loop statement block. This way
      the assignment is protected by the loop condition.

    modified:
      sql/log_event.cc
      sql/log_event_old.cc
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2010-06-02 22:26:12 +0000
+++ b/sql/log_event.cc	2010-06-03 23:45:07 +0000
@@ -9029,14 +9029,11 @@ int Rows_log_event::find_row(const Relay
           BI image that is null and part of UNNI.
         */
         bool null_found= FALSE;
-
-        for (uint i=0, fieldnr= keyinfo->key_part[i].fieldnr - 1 ;
-             (i < keyinfo->key_parts) && !null_found ;
-             i++, fieldnr= keyinfo->key_part[i].fieldnr - 1)
+        for (uint i=0; i < keyinfo->key_parts && !null_found; i++)
         {
+          uint fieldnr= keyinfo->key_part[i].fieldnr - 1;
           Field **f= table->field+fieldnr;
-          if ((*f)->is_null())
-            null_found= TRUE;
+          null_found= (*f)->is_null();
         }
 
         if (!null_found)

=== modified file 'sql/log_event_old.cc'
--- a/sql/log_event_old.cc	2010-06-02 22:26:12 +0000
+++ b/sql/log_event_old.cc	2010-06-03 23:45:07 +0000
@@ -2442,14 +2442,11 @@ int Old_rows_log_event::find_row(const R
           BI image that is null and part of UNNI.
         */
         bool null_found= FALSE;
-
-        for (uint i=0, fieldnr= keyinfo->key_part[i].fieldnr - 1 ;
-             (i < keyinfo->key_parts) && !null_found ;
-             i++, fieldnr= keyinfo->key_part[i].fieldnr - 1)
+        for (uint i=0; i < keyinfo->key_parts && !null_found; i++)
         {
+          uint fieldnr= keyinfo->key_part[i].fieldnr - 1;
           Field **f= table->field+fieldnr;
-          if ((*f)->is_null())
-            null_found= TRUE;
+          null_found= (*f)->is_null();
         }
 
         if (!null_found)


Attachment: [text/bzr-bundle] bzr/luis.soares@sun.com-20100603234507-89huq6t3732830jg.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (luis.soares:3412) Bug#53893Luis Soares4 Jun