mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
BUG#11766865: 60091: RBR + NO PK + UPDATE NULL VALUE --> SLAVE BREAK WITH ERROR HA_ERR_END_OF_
The slave was not able to find the correct row in the innodb table, because the row fetched from the innodb table would not match the before image. This happened because the (don't care) bytes in the NULLed fields would change once the row was stored in the storage engine (from zero to the default value). This would make bulk memory comparison (using memcmp) to fail. We fix this by taking a preventing measure and avoiding memcmp for tables that contain nullable fields. Therefore, we protect the slave search routine from engines that return arbitrary values for don't care bytes (in the nulled fields). Instead, the slave thread will only check null_bits and those fields that are not set to NULL when comparing the before image against the storage engine row. mysql-test/extra/rpl_tests/rpl_record_compare.test: Added test case to the include file so that this is tested with more than one engine. mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result: Result update. mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result: Result update. mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test: Moved the include file last, so that the result from BUG#11766865 is not intermixed with the result for BUG#11760454. sql/log_event.cc: Skips memory comparison if the table has nullable columns and compares only non-nulled fields in the field comparison loop.
This commit is contained in:
parent
378091e434
commit
b489c89f73
5 changed files with 69 additions and 14 deletions
|
|
@ -8888,7 +8888,19 @@ static bool record_compare(TABLE *table)
|
|||
}
|
||||
}
|
||||
|
||||
if (table->s->blob_fields + table->s->varchar_fields == 0)
|
||||
/**
|
||||
Compare full record only if:
|
||||
- there are no blob fields (otherwise we would also need
|
||||
to compare blobs contents as well);
|
||||
- there are no varchar fields (otherwise we would also need
|
||||
to compare varchar contents as well);
|
||||
- there are no null fields, otherwise NULLed fields
|
||||
contents (i.e., the don't care bytes) may show arbitrary
|
||||
values, depending on how each engine handles internally.
|
||||
*/
|
||||
if ((table->s->blob_fields +
|
||||
table->s->varchar_fields +
|
||||
table->s->null_fields) == 0)
|
||||
{
|
||||
result= cmp_record(table,record[1]);
|
||||
goto record_compare_exit;
|
||||
|
|
@ -8903,13 +8915,22 @@ static bool record_compare(TABLE *table)
|
|||
goto record_compare_exit;
|
||||
}
|
||||
|
||||
/* Compare updated fields */
|
||||
/* Compare fields */
|
||||
for (Field **ptr=table->field ; *ptr ; ptr++)
|
||||
{
|
||||
if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length))
|
||||
|
||||
/**
|
||||
We only compare field contents that are not null.
|
||||
NULL fields (i.e., their null bits) were compared
|
||||
earlier.
|
||||
*/
|
||||
if (!(*(ptr))->is_null())
|
||||
{
|
||||
result= TRUE;
|
||||
goto record_compare_exit;
|
||||
if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length))
|
||||
{
|
||||
result= TRUE;
|
||||
goto record_compare_exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue