Debian Codegraph @

mysql-test/suite/rpl/t/rpl_hash_scan_collision.test

raw
1 ##############################################################################
2 # ==== Purpose ====
3 # The purpose of this test is to verify that when a hash collision occurs
4 # between two rows in a table, an UPDATE operation on those rows works as
5 # expected.
6 #
7 # ==== Requirement ====
8 # The replica must ensure that when a hash collision occurs between two rows
9 # in a table, UPDATE operation on those rows execute correctly without
10 # errors or inconsistencies.
11 #
12 # ==== Implementation ====
13 # 1. Create source-replica topology
14 # 2. Set slave_rows_search_algorithms as HASH_SCAN on the replica
15 # 3. For each Scenario [Table with index, Table with out any index],
16 # 3.1 On the source, create a table and insert two rows with the same
17 # hash value
18 # 3.2 On the source, perform an update on the second row and verify
19 # that the update is successful
20 # 3.3 Verify that the update is successful on the replica
21 # 4. Clean up
22 #
23 # ==== References ====
24 # Bug#37462058:GTID and binlog record exists but row is missing, replica stops
25 # with error 1032
26 ###############################################################################
27
28 --source include/have_binlog_format_row.inc
29
30 --echo #
31 --echo # 1. Create source-replica topology
32 --source include/master-slave.inc
33
34 --echo #
35 --echo # 2. Set slave_rows_search_algorithms as HASH_SCAN on the replica
36 --source include/rpl_connection_slave.inc
37 let $sysvars_to_save= [
38 "GLOBAL.slave_rows_search_algorithms"
39 ];
40 --source include/save_sysvars.inc
41 SET GLOBAL slave_rows_search_algorithms= 'HASH_SCAN';
42
43 --echo #
44 --echo # 3. For each Scenario [Table with index, Table with out index]
45 #0. Table with index
46 #1. Table with out any index
47 --let $i= 0
48 while ($i < 2) {
49 --echo #
50 --echo # 3.1 On the source, create a table and insert two rows with
51 --echo # the same hash value
52 --source include/rpl_connection_master.inc
53 if ($i == 0){
54 CREATE TABLE t1 (
55 a BIGINT UNSIGNED NOT NULL,
56 b BIGINT UNSIGNED NOT NULL,
57 c INT DEFAULT NULL,
58 KEY idx (c)
59 ) ENGINE= InnoDB ;
60 }
61 if ($i == 1){
62 CREATE TABLE t1 (
63 a BIGINT UNSIGNED NOT NULL,
64 b BIGINT UNSIGNED NOT NULL,
65 c INT DEFAULT NULL
66 ) ENGINE= InnoDB ;
67 }
68 # crc32(null_bytes,row[1].a,row[1].b,row[1].c)=crc32(null_bytes,row[2].a,row[2].b,row[2].c)
69 INSERT INTO t1 VALUES(0xa8e8ee744ced7ca8, 0x6850119e455ee4ed, null);
70 INSERT INTO t1 VALUES(0x135cd25c170db910, 0x6916c5057592c796, null);
71
72 --source include/sync_slave_sql_with_master.inc
73
74 --source include/rpl_connection_master.inc
75 --echo #
76 --echo # 3.2 On the source, perform an update on the second row
77 --echo # and verify that the update is successful
78 UPDATE t1 SET b=1 WHERE a=0x135cd25c170db910;
79 SELECT * FROM t1;
80
81 --echo #
82 --echo # 3.3 Verify that the update is successful on the replica
83 --source include/sync_slave_sql_with_master.inc
84 --let $diff_tables= master:test.t1, slave:test.t1
85 --source include/diff_tables.inc
86
87 # Drop table for the next test
88 --source include/rpl_connection_master.inc
89 DROP TABLE t1;
90 --source include/sync_slave_sql_with_master.inc
91 --inc $i
92 }
93
94 --echo #
95 --echo # 4. Cleanup
96 --source include/restore_sysvars.inc
97
98 --source include/rpl_end.inc