Debian Codegraph @

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

raw
1 --echo #
2 --echo # Bug#30072179: USING INVISIBLE INDEX WHEN SLAVE APPLY EVENT
3 --echo #
4
5 #
6 # The variable Replica_rows_last_search_algorithm_used forms the basis for this
7 # test, and it is only available in debug builds.
8 #
9 --source include/have_debug.inc
10
11 --source include/master-slave.inc
12
13 --echo [Connection Master]
14 --connection master
15
16 SET sql_log_bin = OFF;
17
18 CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, C INT, PRIMARY KEY (a));
19
20 SET sql_log_bin = ON;
21
22 --echo [Connection Slave]
23 --connection slave
24
25 CREATE TABLE t1 (
26 a INT NOT NULL,
27 b INT NOT NULL,
28 c INT,
29 PRIMARY KEY (b),
30 UNIQUE KEY(a) INVISIBLE
31 );
32
33 --echo [Connection Master]
34 --connection master
35
36 INSERT INTO t1 VALUES (1, 1, 1), (2, 2, 2), (3, 3, 3);
37
38 UPDATE t1 SET c = 100 WHERE a = 1;
39
40 --source include/sync_slave_sql_with_master.inc
41
42 --echo [Connection Slave]
43 --connection slave
44
45 --echo # Should not have used the a index to syncronize the row.
46
47 SELECT 1 AS not_using_index FROM performance_schema.global_status
48 WHERE variable_name = 'Replica_rows_last_search_algorithm_used'
49 AND variable_value <> 'INDEX_SCAN';
50
51 --echo # Make sure it indeed synchronized. This _will_ use the index.
52 SELECT * FROM t1;
53
54 --echo [Connection Master]
55 --connection master
56
57 DROP TABLE t1;
58
59 --source include/sync_slave_sql_with_master.inc
60
61 --source include/rpl_end.inc