mirror of
https://github.com/MariaDB/server.git
synced 2025-05-10 02:01:19 +03:00
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.
34 lines
898 B
Plaintext
34 lines
898 B
Plaintext
-- source include/have_binlog_format_row.inc
|
|
-- source include/master-slave.inc
|
|
-- let $engine= MyISAM
|
|
|
|
#
|
|
# BUG#52868 Wrong handling of NULL value during update, replication out of sync
|
|
#
|
|
|
|
|
|
-- echo ## coverage purposes - Field_bits
|
|
-- echo ## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==0
|
|
## Added here because AFAIK it's only MyISAM and NDB that use Field_bits
|
|
|
|
--source include/rpl_reset.inc
|
|
-- connection master
|
|
|
|
-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bit(5)) ENGINE=$engine DEFAULT CHARSET=latin1
|
|
|
|
INSERT INTO t1(c1,c2) VALUES (10, b'1');
|
|
INSERT INTO t1(c1,c2) VALUES (NULL, b'1');
|
|
UPDATE t1 SET c1= 0;
|
|
-- sync_slave_with_master
|
|
|
|
-- let $diff_tables= master:t1, slave:t1
|
|
-- source include/diff_tables.inc
|
|
|
|
-- connection master
|
|
DROP TABLE t1;
|
|
-- sync_slave_with_master
|
|
|
|
-- source extra/rpl_tests/rpl_record_compare.test
|
|
|
|
--source include/rpl_end.inc
|