mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
73f10f0662
cant find record Some engines return data for the record. Despite the fact that the null bit is set for some fields, their old value may still in the row. This can happen when unpacking an AI from the binlog on top of a previous record in which a field is set to NULL, which previously contained a value. Ultimately, this may cause the comparison of records to fail when the slave is doing an index or range scan. We fix this by deploying a call to reset() for each field that is set to null while unpacking a row from the binary log. Furthermore, we also add mixed mode test case to cover the scenario where updating and setting a field to null through a Query event and later searching it through a rows event will succeed. Finally, we also change the reset() method, from Field_bit class, so that it takes into account bits stored among the null bits and not only the ones stored in the record. mysql-test/suite/rpl/t/rpl_set_null_innodb.test: InnoDB test. mysql-test/suite/rpl/t/rpl_set_null_myisam.test: MyISAM test. mysql-test/suite/rpl_ndb/t/rpl_ndb_set_null.test: NDB test. sql/field.h: Changed reset so that it also clears the bits among the null_bits for the Field_bit class. sql/rpl_record.cc: Resetting field after setting it to null when unpacking row.
86 lines
2.8 KiB
Text
86 lines
2.8 KiB
Text
# Both of the following tests check that comparison of binlog BI
|
|
# against SE record will not fail due to remains from previous values
|
|
# in the SE record (before a given field was set to null).
|
|
#
|
|
# In MIXED mode:
|
|
# - Insert and update are executed as statements
|
|
# - Delete is executed as a row event
|
|
# - Assertion: checks that comparison will not fail because the update
|
|
# statement will clear the record contents for the nulled
|
|
# field. If data was not cleared, some engines may keep
|
|
# the value and return it later as garbage - despite the
|
|
# fact that field is null. This may cause slave to
|
|
# falsely fail in the comparison (memcmp would fail
|
|
# because of "garbage" in record data).
|
|
#
|
|
# In ROW mode:
|
|
# - Insert, update and delete are executed as row events.
|
|
# - Assertion: checks that comparison will not fail because the update
|
|
# rows event will clear the record contents before
|
|
# feeding the new value to the SE. This protects against
|
|
# SEs that do not clear record contents when storing
|
|
# nulled fields. If the engine did not clear the data it
|
|
# would cause slave to falsely fail in the comparison
|
|
# (memcmp would fail because of "garbage" in record
|
|
# data). This scenario is pretty much the same described
|
|
# above in MIXED mode, but checks different execution
|
|
# path in the slave.
|
|
|
|
# BUG#49481: RBR: MyISAM and bit fields may cause slave to stop on
|
|
# delete cant find record
|
|
|
|
-- source include/master-slave-reset.inc
|
|
|
|
-- connection master
|
|
-- eval CREATE TABLE t1 (c1 BIT, c2 INT) Engine=$engine
|
|
INSERT INTO `t1` VALUES ( 1, 1 );
|
|
UPDATE t1 SET c1=NULL where c2=1;
|
|
-- sync_slave_with_master
|
|
|
|
-- let $diff_table_1=master:test.t1
|
|
-- let $diff_table_2=slave:test.t1
|
|
-- source include/diff_tables.inc
|
|
|
|
-- connection master
|
|
# triggers switch to row mode when on mixed
|
|
DELETE FROM t1 WHERE c2=1 LIMIT 1;
|
|
-- sync_slave_with_master
|
|
|
|
-- let $diff_table_1=master:test.t1
|
|
-- let $diff_table_2=slave:test.t1
|
|
-- source include/diff_tables.inc
|
|
|
|
-- connection master
|
|
DROP TABLE t1;
|
|
-- sync_slave_with_master
|
|
|
|
-- source include/master-slave-reset.inc
|
|
|
|
-- connection master
|
|
|
|
# BUG#49482: RBR: Replication may break on deletes when MyISAM tables
|
|
# + char field are used
|
|
|
|
-- eval CREATE TABLE t1 (c1 CHAR) Engine=$engine
|
|
|
|
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
|
|
SELECT * FROM t1;
|
|
UPDATE t1 SET c1=NULL WHERE c1='w';
|
|
-- sync_slave_with_master
|
|
|
|
-- let $diff_table_1=master:test.t1
|
|
-- let $diff_table_2=slave:test.t1
|
|
-- source include/diff_tables.inc
|
|
|
|
-- connection master
|
|
# triggers switch to row mode when on mixed
|
|
DELETE FROM t1 LIMIT 2;
|
|
-- sync_slave_with_master
|
|
|
|
-- let $diff_table_1=master:test.t1
|
|
-- let $diff_table_2=slave:test.t1
|
|
-- source include/diff_tables.inc
|
|
|
|
-- connection master
|
|
DROP TABLE t1;
|
|
-- sync_slave_with_master
|