summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorLuis Soares <luis.soares@sun.com>2010-06-04 00:45:07 +0100
committerLuis Soares <luis.soares@sun.com>2010-06-04 00:45:07 +0100
commit1b61dcf434a042abaa5f1455351ea3e149177fd1 (patch)
tree3762c2f8113c54210fed10dfd72717143d8347ab /sql/log_event.cc
parent20fc48fc38f18b3ad246e171224f23562f59a355 (diff)
downloadmariadb-git-1b61dcf434a042abaa5f1455351ea3e149177fd1.tar.gz
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.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index c07bb573188..9c6de5bb42e 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -9029,14 +9029,11 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
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)